[Bug ld/23658] Improve PT_NOTE segment creation

2018-10-04 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=23658

--- Comment #5 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by H.J. Lu :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b35334aa98b75e4e166d30d673fd3bf1238dc7b7

commit b35334aa98b75e4e166d30d673fd3bf1238dc7b7
Author: H.J. Lu 
Date:   Thu Oct 4 12:06:33 2018 -0700

pr23658-1.d: Also xfail ft32-* and xgate-*

Since ft32-* and xgate-* use generic linker, SHT_NOTE sections aren't
grouped nor sorted.

PR ld/23658
* testsuite/ld-elf/pr23658-1.d: Also xfail ft32-* and xgate-*.

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


[Bug ld/23658] Improve PT_NOTE segment creation

2018-10-04 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=23658

H.J. Lu  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |---

--- Comment #6 from H.J. Lu  ---
It isn't right for -shared:

/export/build/gnu/binutils/build-x86_64-linux/ld/../gas/as-new  --defsym
ALIGN=3 -mx86-used-note=no   -o tmpdir/pr23658-1a.o
/export/gnu/import/git/sources/binutils-gdb/ld/testsuite/ld-elf/pr23658-1a.s
/export/build/gnu/binutils/build-x86_64-linux/ld/../gas/as-new  --defsym
ALIGN=3 -mx86-used-note=no   -o tmpdir/pr23658-1b.o
/export/gnu/import/git/sources/binutils-gdb/ld/testsuite/ld-elf/pr23658-1b.s
/export/build/gnu/binutils/build-x86_64-linux/ld/../gas/as-new  --defsym
ALIGN=3 -mx86-used-note=no   -o tmpdir/pr23658-1c.o
/export/gnu/import/git/sources/binutils-gdb/ld/testsuite/ld-elf/pr23658-1c.s
/export/build/gnu/binutils/build-x86_64-linux/ld/../gas/as-new  --defsym
ALIGN=3 -mx86-used-note=no   -o tmpdir/pr23658-1d.o
/export/gnu/import/git/sources/binutils-gdb/ld/testsuite/ld-elf/pr23658-1d.s
/export/build/gnu/binutils/build-x86_64-linux/ld/../gas/as-new  --defsym
ALIGN=3 -mx86-used-note=no   -o tmpdir/start.o
/export/gnu/import/git/sources/binutils-gdb/ld/testsuite/ld-elf/start.s
./ld-new -z norelro 
-L/export/gnu/import/git/sources/binutils-gdb/ld/testsuite/ld-elf  --build-id
-shared -o tmpdir/dump tmpdir/pr23658-1a.o tmpdir/pr23658-1b.o
tmpdir/pr23658-1c.o tmpdir/pr23658-1d.o tmpdir/start.o 
/export/build/gnu/binutils/build-x86_64-linux/ld/../binutils/readelf -S  -l
--wide tmpdir/dump
There are 16 section headers, starting at offset 0x2550:

Section Headers:
  [Nr] Name  TypeAddress  OffSize   ES Flg
Lk Inf Al
  [ 0]   NULL 00 00 00 
0   0  0
  [ 1] .note.4   NOTE2000 002000 28 00   A 
0   0  8
  [ 2] .note.1   NOTE2028 002028 28 00   A 
0   0  8
  [ 3] .note.gnu.build-id NOTE0200 000200 24 00   A
 0   0  4
  [ 4] .note.2   NOTE2050 002050 28 00   A 
0   0  4
  [ 5] .note.3   NOTE2078 002078 28 00   A 
0   0  4
  [ 6] .hash HASH0228 000228 30 04   A 
8   0  8
  [ 7] .gnu.hash GNU_HASH0258 000258 3c 00   A 
8   0  8
  [ 8] .dynsym   DYNSYM  0298 000298 a8 18   A 
9   1  8
  [ 9] .dynstr   STRTAB  0340 000340 13 00   A 
0   0  1
  [10] .text PROGBITS1000 001000 10 00  AX 
0   0  1
  [11] .eh_frame PROGBITS20a0 0020a0 00 00   A 
0   0  8
  [12] .dynamic  DYNAMIC 30a0 0020a0 c0 10  WA 
9   0  8
  [13] .symtab   SYMTAB   002160 0002e8 18
14  25  8
  [14] .strtab   STRTAB   002448 81 00 
0   0  1
  [15] .shstrtab STRTAB   0024c9 81 00 
0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
  L (link order), O (extra OS processing required), G (group), T (TLS),
  C (compressed), x (unknown), o (OS specific), E (exclude),
  l (large), p (processor specific)

Elf file type is DYN (Shared object file)
Entry point 0x1008
There are 8 program headers, starting at offset 64

Program Headers:
  Type   Offset   VirtAddr   PhysAddr   FileSiz  MemSiz
  Flg Align
  LOAD   0x00 0x 0x 0x000353
0x000353 R   0x1000
  LOAD   0x001000 0x1000 0x1000 0x10
0x10 R E 0x1000
  LOAD   0x002000 0x2000 0x2000 0xa0
0xa0 R   0x1000
  LOAD   0x0020a0 0x30a0 0x30a0 0xc0
0xc0 RW  0x1000
  DYNAMIC0x0020a0 0x30a0 0x30a0 0xc0
0xc0 RW  0x8
  NOTE   0x002000 0x2000 0x2000 0x50
0x50 R   0x8
  NOTE   0x000200 0x0200 0x0200 0x24
0x24 R   0x4
  NOTE   0x002050 0x2050 0x2050 0x50
0x50 R   0x4

 Section to Segment mapping:
  Segment Sections...
   00 .note.gnu.build-id .hash .gnu.hash .dynsym .dynstr 
   01 .text 
   02 .note.4 .note.1 .note.2 .note.3 
   03 .dynamic 
   04 .dynamic 
   05 .note.4 .note.1 
   06 .note.gnu.build-id 
   07 .note.2 .note.3

-- 
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 ld/23658] Improve PT_NOTE segment creation

2018-10-04 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=23658

--- Comment #7 from H.J. Lu  ---
gld${EMULATION_NAME}_place_orphan has

  else if ((flags & SEC_LOAD) != 0 
   && ((elfinput && sh_type == SHT_NOTE)
   || (!elfinput && CONST_STRNEQ (secname, ".note"
place = &hold[orphan_interp];

linker script for -shared has

SECTIONS
{
  /* Read-only sections, merged into text segment: */
  . = SEGMENT_START("text-segment", 0) + SIZEOF_HEADERS;
  .note.gnu.build-id : { *(.note.gnu.build-id) }
  .hash   : { *(.hash) }
  .gnu.hash   : { *(.gnu.hash) }

There is no way to place a note section before .note.gnu.build-id in
output statements since lang_insert_orphan can only insert an output
statement after another output statement, not before another output
statement.

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