bash-3.2$ cat note-2.s .globl _entry .text _entry: .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 .section .foo,"awx",%progbits .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 .section .note,"",%note .byte 0 bash-3.2$ cat note-2.t ENTRY(_entry) PHDRS { data PT_LOAD; note PT_NOTE; } SECTIONS { . = 0x1000000; .text : { *(.text) } :data .foo : { *(.foo) } :data . = 0x2000000; .note : { *(.note) } :note /DISCARD/ : { *(*) } } bash-3.2$ make cc -c note-2.s ./ld -Tnote-2.t -o note-2 note-2.o ./strip -R .foo note-2 -o note-2.strip readelf -Sl note-2 There are 7 section headers, starting at offset 0x200050:
Section Headers: [Nr] Name Type Address Offset Size EntSize Flags Link Info Align [ 0] NULL 0000000000000000 00000000 0000000000000000 0000000000000000 0 0 0 [ 1] .text PROGBITS 0000000001000000 00200000 0000000000000010 0000000000000000 AX 0 0 4 [ 2] .foo PROGBITS 0000000001000010 00200010 0000000000000010 0000000000000000 WAX 0 0 1 [ 3] .note NOTE 0000000002000000 00200020 0000000000000001 0000000000000000 0 0 1 [ 4] .shstrtab STRTAB 0000000000000000 00200021 000000000000002c 0000000000000000 0 0 1 [ 5] .symtab SYMTAB 0000000000000000 00200210 0000000000000078 0000000000000018 6 4 8 [ 6] .strtab STRTAB 0000000000000000 00200288 0000000000000008 0000000000000000 0 0 1 Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings) I (info), L (link order), G (group), x (unknown) O (extra OS processing required) o (OS specific), p (processor specific) Elf file type is EXEC (Executable file) Entry point 0x1000000 There are 2 program headers, starting at offset 64 Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flags Align LOAD 0x0000000000200000 0x0000000001000000 0x0000000001000000 0x0000000000000020 0x0000000000000020 RWE 200000 NOTE 0x0000000000200020 0x0000000002000000 0x0000000002000000 0x0000000000000001 0x0000000000000000 R 1 Section to Segment mapping: Segment Sections... 00 .text .foo 01 .note readelf -Sl note-2.strip There are 4 section headers, starting at offset 0x200028: Section Headers: [Nr] Name Type Address Offset Size EntSize Flags Link Info Align [ 0] NULL 0000000000000000 00000000 0000000000000000 0000000000000000 0 0 0 [ 1] .text PROGBITS 0000000001000000 00200000 0000000000000010 0000000000000000 AX 0 0 4 [ 2] .note NOTE 0000000002000000 00200010 0000000000000001 0000000000000000 0 0 1 [ 3] .shstrtab STRTAB 0000000000000000 00200011 0000000000000017 0000000000000000 0 0 1 Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings) I (info), L (link order), G (group), x (unknown) O (extra OS processing required) o (OS specific), p (processor specific) Elf file type is EXEC (Executable file) Entry point 0x1000000 There are 2 program headers, starting at offset 64 Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flags Align LOAD 0x0000000000200000 0x0000000001000000 0x0000000001000000 0x0000000000000010 0x0000000000000010 RWE 200000 NOTE 0x0000000000000000 0x0000000000000000 0x0000000002000000 0x0000000000000000 0x0000000000000000 R 8 Section to Segment mapping: Segment Sections... 00 .text 01 bash-3.2$ As you can see, PT_NOTE segment becomes empty after strip. -- Summary: strip doesn't handle PT_NOTE segment properly Product: binutils Version: 2.19 (HEAD) Status: NEW Severity: normal Priority: P2 Component: binutils AssignedTo: unassigned at sources dot redhat dot com ReportedBy: hjl at lucon dot org CC: bug-binutils at gnu dot org http://sourceware.org/bugzilla/show_bug.cgi?id=5488 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils