https://sourceware.org/bugzilla/show_bug.cgi?id=23900
Bug ID: 23900 Summary: Can't detect GNU program property generated by older linkers 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: --- Linkers group input note sections with the same name into one output note section with the same name. One output note section is placed in one PT_NOTE segment. Since new linkers merge input .note.gnu.property sections into one output .note.gnu.property section, there is only one NT_GNU_PROPERTY_TYPE_0 note in one PT_NOTE segment with new linkers. Since older linkers treat input .note.gnu.property section as a generic note section and just concatenate all input .note.gnu.property sections into one output .note.gnu.property section without merging them, we may see invalid NT_GNU_PROPERTY_TYPE_0 note in PT_NOTE segment: [hjl@gnu-4 tmp]$ cat x.S #ifdef __LP64__ # define ALIGN 3 #else # define ALIGN 2 #endif .section ".note", "a" .p2align ALIGN .long 1f - 0f /* name length. */ .long 3f - 1f /* data length. */ /* NT_GNU_PROPERTY_TYPE_0 */ .long 5 /* note type. */ 0: .asciz "GNU" /* vendor name. */ 1: .p2align ALIGN /* GNU_PROPERTY_X86_ISA_1_USED */ .long 0xc0010000 /* pr_type. */ .long 5f - 4f /* pr_datasz. */ 4: .long 0x80000002 5: .p2align ALIGN /* GNU_PROPERTY_X86_FEATURE_2_USED */ .long 0xc0010001 /* pr_type. */ .long 5f - 4f /* pr_datasz. */ 4: .long 0x9 5: .p2align ALIGN 3: .text .globl _start _start: ret [hjl@gnu-4 tmp]$ gcc -c x.S -Wa,-mx86-used-note=no [hjl@gnu-4 tmp]$ ld -o x x.o [hjl@gnu-4 tmp]$ cat y.s .text .globl _start _start: movaps %xmm0, %xmm1 [hjl@gnu-4 tmp]$ gcc -c y.s -Wa,-mx86-used-note=yes [hjl@gnu-4 tmp]$ ld -o y y.o [hjl@gnu-4 tmp]$ readelf -n x Displaying notes found in: .note Owner Data size Description GNU 0x00000020 NT_GNU_PROPERTY_TYPE_0 Properties: x86 ISA used: SSE Invalid x86 feature used: x86, XMM [hjl@gnu-4 tmp]$ readelf -n y Displaying notes found in: .note.gnu.property Owner Data size Description GNU 0x00000020 NT_GNU_PROPERTY_TYPE_0 Properties: x86 ISA used: SSE x86 feature used: x86, XMM [hjl@gnu-4 tmp]$ 'x' has invalid NT_GNU_PROPERTY_TYPE_0 note. But GNU_PROPERTY_X86_ISA_1_USED has the GNU_PROPERTY_X86_UINT32_VALID bit set, which can also be set by -mx86-used-note=yes. We need a way to mark NT_GNU_PROPERTY_TYPE_0 note in PT_NOTE segment is valid. -- 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