[llvm-bugs] [Bug 35659] New: Change in COMMON symbol layout after "ELF: Remove DefinedCommon."

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Dec 14 05:50:13 PST 2017


            Bug ID: 35659
           Summary: Change in COMMON symbol layout after "ELF: Remove
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: Alberto.Magni at microsoft.com
                CC: aaron.smith at microsoft.com, llvm-bugs at lists.llvm.org,
                    peter at pcc.me.uk

Created attachment 19548
  --> https://bugs.llvm.org/attachment.cgi?id=19548&action=edit
Map files to show the different layout

LLD commit dc49c0 (https://reviews.llvm.org/D39666) causes the layout of COMMON
symbols to change in a busybox binary. 

You can see this from the two map files attached (generated for x86_64):
busybox_unstripped.map.7ca03 (the common symbols are at the end of the .bss
section) generated with 7ca03, the commit before dc49c0.
busybox_unstripped.map.dc49c0 (the common symbols are at the start of the .bss
(the binaries used by the linker have not changed between the two versions)

dc49c0 appears to me as an internal refactoring to LLD. Is the different layout
expected ? 

I am asking because this change is causing a kernel panic when booting linux
with busybox.  

For completeness at the bottom you find the command line used by the busybox
build system to link the executable (called busybox_unstripped)
(We use musl-clang as a compiler wrapper, which internally calls clang to
statically link against musl libc.a) 
Notice the use of –sort-common, which might explain the difference. 

If you would like to have a reproducer I can come up with one (it probably
won't be pretty though)

Many thanks in advance 

musl-clang -Wall -Wshadow -Wwrite-strings -Wundef -Wstrict-prototypes -Wunused
-Wunused-parameter -Wunused-function -Wunused-value -Wmissing-prototypes
-Wmissing-declarations -Wno-format-security -Wdeclaration-after-statement
-Wold-style-definition -fno-builtin-strlen -finline-limit=0
-fomit-frame-pointer -ffunction-sections -fdata-sections -funsigned-char
-static-libgcc -falign-functions=1 -falign-jumps=1 -falign-labels=1
-falign-loops=1 -fno-unwind-tables -fno-asynchronous-unwind-tables
-fno-builtin-printf -Os -o busybox_unstripped -Wl,--sort-common
-Wl,--sort-section,alignment -Wl,--gc-sections -Wl,--start-group
applets/built-in.o archival/lib.a archival/libarchive/lib.a console-tools/lib.a
coreutils/lib.a coreutils/libcoreutils/lib.a debianutils/lib.a e2fsprogs/lib.a
editors/lib.a findutils/lib.a init/lib.a libbb/lib.a libpwdgrp/lib.a
loginutils/lib.a mailutils/lib.a miscutils/lib.a modutils/lib.a
networking/lib.a networking/libiproute/lib.a networking/udhcp/lib.a
printutils/lib.a procps/lib.a runit/lib.a selinux/lib.a shell/lib.a
sysklogd/lib.a util-linux/lib.a util-linux/volume_id/lib.a archival/built-in.o
archival/libarchive/built-in.o console-tools/built-in.o coreutils/built-in.o
coreutils/libcoreutils/built-in.o debianutils/built-in.o e2fsprogs/built-in.o
editors/built-in.o findutils/built-in.o init/built-in.o libbb/built-in.o
libpwdgrp/built-in.o loginutils/built-in.o mailutils/built-in.o
miscutils/built-in.o modutils/built-in.o networking/built-in.o
networking/libiproute/built-in.o networking/udhcp/built-in.o
printutils/built-in.o procps/built-in.o runit/built-in.o selinux/built-in.o
shell/built-in.o sysklogd/built-in.o util-linux/built-in.o
util-linux/volume_id/built-in.o -Wl,--end-group -Wl,--start-group
-Wl,--end-group -Wl,--warn-common -Wl,-Map,busybox_unstripped.map

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20171214/b935677b/attachment.html>

More information about the llvm-bugs mailing list