https://sourceware.org/bugzilla/show_bug.cgi?id=23658
Bug ID: 23658 Summary: Improve PT_NOTE segment creation Product: binutils Version: 2.32 (HEAD) Status: NEW Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: hjl.tools at gmail dot com Target Milestone: --- [hjl@gnu-cfl-1 note]$ cat x.s .text .globl _start .type _start, @function _start: ret .section ".note.1", "a" .p2align 3 .long 1f - 0f /* name length. */ .long 3f - 1f /* data length. */ .long 12345 /* note type. */ 0: .asciz "GNU" /* vendor name. */ 1: .p2align 3 .long 0 /* pr_type. */ .long 5f - 4f /* pr_datasz. */ 4: .zero 0x10 5: .p2align 3 3: [hjl@gnu-cfl-1 note]$ cat y.s .section ".note.2", "a" .p2align 2 .long 1f - 0f /* name length. */ .long 3f - 1f /* data length. */ .long 12345 /* note type. */ 0: .asciz "GNU" /* vendor name. */ 1: .p2align 2 .long 0 /* pr_type. */ .long 5f - 4f /* pr_datasz. */ 4: .zero 0x10 5: .p2align 2 3: [hjl@gnu-cfl-1 note]$ cat z.s .section ".note.3", "a" .p2align 2 .long 1f - 0f /* name length. */ .long 3f - 1f /* data length. */ .long 12345 /* note type. */ 0: .asciz "GNU" /* vendor name. */ 1: .p2align 2 .long 0 /* pr_type. */ .long 5f - 4f /* pr_datasz. */ 4: .zero 0x10 5: .p2align 2 3: [hjl@gnu-cfl-1 note]$ make as -mx86-used-note=yes -o y.o y.s as -mx86-used-note=yes -o x.o x.s as -mx86-used-note=yes -o z.o z.s ./ld -z noseparate-code --build-id -o x y.o x.o z.o readelf -lW x Elf file type is EXEC (Executable file) Entry point 0x400224 There are 5 program headers, starting at offset 64 Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align LOAD 0x000000 0x0000000000400000 0x0000000000400000 0x000225 0x000225 R E 0x1000 NOTE 0x000158 0x0000000000400158 0x0000000000400158 0x000028 0x000028 R 0x4 NOTE 0x000180 0x0000000000400180 0x0000000000400180 0x000030 0x000030 R 0x8 NOTE 0x0001b0 0x00000000004001b0 0x00000000004001b0 0x000028 0x000028 R 0x8 NOTE 0x0001d8 0x00000000004001d8 0x00000000004001d8 0x00004c 0x00004c R 0x4 Section to Segment mapping: Segment Sections... 00 .note.2 .note.gnu.property .note.1 .note.3 .note.gnu.build-id .text 01 .note.2 02 .note.gnu.property 03 .note.1 04 .note.3 .note.gnu.build-id [hjl@gnu-cfl-1 note]$ We can create just 2 PT_NOTE segments, instead of 4. -- 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