[llvm-bugs] [Bug 43997] New: [LLD/ELF] LLD change inflates elf binary size when linked with no-rosegment

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Nov 13 14:14:20 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=43997

            Bug ID: 43997
           Summary: [LLD/ELF] LLD change inflates elf binary size when
                    linked with no-rosegment
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: denik at google.com
                CC: llvm-bugs at lists.llvm.org, peter.smith at linaro.org

Created attachment 22811
  --> https://bugs.llvm.org/attachment.cgi?id=22811&action=edit
qemu reproducible tarball

The problem was discovered when the elf binary size of some packages after llvm
toolchain update has drastically increased.
The binaries were built with ld.lld --no-rosegment.

For example qemu_x86_64 elf binary size changed from 4MB to 1.6GB.


After bisection I located the commit which introduced the problem:

06bb7dfbd445fe928b0ae0263ba9df1acd861c41
[ELF] Map the ELF header at imageBase

Here is the difference of readelf before and after the commit:

BEFORE:
-------------------------
$ readelf --sections  --wide qemu-x86_64

Section Headers:
  [Nr] Name              Type            Address          Off    Size   ES Flg
Lk Inf Al
  [ 0]                   NULL            0000000000000000 000000 000000 00     
0   0  0
  [ 1] .text             PROGBITS        0000000060000000 001000 245dc6 00  AX 
0   0 32

AFTER:
-------------------------
$ readelf --sections qemu-x86_64

Section Headers:
  [Nr] Name              Type            Address          Off    Size   ES Flg
Lk Inf Al
  [ 0]                   NULL            0000000000000000 000000 000000 00     
0   0  0
  [ 1] .text             PROGBITS        0000000060000000 5fe00000 245dc6 00 
AX  0   0 32


Steps to reproduce:

tar -axf qemu.tar && cd qemu
ld.lld @response.txt
ls -lh qemu-x86_64
readelf --sections --wide qemu-x86_64

-- 
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/20191113/a39df72e/attachment-0001.html>


More information about the llvm-bugs mailing list