[llvm-bugs] [Bug 46299] New: objcopy zero-size section, huge binaries

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jun 12 03:54:06 PDT 2020


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

            Bug ID: 46299
           Summary: objcopy zero-size section, huge binaries
           Product: tools
           Version: 10.0
          Hardware: Other
                OS: other
            Status: NEW
          Severity: normal
          Priority: P
         Component: llvm-objcopy/strip
          Assignee: unassignedbugs at nondot.org
          Reporter: vincent.hamp at higaski.at
                CC: alexander.v.shaposhnikov at gmail.com,
                    jake.h.ehrlich at gmail.com,
                    jh7370.2008 at my.bristol.ac.uk,
                    llvm-bugs at lists.llvm.org, rupprecht at google.com

I'm expecting objcopy to create a binary from the attached ELF like this:
llvm-objcopy A.elf -O binary A.bin

Running size tells me that the binary should have 824B, yet the file I get is
384MB big.

Using readelf -e A.elf to inspect the section headers I can see that there is a
suspicious NULL section at the very beginning which is absolutely empty. Could
this be the reason why the binary gets so bloated?

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf
Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0 
0
  [ 1] .vector_table     PROGBITS        08000000 001000 000010 00   A  0   0 
4
  [ 2] .version          PROGBITS        08000010 001010 000010 00   A  0   0 
1
  [ 3] .text             PROGBITS        08000020 001020 000308 00  AX  0   0 
4
  [ 4] .rodata           PROGBITS        08000328 001328 000000 00  AX  0   0 
1
  [ 5] .ARM.exidx        ARM_EXIDX       08000328 001328 000010 00  AL  3   0 
4
  [ 6] .preinit_array    PROGBITS        08000338 001338 000000 00   A  0   0 
1
  [ 7] .init_array       INIT_ARRAY      08000338 001338 000004 04  WA  0   0 
4
  [ 8] .fini_array       FINI_ARRAY      0800033c 00133c 000004 04  WA  0   0 
4
  [ 9] .data             PROGBITS        20000000 002000 000000 00  WA  0   0 
1
  [10] .data2            PROGBITS        10000000 002000 000000 00  WA  0   0 
1
  [11] .bss              NOBITS          20000000 002000 0001ac 00  WA  0   0
512
  [12] ._user_heap_stack PROGBITS        200001ac 002000 000e04 00  WA  0   0 
1
  [13] .ARM.attributes   ARM_ATTRIBUTES  00000000 002e04 000049 00      0   0 
1
  [14] .debug_str        PROGBITS        00000000 002e4d 004795 01  MS  0   0 
1
  [15] .debug_loc        PROGBITS        00000000 0075e2 001709 00      0   0 
1
  [16] .debug_abbrev     PROGBITS        00000000 008ceb 000d43 00      0   0 
1
  [17] .debug_info       PROGBITS        00000000 009a2e 00a9f9 00      0   0 
1
  [18] .debug_ranges     PROGBITS        00000000 014427 000148 00      0   0 
1
  [19] .comment          PROGBITS        00000000 01456f 00002a 01  MS  0   0 
1
  [20] .debug_frame      PROGBITS        00000000 01459c 00065c 00      0   0 
4
  [21] .debug_line       PROGBITS        00000000 014bf8 0012bb 00      0   0 
1
  [22] .symtab           SYMTAB          00000000 015eb4 000690 10     24  60 
4
  [23] .shstrtab         STRTAB          00000000 016544 000106 00      0   0 
1
  [24] .strtab           STRTAB          00000000 01664a 0004b5 00      0   0 
1

-- 
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/20200612/be520934/attachment.html>


More information about the llvm-bugs mailing list