[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/23900] New: Can't detect GNU program property generated by older
From: |
hjl.tools at gmail dot com |
Subject: |
[Bug ld/23900] New: Can't detect GNU program property generated by older linkers |
Date: |
Tue, 20 Nov 2018 14:19:16 +0000 |
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:
address@hidden 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
address@hidden tmp]$ gcc -c x.S -Wa,-mx86-used-note=no
address@hidden tmp]$ ld -o x x.o
address@hidden tmp]$ cat y.s
.text
.globl _start
_start:
movaps %xmm0, %xmm1
address@hidden tmp]$ gcc -c y.s -Wa,-mx86-used-note=yes
address@hidden tmp]$ ld -o y y.o
address@hidden 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
address@hidden 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
address@hidden 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.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug ld/23900] New: Can't detect GNU program property generated by older linkers,
hjl.tools at gmail dot com <=