https://sourceware.org/bugzilla/show_bug.cgi?id=23535
--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
A testcase:
[hjl@gnu-17 tmp]$ cat x.S
.text
.globl _start
.type _start, @function
_start:
ret
.section ".note", "a"
#ifdef __LP64__
.p2align 3
#else
.p2align 2
#endif
.long 1f - 0f /* name length. */
.long 3f - 1f /* data length. */
.long 12345 /* note type. */
0:
.asciz "GNU" /* vendor name. */
1:
#ifdef __LP64__
.p2align 3
#else
.p2align 2
#endif
.long 0 /* pr_type. */
.long 5f - 4f /* pr_datasz. */
4:
.zero 0x10
5:
#ifdef __LP64__
.p2align 3
#else
.p2align 2
#endif
3:
[hjl@gnu-17 tmp]$ gcc -c x.S -B/bin/
[hjl@gnu-17 tmp]$ ld.gold --build-id x.o
[hjl@gnu-17 tmp]$ readelf -SlW a.out | grep NOTE
[ 1] .note NOTE 00000000004000e8 0000e8 000028 00 A
0 0 8
[ 2] .note.gnu.build-id NOTE 0000000000400110 000110 000024 00 A
0 0 4
[ 6] .note.gnu.gold-version NOTE 0000000000000000 001000 00001c 00
0 0 4
NOTE 0x0000e8 0x00000000004000e8 0x00000000004000e8 0x00004c
0x00004c R 0x8
It is wrong to place note sections with 4 byte alignment in a NOTE segment
with 8 byte alignment.
[hjl@gnu-17 tmp]$ ld.bfd --build-id x.o
[hjl@gnu-17 tmp]$ readelf -SlW a.out | grep NOTE
[ 1] .note NOTE 0000000000400120 000120 000028 00 A
0 0 8
[ 2] .note.gnu.build-id NOTE 0000000000400148 000148 000024 00 A
0 0 4
NOTE 0x000120 0x0000000000400120 0x0000000000400120 0x000028
0x000028 R 0x8
NOTE 0x000148 0x0000000000400148 0x0000000000400148 0x000024
0x000024 R 0x4
[hjl@gnu-17 tmp]$
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-binutils