[llvm-bugs] [Bug 38723] New: llvm-size reports non-write sections under "data"

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Aug 27 08:24:52 PDT 2018


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

            Bug ID: 38723
           Summary: llvm-size reports non-write sections under "data"
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: japaricious at gmail.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 20778
  --> https://bugs.llvm.org/attachment.cgi?id=20778&action=edit
Binary that demonstrates the problem

Compare these two outputs

LLVM -
https://github.com/llvm-mirror/llvm/commit/24535f7c19077d02b193bc6225a667f963901eb4

```
$ llvm-size app
   text    data     bss     dec     hex filename
    160    1052       4    1216     4c0 app
```

GNU objdump (GNU Binutils) 2.31.1

```
$ size app
   text    data     bss     dec     hex filename
   1208       4       4    1216     4c0 app
```

Now look at the section headers of the app binary (attached)

```
$ readelf -S app
There are 20 section headers, starting at offset 0x2652c:

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 010000 000400 00   A  0   0 
4
  [ 2] .text             PROGBITS        08000400 010400 0000a0 00  AX  0   0 
2
  [ 3] .rodata           PROGBITS        080004a0 0104a0 000018 00   A  0   0 
4
  [ 4] .data             PROGBITS        20000000 020000 000004 00  WA  0   0 
4
  [ 5] .bss              NOBITS          20000004 020004 000004 00  WA  0   0 
4
  [ 6] .debug_str        PROGBITS        00000000 020004 00114f 01  MS  0   0 
1
  [ 7] .debug_loc        PROGBITS        00000000 021153 000148 00      0   0 
1
  [ 8] .debug_abbrev     PROGBITS        00000000 02129b 00036c 00      0   0 
1
  [ 9] .debug_info       PROGBITS        00000000 021607 001ab0 00      0   0 
1
  [10] .debug_ranges     PROGBITS        00000000 0230b7 000048 00      0   0 
1
  [11] .debug_macinfo    PROGBITS        00000000 0230ff 000001 00      0   0 
1
  [12] .debug_pubnames   PROGBITS        00000000 023100 000a20 00      0   0 
1
  [13] .debug_pubtypes   PROGBITS        00000000 023b20 00096f 00      0   0 
1
  [14] .ARM.attributes   ARM_ATTRIBUTES  00000000 02448f 00002e 00      0   0 
1
  [15] .debug_frame      PROGBITS        00000000 0244c0 000084 00      0   0 
4
  [16] .debug_line       PROGBITS        00000000 024544 0005cd 00      0   0 
1
  [17] .symtab           SYMTAB          00000000 024b14 0017c0 10     18 351 
4
  [18] .strtab           STRTAB          00000000 0262d4 000180 00      0   0 
1
  [19] .shstrtab         STRTAB          00000000 026454 0000d8 00      0   0 
1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
  L (link order), O (extra OS processing required), G (group), T (TLS),
  C (compressed), x (unknown), o (OS specific), E (exclude),
  y (purecode), p (processor specific)
```

llvm-size reports `.vector_table`, `.rodata` and `.data` under "data" (1052
bytes) whereas GNU size only reports `.data` under "data" (4 bytes).

I would expect `.vector_table` and `.rodata`, which don't have the write (W)
flag set, to be reported under "text", not "data" -- which what the GNU tool
does

-- 
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/20180827/61df3b79/attachment.html>


More information about the llvm-bugs mailing list