bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/17842] New: [ARM] Gap between sections and section headers when


From: belagod.tejas at gmail dot com
Subject: [Bug ld/17842] New: [ARM] Gap between sections and section headers when ld -s is used.
Date: Wed, 14 Jan 2015 17:29:55 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=17842

            Bug ID: 17842
           Summary: [ARM] Gap between sections and section headers when ld
                    -s is used.
           Product: binutils
           Version: 2.26 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: belagod.tejas at gmail dot com

A new test(gap.s) introduced by PR17773, fails on ARM.

FAIL: strip -s (gap)

When I assemble and link gap.s with the following cmdline:

.../bin-a32/install/bin/arm-none-eabi-as
.../binutils-gdb/ld/testsuite/ld-elf/gap.s -o gap.o
.../bin-a32/install/bin/arm-none-eabi-ld -o gap -s -z stack-size=0 gap.o

I get this with readelf -lS gap

readelf -lS gap
There are 4 section headers, starting at offset 0x8050:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf
Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0 
0
  [ 1] .text             PROGBITS        00008000 008000 000004 00  AX  0   0 
4
  [ 2] .ARM.attributes   ARM_ATTRIBUTES  00000000 008004 000014 00      0   0 
1
  [ 3] .shstrtab         STRTAB          00000000 008018 000021 00      0   0 
1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

Elf file type is EXEC (Executable file)
Entry point 0x8000
There are 1 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x000000 0x00000000 0x00000000 0x08004 0x08004 R E 0x10000

 Section to Segment mapping:
  Segment Sections...
   00     .text 

If you observe closely, the last section ends at (0x8018 + 0x21) = 8039, but
the section headers start at 0x8050. Allowing for 2-byte alignment, they should
have started at 0x803a. There seems to be a gap of 0x16 bytes! A quick hexdump
shows:

...
0008030 7274 6269 7475 7365 0000 0000 0001 0000
0008040 8000 0000 0000 0000 0000 0001 2400 0064
0008050 0000 0000 0000 0000 0000 0000 0000 0000
...

When we strip the gap elf of its symbols, readelf -lS gives:

readelf -lS gap
There are 4 section headers, starting at offset 0x803c:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf
Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0 
0
  [ 1] .text             PROGBITS        00008000 008000 000004 00  AX  0   0 
4
  [ 2] .ARM.attributes   ARM_ATTRIBUTES  00000000 008004 000014 00      0   0 
1
  [ 3] .shstrtab         STRTAB          00000000 008018 000021 00      0   0 
1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

Elf file type is EXEC (Executable file)
Entry point 0x8000
There are 1 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x000000 0x00000000 0x00000000 0x08004 0x08004 R E 0x10000

 Section to Segment mapping:
  Segment Sections...
   00     .text 

Here the section start at 0x803c. What do we put into the gap when linking with
ld -s that can be stripped away?

-- 
You are receiving this mail because:
You are on the CC list for the bug.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]