Bug 26526

Summary: 5014c2d22b2627eb1ac88a4763a58d431fe064a7 breaks compiling the Linux kernel for 32-bit ARM
Product: binutils Reporter: Nathan Chancellor <natechancellor>
Component: gasAssignee: Alan Modra <amodra>
Status: RESOLVED FIXED    
Severity: normal CC: amodra
Priority: P2    
Version: 2.36   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed: 2020-08-23 00:00:00
Attachments: printk.s

Description Nathan Chancellor 2020-08-23 21:35:12 UTC
When building the Linux kernel for 32-bit ARM with LLVM and assembling with gas after 5014c2d22b2627eb1ac88a4763a58d431fe064a7, there is a segmentation fault.

$ make -skj"$(nproc)" ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- LLVM=1 O=out/arm distclean defconfig kernel/printk/printk.o
/tmp/printk-b93386.s: Assembler messages:
/tmp/printk-b93386.s:7753: Internal error (Segmentation fault).
Please report this bug.
clang-12: error: assembler command failed with exit code 1 (use -v to see invocation)
...

$ git bisect log
# bad: [c40e66502cd6cdeea4b16f627059296433b4d48b] Disable default ELF plugins on 32-bit hppa*-*-hpux*.
# good: [4b495c31c14087e851662e790e4ca12bce37dab1] Automatic date update in version.in
git bisect start 'c40e66502cd6cdeea4b16f627059296433b4d48b' '4b495c31c14087e851662e790e4ca12bce37dab1'
# good: [78c02f21ad122c2c775cb6629bb20829b2cafa01] Use gdb::function_view in iterate_over_live_ada_tasks
git bisect good 78c02f21ad122c2c775cb6629bb20829b2cafa01
# good: [82fcdb39388c6690699d41b7022b054c2de2554c] PR26388, objdump debug dump memory leaks
git bisect good 82fcdb39388c6690699d41b7022b054c2de2554c
# good: [abebb03c3af215d7542f5e6b71d78823b15220d5] gas/hash.c: add new functions
git bisect good abebb03c3af215d7542f5e6b71d78823b15220d5
# good: [b70e516e89d95d06252cb04ded3397ec0a0a3212] gdb: handle the `ptid.is_pid ()` case in registers_changed_ptid
git bisect good b70e516e89d95d06252cb04ded3397ec0a0a3212
# bad: [ccf61261eb8cce869ae4452de547a5f3afb074e4] Fix problems with the AArch64 linker exposed by testing it with sanitization enabled.
git bisect bad ccf61261eb8cce869ae4452de547a5f3afb074e4
# good: [e01e1cee39777b6278ff01502742347247e8dfd7] Rearrange symbol_create parameters
git bisect good e01e1cee39777b6278ff01502742347247e8dfd7
# bad: [5014c2d22b2627eb1ac88a4763a58d431fe064a7] Redo gas local symbol support
git bisect bad 5014c2d22b2627eb1ac88a4763a58d431fe064a7
# good: [3c0d9d71db89b5b55ae7f6cb180f4f548efa4bef] gas symbol struct field renaming
git bisect good 3c0d9d71db89b5b55ae7f6cb180f4f548efa4bef
# first bad commit: [5014c2d22b2627eb1ac88a4763a58d431fe064a7] Redo gas local symbol support

If you would like more information, I am happy to provide it, just let me know what I need to do.
Comment 1 Alan Modra 2020-08-23 23:32:02 UTC
Could you attach the .s file please?  I don't have llvm for arm handy, and the bug may well depend on llvm version to trigger.
Comment 2 Nathan Chancellor 2020-08-24 00:19:45 UTC
Created attachment 12790 [details]
printk.s
Comment 3 Nathan Chancellor 2020-08-24 00:20:00 UTC
Hopefully, this works. If not, let me know.
Comment 4 Alan Modra 2020-08-24 03:35:50 UTC
I don't get a segfault, but I do see "Conditional jump or move depends on uninitialised value(s)" from valgrind.  Very likely the cause of your segfault.
Comment 5 cvs-commit@gcc.gnu.org 2020-08-24 04:00:00 UTC
The master branch has been updated by Alan Modra <amodra@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=85d14aaeb757550d63254fae5c0415b782e59a29

commit 85d14aaeb757550d63254fae5c0415b782e59a29
Author: Alan Modra <amodra@gmail.com>
Date:   Mon Aug 24 13:06:46 2020 +0930

    PR26526, 5014c2d22b2 breaks compiling the Linux kernel for ARM
    
            PR 26526
            * symbols.c (local_symbol_convert): Clear out xtra.
Comment 6 Alan Modra 2020-08-24 04:07:35 UTC
Should now be fixed.  Thanks for testing bleeding edge binutils!