Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

llvm-objcopy: error: invalid output format: 'elf64-s390' #1530

Closed
emojifreak opened this issue Dec 6, 2021 · 3 comments
Closed

llvm-objcopy: error: invalid output format: 'elf64-s390' #1530

emojifreak opened this issue Dec 6, 2021 · 3 comments
Labels
[ARCH] s390 This bug impacts ARCH=s390 [BUG] llvm A bug that should be fixed in upstream LLVM [FIXED][LLVM] 19 This bug was fixed in LLVM 19 [TOOL] llvm-objcopy The issue is relevant to LLVM objcopy

Comments

@emojifreak
Copy link

This can be a duplicate of #1524. s390 build fails at the final state as

  OBJCOPY arch/s390/boot/compressed/info.o
llvm-objcopy: error: invalid output format: 'elf64-s390'
make[2]: *** [arch/s390/boot/compressed/Makefile:55: arch/s390/boot/compressed/info.o] Error 1
  OBJCOPY arch/s390/boot/compressed/vmlinux.bin
  GZIP    arch/s390/boot/compressed/vmlinux.bin.gz
  OBJCOPY arch/s390/boot/compressed/piggy.o
llvm-objcopy: error: invalid output format: 'elf64-s390'
make[2]: *** [arch/s390/boot/compressed/Makefile:88: arch/s390/boot/compressed/piggy.o] Error 1
make[2]: Target 'arch/s390/boot/compressed/vmlinux' not remade because of errors.
make[1]: *** [arch/s390/boot/Makefile:69: arch/s390/boot/compressed/vmlinux] Error 2

This can be reproduced by

#!/bin/sh

KVER=5.16-rc3
LANG=C.UTF-8
export LANG
cd /var/tmp/tmp11s390

  cat >/tmp/config$$.txt <<EOF
CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT=n
CONFIG_KASAN=n
CONFIG_GCOV_KERNEL=n
CONFIG_COMPILE_TEST=n
CONFIG_TRIM_UNUSED_KSYMS=y
CONFIG_SHADOW_CALL_STACK=y
CONFIG_LD_DEAD_CODE_DATA_ELIMINATION=y
CONFIG_INIT_STACK_ALL_ZERO=y
CONFIG_KVM=y
CONFIG_PREEMPT=y
CONFIG_PREEMPT_DYNAMIC=y

CONFIG_WERROR=n
CONFIG_RUNTIME_TESTING_MENU=n
CONFIG_XFS_FS=n
CONFIG_OVERLAY_FS=n
CONFIG_EMBEDDED=n

CONFIG_DEBUG_INFO=y
CONFIG_DEBUG_INFO_DWARF5=y

CONFIG_ACPI=y
CONFIG_EFI_STUB=y
CONFIG_EFI=y
CONFIG_DMI=y
CONFIG_NUMA=y
CONFIG_MEMORY_HOTPLUG=y
CONFIG_HOTPLUG_PCI=y
CONFIG_HOTPLUG_PCI_PCIE=y
CONFIG_HOTPLUG_CPU=y

CONFIG_MARCH_Z15=y
CONFIG_TUNE_Z15=y
CONFIG_SCHED_TOPOLOGY=y
EOF


for a in s390; do
  rm -rf /var/tmp/tmp11s390/$a
  mkdir /var/tmp/tmp11s390/$a
  cd /var/tmp/tmp11s390/$a
  exec </dev/null >build-log-${KVER}-${a}.txt 2>&1
  set -xe
  tar zxf /var/tmp/linux-${KVER}.tar.gz
  cd linux-${KVER}

  sed -i 's/-O2/-O3/g' Makefile
  sed -i 's/-Os/-Oz/g' Makefile
  cp /tmp/config$$.txt .config
  make LLVM=1 LLVM_IAS=0 CROSS_COMPILE=s390x-linux-gnu- LD=s390x-linux-gnu-ld allmodconfig
  cat /tmp/config$$.txt >>.config

  yes '' |
    chrt --idle 0 nice -19 make --keep-going ARCH=$a LLVM=1 LLVM_IAS=0 CROSS_COMPILE=s390x-linux-gnu- LD=s390x-linux-gnu-ld KCFLAGS="-mllvm -polly-ast-use-context -mllvm -polly-invariant-load-hoisting -mllvm -polly-opt-fusion=max -mllvm -polly-run-inliner -mllvm -polly-vectorizer=stripmine -mllvm -polly-run-dce" all &
  exec </dev/null >/dev/null 2>&1
done 
wait
@nathanchance
Copy link
Member

Yes, same issue as before, s390 does not appear to be supported with llvm-objcopy: https://github.com/llvm/llvm-project/blob/2f16b87b4b1d3fee07aff71a9bf79c3a8d514e7a/llvm/tools/llvm-objcopy/ConfigManager.cpp#L286-L319

This is reproducible with just defconfig:

$ make -skj"$(nproc)" ARCH=s390 CC=clang CROSS_COMPILE=s390x-linux-gnu- LLVM_IAS=0 OBJCOPY=llvm-objcopy distclean defconfig bzImage
...
llvm-objcopy: error: invalid output format: 'elf64-s390'
make[3]: *** [arch/s390/purgatory/Makefile:49: arch/s390/purgatory/purgatory.ro] Error 1
...

cc @uweigand in case I am missing something.

@nathanchance nathanchance added [ARCH] s390 This bug impacts ARCH=s390 [TOOL] llvm-objcopy The issue is relevant to LLVM objcopy low priority This bug is not critical and not a priority labels Dec 6, 2021
@nathanchance
Copy link
Member

Same workaround as ld.lld: OBJCOPY=s390x-linux-gnu-objcopy.

nathanchance added a commit to nathanchance/continuous-integration2 that referenced this issue May 18, 2022
The s390 folks have updated their asm to work with the integrated
assembler. Enable it for s390 builds on -next.

We cannot switch to LLVM=1 because ld.lld and llvm-objcopy do not
support s390:

ClangBuiltLinux/linux#1524
ClangBuiltLinux/linux#1530

For now, we will just use 'CC=clang LLVM_IAS=1'.

Closes: ClangBuiltLinux#363
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
nathanchance added a commit to nathanchance/continuous-integration2 that referenced this issue May 24, 2022
…inline

The s390 folks have updated their asm to work with the integrated
assembler. Enable it for s390 builds on -next and mainline.

We cannot switch to LLVM=1 because ld.lld and llvm-objcopy do not
support s390:

ClangBuiltLinux/linux#1524
ClangBuiltLinux/linux#1530

For now, we will just use 'CC=clang LLVM_IAS=1'.

Closes: ClangBuiltLinux#363
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
rli9 pushed a commit to intel/lkp-tests that referenced this issue May 31, 2022
Re: llvm-objcopy: error: invalid output format: 'elf64-s390'
-----------
> All errors (new ones prefixed by >>):
>
> >> llvm-objcopy: error: invalid output format: 'elf64-s390'

This is expected, as llvm-objcopy needs support for s390:
ClangBuiltLinux/linux#1530

Please use GNU objcopy for the time being by explicitly providing
OBJCOPY=${CROSS_COMPILE}objcopy to make.

Cheers,
Nathan
-----------

Link: https://lore.kernel.org/lkml/YpJMIz%2FQjDW5IQGr@dev-arch.thelio-3990X/
Signed-off-by: Chen Rong <rong.a.chen@intel.com>
Signed-off-by: Philip Li <philip.li@intel.com>
ammarfaizi2 pushed a commit to ammarfaizi2/lkp-tests that referenced this issue Jun 2, 2022
Re: llvm-objcopy: error: invalid output format: 'elf64-s390'
-----------
> All errors (new ones prefixed by >>):
>
> >> llvm-objcopy: error: invalid output format: 'elf64-s390'

This is expected, as llvm-objcopy needs support for s390:
ClangBuiltLinux/linux#1530

Please use GNU objcopy for the time being by explicitly providing
OBJCOPY=${CROSS_COMPILE}objcopy to make.

Cheers,
Nathan
-----------

Link: https://lore.kernel.org/lkml/YpJMIz%2FQjDW5IQGr@dev-arch.thelio-3990X/
Signed-off-by: Chen Rong <rong.a.chen@intel.com>
Signed-off-by: Philip Li <philip.li@intel.com>
Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org>
uweigand added a commit to uweigand/llvm-project that referenced this issue Feb 15, 2024
This is also necessary for enabling ClangBuiltLinux:
ClangBuiltLinux/linux#1530
uweigand added a commit to llvm/llvm-project that referenced this issue Feb 16, 2024
This is also necessary for enabling ClangBuiltLinux:
ClangBuiltLinux/linux#1530
llvmbot pushed a commit to llvmbot/llvm-project that referenced this issue Feb 20, 2024
This is also necessary for enabling ClangBuiltLinux:
ClangBuiltLinux/linux#1530

(cherry picked from commit 3c02cb7)
@nathanchance
Copy link
Member

Fixed: llvm/llvm-project@3c02cb7

@nathanchance nathanchance added [BUG] llvm A bug that should be fixed in upstream LLVM [FIXED][LLVM] 19 This bug was fixed in LLVM 19 and removed low priority This bug is not critical and not a priority labels Feb 20, 2024
llvmbot pushed a commit to llvmbot/llvm-project that referenced this issue Feb 21, 2024
This is also necessary for enabling ClangBuiltLinux:
ClangBuiltLinux/linux#1530

(cherry picked from commit 3c02cb7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[ARCH] s390 This bug impacts ARCH=s390 [BUG] llvm A bug that should be fixed in upstream LLVM [FIXED][LLVM] 19 This bug was fixed in LLVM 19 [TOOL] llvm-objcopy The issue is relevant to LLVM objcopy
Projects
None yet
Development

No branches or pull requests

2 participants