bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/23658] New: Improve PT_NOTE segment creation


From: hjl.tools at gmail dot com
Subject: [Bug ld/23658] New: Improve PT_NOTE segment creation
Date: Fri, 14 Sep 2018 15:20:59 +0000

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: ---

address@hidden 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:
address@hidden 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:
address@hidden 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:
address@hidden 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 
address@hidden 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.


reply via email to

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