<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Change in COMMON symbol layout after "ELF: Remove DefinedCommon.""
   href="https://bugs.llvm.org/show_bug.cgi?id=35659">35659</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Change in COMMON symbol layout after "ELF: Remove DefinedCommon."
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lld
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>ELF
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>Alberto.Magni@microsoft.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>aaron.smith@microsoft.com, llvm-bugs@lists.llvm.org, peter@pcc.me.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=19548" name="attach_19548" title="Map files to show the different layout">attachment 19548</a> <a href="attachment.cgi?id=19548&action=edit" title="Map files to show the different layout">[details]</a></span>
Map files to show the different layout

LLD commit dc49c0 (<a href="https://reviews.llvm.org/D39666">https://reviews.llvm.org/D39666</a>) 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
section) 
(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 
Alberto 


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</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>