https://sourceware.org/bugzilla/show_bug.cgi?id=21191
Bug ID: 21191 Summary: objcopy --only-keep-debug creates non-monotonically increasing section offsets Product: binutils Version: 2.29 (HEAD) Status: NEW Severity: normal Priority: P2 Component: binutils Assignee: unassigned at sourceware dot org Reporter: rguenth at gcc dot gnu.org Target Milestone: --- int main() { } > gcc t.c -g > objcopy --only-keep-debug a.out a.out.debug > readelf -S a.out There are 39 section headers, starting at offset 0x2788: Section Headers: [Nr] Name Type Address Offset Size EntSize Flags Link Info Align [ 0] NULL 0000000000000000 00000000 0000000000000000 0000000000000000 0 0 0 [ 1] .interp PROGBITS 0000000000400238 00000238 000000000000001c 0000000000000000 A 0 0 1 [ 2] .note.ABI-tag NOTE 0000000000400254 00000254 0000000000000020 0000000000000000 A 0 0 4 [ 3] .note.gnu.build-i NOTE 0000000000400274 00000274 0000000000000024 0000000000000000 A 0 0 4 [ 4] .hash HASH 0000000000400298 00000298 0000000000000018 0000000000000004 A 6 0 8 [ 5] .gnu.hash GNU_HASH 00000000004002b0 000002b0 000000000000001c 0000000000000000 A 6 0 8 [ 6] .dynsym DYNSYM 00000000004002d0 000002d0 ... [25] .got.plt PROGBITS 0000000000601000 00001000 0000000000000020 0000000000000008 WA 0 0 8 [26] .data PROGBITS 0000000000601020 00001020 0000000000000010 0000000000000000 WA 0 0 8 [27] .bss NOBITS 0000000000601030 00001030 0000000000000008 0000000000000000 WA 0 0 1 [28] .comment PROGBITS 0000000000000000 00001030 0000000000000018 0000000000000001 MS 0 0 1 [29] .debug_aranges PROGBITS 0000000000000000 00001050 0000000000000130 0000000000000000 0 0 16 [30] .debug_info PROGBITS 0000000000000000 00001180 000000000000036d 0000000000000000 0 0 1 > readelf -S a.out.debug There are 39 section headers, starting at offset 0x19e8: Section Headers: [Nr] Name Type Address Offset Size EntSize Flags Link Info Align [ 0] NULL 0000000000000000 00000000 0000000000000000 0000000000000000 0 0 0 [ 1] .interp NOBITS 0000000000400238 00000238 000000000000001c 0000000000000000 A 0 0 1 [ 2] .note.ABI-tag NOTE 0000000000400254 00000254 0000000000000020 0000000000000000 A 0 0 4 [ 3] .note.gnu.build-i NOTE 0000000000400274 00000274 0000000000000024 0000000000000000 A 0 0 4 [ 4] .hash NOBITS 0000000000400298 00000298 0000000000000018 0000000000000004 A 6 0 8 [ 5] .gnu.hash NOBITS 00000000004002b0 00000298 000000000000001c 0000000000000000 A 6 0 8 [ 6] .dynsym NOBITS 00000000004002d0 00000298 ... [25] .got.plt NOBITS 0000000000601000 00000e00 0000000000000020 0000000000000008 WA 0 0 8 [26] .data NOBITS 0000000000601020 00000e00 0000000000000010 0000000000000000 WA 0 0 8 [27] .bss NOBITS 0000000000601030 00000e00 0000000000000008 0000000000000000 WA 0 0 1 [28] .comment PROGBITS 0000000000000000 00000298 0000000000000018 0000000000000001 MS 0 0 1 [29] .debug_aranges PROGBITS 0000000000000000 000002b0 0000000000000130 0000000000000000 0 0 16 [30] .debug_info PROGBITS 0000000000000000 000003e0 000000000000036d 0000000000000000 0 0 1 notice how section 28 and 29 start before section 27. eu-strip gets this correct. checked 2.27 and git HEAD. -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils