bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gold/23535] gold needs to produce two PT_NOTE segments with ELFCLAS


From: hjl.tools at gmail dot com
Subject: [Bug gold/23535] gold needs to produce two PT_NOTE segments with ELFCLASS64
Date: Fri, 17 Aug 2018 14:55:44 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=23535

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
A testcase:

address@hidden 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:
address@hidden tmp]$ gcc -c x.S -B/bin/
address@hidden tmp]$ ld.gold --build-id x.o
address@hidden 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.

address@hidden tmp]$ ld.bfd --build-id x.o
address@hidden 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
address@hidden tmp]$

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]