Bug 24250 - [gold] Section offsets not monotonically increasing with --gdb-index
Summary: [gold] Section offsets not monotonically increasing with --gdb-index
Status: NEW
Alias: None
Product: binutils
Classification: Unclassified
Component: gold (show other bugs)
Version: 2.33
: P2 normal
Target Milestone: ---
Assignee: Cary Coutant
Depends on:
Reported: 2019-02-20 10:41 UTC by Tom de Vries
Modified: 2019-02-20 10:41 UTC (History)
1 user (show)

See Also:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description Tom de Vries 2019-02-20 10:41:09 UTC
[ Filed earlier as dwz PR24249 - "Section offsets not monotonically increasing". ]

When using the gold linker to generate the .gdb_index section:
$ gcc hello.c -g -fuse-ld=gold -Wl,--gdb-index

and inspecting the section offsets around .gdb_index:
$ readelf -S a.out | grep '[[]' | egrep -C1  'Offset|\.gdb_index'
  [Nr] Name              Type             Address           Offset
  [ 0]                   NULL             0000000000000000  00000000
  [31] .debug_str        PROGBITS         0000000000000000  00001b2f
  [32] .gdb_index        PROGBITS         0000000000000000  000034b0
  [33] .debug_ranges     PROGBITS         0000000000000000  000021f0
we see that the offsets are not monotonically increasing.

The property that the file offsets of the entries in the section header table are in a monotonically increasing order, is not a requirement of the ELF standard, but it is expected by a variety of other tools which process ELF binaries.