forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Labels
[ARCH] x86_64This bug impacts ARCH=x86_64This bug impacts ARCH=x86_64[BUG] llvmA bug that should be fixed in upstream LLVMA bug that should be fixed in upstream LLVM[FIXED][LINUX] 5.18This bug was fixed in Linux 5.18This bug was fixed in Linux 5.18[TOOL] llvm-objcopyThe issue is relevant to LLVM objcopyThe issue is relevant to LLVM objcopy[WORKAROUND] AppliedThis bug has an applied workaroundThis bug has an applied workaroundlow priorityThis bug is not critical and not a priorityThis bug is not critical and not a priority
Description
The kernel checks for X32 support before using it in arch/x86/Makefile:
ifdef CONFIG_X86_X32
x32_ld_ok := $(call try-run,\
/bin/echo -e '1: .quad 1b' | \
$(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" - && \
$(OBJCOPY) -O elf32-x86-64 "$$TMP" "$$TMPO" && \
$(LD) -m elf32_x86_64 "$$TMPO" -o "$$TMP",y,n)
ifeq ($(x32_ld_ok),y)
CONFIG_X86_X32_ABI := y
KBUILD_AFLAGS += -DCONFIG_X86_X32_ABI
KBUILD_CFLAGS += -DCONFIG_X86_X32_ABI
else
$(warning CONFIG_X86_X32 enabled but no binutils support)
endif
endif
Recently, I have been seeing this in my build log:
$ make -skj"$(nproc)" LLVM=1 O=out/x86_64 distclean allyesconfig init/main.o
...
Segmentation fault
arch/x86/Makefile:140: CONFIG_X86_X32 enabled but no binutils support
...
Running the commands manually, it seems that ld.lld is segfaulting:
$ echo -e '1: .quad 1b' | clang --prefix=<master_binutils_bin> -fno-PIE -no-integrated-as -m64 -c -x assembler -o /tmp/test1.o -
$ llvm-objcopy -O elf32-x86-64 /tmp/test1.o /tmp/test2.o
$ ld.lld -m elf32_x86_64 /tmp/test2.o /tmp/test1.o
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0. Program arguments: /home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/ld.lld -m elf32_x86_64 /tmp/test2.o -o /tmp/test1.o
#0 0x0000000001457124 PrintStackTraceSignalHandler(void*) (/home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/ld.lld+0x1457124) #1 0x0000000001454d1e llvm::sys::RunSignalHandlers() (/home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/ld.lld+0x1454d1e)
#2 0x0000000001457565 SignalHandler(int) (/home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/ld.lld+0x1457565)
#3 0x00007f86da0e03c0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
#4 0x000000000156db59 lld::elf::ObjFile<llvm::object::ELFType<(llvm::support::endianness)1, false> >::createInputSection(llvm::object::Elf_Shdr_Impl<llvm::object::ELFType<(llvm::support::endianness)1, false> > const&) (/home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/ld.lld+0x156db59)
#5 0x00000000015696f9 lld::elf::ObjFile<llvm::object::ELFType<(llvm::support::endianness)1, false> >::initializeSections(bool) (/home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/ld.lld+0x15696f9)
#6 0x00000000015602de lld::elf::parseFile(lld::elf::InputFile*) (/home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/ld.lld+0x15602de)
#7 0x0000000001528c19 void lld::elf::LinkerDriver::link<llvm::object::ELFType<(llvm::support::endianness)1, false> >(llvm::opt::InputArgList&) (/home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/ld.lld+0x1528c19)
#8 0x000000000151e325 lld::elf::LinkerDriver::main(llvm::ArrayRef<char const*>) (/home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/ld.lld+0x151e325)
#9 0x000000000151c026 lld::elf::link(llvm::ArrayRef<char const*>, bool, llvm::raw_ostream&, llvm::raw_ostream&) (/home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/ld.lld+0x151c026)
#10 0x00000000013b9506 main (/home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/ld.lld+0x13b9506)
#11 0x00007f86d9b860b3 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b3)
#12 0x00000000013b8b5e _start (/home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/ld.lld+0x13b8b5e)
...
$ ld.lld --version
LLD 11.0.0 (https://github.com/llvm/llvm-project 414f32a9e862b11f51063b75729278f8d81b12e9) (compatible with GNU linkers)
I can reproduce this with ld.lld 10.0.0, I did not test any earlier versions. I used this above to bisect binutils to 939b95c77bf273b252a49334844c469bd28356a9:
$ git bisect log
# bad: [cee12b773a5b34883884879b9fec091bbb02bc97] Automatic date update in version.in
# good: [39ef85a896e7efa0391a7ed14cc965fe1d46cbb9] Introduce ada_value_print_num
git bisect start 'cee12b773a5b34883884879b9fec091bbb02bc97' '39ef85a896e7efa0391a7ed14cc965fe1d46cbb9'
# good: [c6887cfb4ffb80337618138f4f302eb1bfb6df8a] hurd: add missing awk script dependency
git bisect good c6887cfb4ffb80337618138f4f302eb1bfb6df8a
# good: [6e2469ff7afa5134cb55154212e10f25b9e7b2dd] Handle Windows drives in auto-load script paths
git bisect good 6e2469ff7afa5134cb55154212e10f25b9e7b2dd
# bad: [e7bc9db8f447e056f4faa11702230239b4075c2c] Don't touch frame_info objects if frame cache was reinitialized
git bisect bad e7bc9db8f447e056f4faa11702230239b4075c2c
# bad: [b243ba58e833dbb03f3746c0146f1450822c5d05] [gdb/testsuite] Stabilize execution order in omp-par-scope.c
git bisect bad b243ba58e833dbb03f3746c0146f1450822c5d05
# bad: [2875b28aa871395dc17182f0bacfe40a68b1ad05] x86: avoid attaching suffix to register-only CRC32
git bisect bad 2875b28aa871395dc17182f0bacfe40a68b1ad05
# bad: [0a278aa7552de49be4816409a793c2403f6e87be] Fine tune exec-file-mismatch help and documentation.
git bisect bad 0a278aa7552de49be4816409a793c2403f6e87be
# bad: [af2b31864802e6ca75b2c98ce4a4a7deb9d5c608] [readelf] Fix end_seq entry in -wL. Specifically stop the display of a line number and is_statement/has-view fields for the End of Sequence operator, as these have no meaning.
git bisect bad af2b31864802e6ca75b2c98ce4a4a7deb9d5c608
# good: [fe49679d5193f6ff7cfd333e30883d293112a3d1] Remove powerpc PE support
git bisect good fe49679d5193f6ff7cfd333e30883d293112a3d1
# bad: [f37e5866aa72e76f2199155fb838ffc25c78a26e] Don't compare the pid returned from 'wait' against inferior_ptid.
git bisect bad f37e5866aa72e76f2199155fb838ffc25c78a26e
# bad: [fc238d4a066cdb1a979475ffdf5bd45cdb8a00f0] Support several new ELF auxiliary vector types on FreeBSD.
git bisect bad fc238d4a066cdb1a979475ffdf5bd45cdb8a00f0
# bad: [939b95c77bf273b252a49334844c469bd28356a9] Linux/x86: Configure gas with --enable-x86-used-note by default
git bisect bad 939b95c77bf273b252a49334844c469bd28356a9
# first bad commit: [939b95c77bf273b252a49334844c469bd28356a9] Linux/x86: Configure gas with --enable-x86-used-note by default
However, I am not sure if this is an ld.lld bug or GNU as bug so I am posting here initially. cc @MaskRay
Metadata
Metadata
Assignees
Labels
[ARCH] x86_64This bug impacts ARCH=x86_64This bug impacts ARCH=x86_64[BUG] llvmA bug that should be fixed in upstream LLVMA bug that should be fixed in upstream LLVM[FIXED][LINUX] 5.18This bug was fixed in Linux 5.18This bug was fixed in Linux 5.18[TOOL] llvm-objcopyThe issue is relevant to LLVM objcopyThe issue is relevant to LLVM objcopy[WORKAROUND] AppliedThis bug has an applied workaroundThis bug has an applied workaroundlow priorityThis bug is not critical and not a priorityThis bug is not critical and not a priority