[Bug gold/22694] [2.30 Regression] -fuse-ld=gold not recognized

2018-01-11 Thread doko at debian dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=22694

--- Comment #4 from Matthias Klose  ---
hmm, I'm wondering why I only see that with binutils trunk on powerpc64le...

-- 
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 gold/22694] [2.30 Regression] -fuse-ld=gold not recognized

2018-01-11 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22694

--- Comment #5 from Alan Modra  ---
Possibly something to do with your build environment for powerpc64le.  Check
whether collect2 is being run.

-- 
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/22696] Wrong order of SHLIB_RODATA_ADDR in elf.sc?

2018-01-11 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=22696

--- Comment #2 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=6bd0a312a4cb6803b9d6aa2f5646b610d213a1fe

commit 6bd0a312a4cb6803b9d6aa2f5646b610d213a1fe
Author: H.J. Lu 
Date:   Thu Jan 11 05:05:25 2018 -0800

Fix the order of SHLIB_RODATA_ADDR in elf.sc

elf.sc has

  if test -n "${RODATA_ADDR}"; then
RODATA_ADDR="\
SEGMENT_START(\"rodata-segment\", ${RODATA_ADDR}) + SIZEOF_HEADERS"
  else
RODATA_ADDR="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))"
^^ Set RODATA_ADDR
RODATA_ADDR="SEGMENT_START(\"rodata-segment\", ${RODATA_ADDR})"
^^ Set RODATA_ADDR with ${RODATA_ADDR}
  fi
  if test -n "${SHLIB_RODATA_ADDR}"; then
SHLIB_RODATA_ADDR="\
SEGMENT_START(\"rodata-segment\", ${SHLIB_RODATA_ADDR}) + SIZEOF_HEADERS"
  else
SHLIB_RODATA_ADDR="SEGMENT_START(\"rodata-segment\",
${SHLIB_RODATA_ADDR})"
^^ Set SHLIB_RODATA_ADDR
SHLIB_RODATA_ADDR="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))"
^^ Override SHLIB_RODATA_ADDR
  fi

The order should be:

  if test -n "${SHLIB_RODATA_ADDR}"; then
SHLIB_RODATA_ADDR="\
SEGMENT_START(\"rodata-segment\", ${SHLIB_RODATA_ADDR}) + SIZEOF_HEADERS"
  else
SHLIB_RODATA_ADDR="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))"
SHLIB_RODATA_ADDR="SEGMENT_START(\"rodata-segment\",
${SHLIB_RODATA_ADDR})"
  fi

PR ld/22696
* scripttempl/elf.sc: Fix the order of SHLIB_RODATA_ADDR.

-- 
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/22696] Wrong order of SHLIB_RODATA_ADDR in elf.sc?

2018-01-11 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22696

H.J. Lu  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |2.30

--- Comment #3 from H.J. Lu  ---
Fixed for 2.30.

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


readelf: displaying dynamic section of a 64-bit ELF

2018-01-11 Thread Barath Aron

Hello,

I just discovered a display issue in readelf, which affects only 64-bit 
ELFs. I was about to check info in the dynamic section, and I saw the 
header line is a bit off. In the source code I found the answer: it was 
hard-coded for 32-bit ELFs. So here is my patch -- perhaps not perfect, 
but solves the issue.


Aron

>From 5afd89acf252e796f34538d8a71622652ae2b90d Mon Sep 17 00:00:00 2001
From: Aron Barath 
Date: Thu, 11 Jan 2018 09:26:27 +0100
Subject: [PATCH] display of the Dynamic section of 64-bit ELFs was a bit off

---
 binutils/readelf.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/binutils/readelf.c b/binutils/readelf.c
index ae1cda9a7b..ea5151f84f 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -9728,7 +9728,12 @@ process_dynamic_section (Filedata * filedata)
 		  dynamic_nent),
 	dynamic_addr, (unsigned long) dynamic_nent);
   if (do_dynamic)
-printf (_("  TagType Name/Value\n"));
+{
+  if (is_32bit_elf)
+printf (_("  TagType Name/Value\n"));
+  else
+printf (_("  TagType Name/Value\n"));
+}
 
   for (entry = dynamic_section;
entry < dynamic_section + dynamic_nent;
-- 
2.15.1

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/22677] ld -r --gc-section does not KEEP .init_array/.fini_array

2018-01-11 Thread nickc at redhat dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22677

--- Comment #4 from Nick Clifton  ---
Created attachment 10728
  --> https://sourceware.org/bugzilla/attachment.cgi?id=10728&action=edit
Proposed patch

Hi David,

  Sorry - I missed the "-r" option in your initial bug report.

  This does pose an interesting problem however as your linker script 
  fragment is only a partial solution.  The .init_array and .fini_array 
  sections can have a priority value as a suffix to their name, and this 
  suffix must be preserved when linking with -r.  (See 
  ld/testsuite/ld-elf/init-fini-arrays.[sd] for an example of this). Hence 
  using:

 .init_array { KEEP (.init_array.*) }

  will not work as it looses the section suffixes.  So instead I am proposing
  the attached patch which adds a special case for init and fini arrays to 
  the garbage collection code in the BFD library.  Please could you try it
  out and let me know if it works for you.

Cheers
  Nick

-- 
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/22677] ld -r --gc-section does not KEEP .init_array/.fini_array

2018-01-11 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=22677

--- 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=8b6f4cd34fdde524ea035c65f7d48aaa3fb449b5

commit 8b6f4cd34fdde524ea035c65f7d48aaa3fb449b5
Author: H.J. Lu 
Date:   Thu Jan 11 09:42:12 2018 -0800

ld: Keep PREINIT_ARRAY/INIT_ARRAY/FINI_ARRAY sections for -r --gc-sections

We must keep all PREINIT_ARRAY, INIT_ARRAY as well as FINI_ARRAY sections
for ld -r --gc-sections.

bfd/

PR ld/22677
* elflink.c (bfd_elf_gc_sections): Keep all PREINIT_ARRAY,
INIT_ARRAY as well as FINI_ARRAY sections for ld -r --gc-sections.

ld/

PR ld/22677
* scripttempl/elf.sc (PREINIT_ARRAY): New.
Don't add .preinit_array for ld -r.
* testsuite/ld-elf/pr22677.d: New file.
* testsuite/ld-elf/pr22677.s: Likewise.

-- 
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/22677] ld -r --gc-section does not KEEP .init_array/.fini_array

2018-01-11 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22677

H.J. Lu  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
Version|unspecified |2.30 (HEAD)
 Resolution|--- |FIXED
   Target Milestone|--- |2.30

--- Comment #6 from H.J. Lu  ---
Fixed for 2.30.

-- 
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/22649] -gc-sections preserves hidden symbols that are also visible in dynamic objects

2018-01-11 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22649

H.J. Lu  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |2.30

--- Comment #1 from H.J. Lu  ---
Fixed.

-- 
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/22649] -gc-sections preserves hidden symbols that are also visible in dynamic objects

2018-01-11 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=22649

--- Comment #2 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=d664fd41e15f058aab41b70c567ad09f2fab1115

commit d664fd41e15f058aab41b70c567ad09f2fab1115
Author: H.J. Lu 
Date:   Thu Jan 11 15:36:40 2018 -0800

Ignore dynamic references on forced local symbols

We should ignore dynamic references on forced local symbols during
garbage collection since they can never be referenced dynamically.

bfd/

PR ld/22649
* elflink.c (bfd_elf_gc_mark_dynamic_ref_symbol): Ignore dynamic
references on forced local symbols.

ld/

PR ld/22649
* testsuite/ld-elf/pr22649-1.s: New file.
* testsuite/ld-elf/pr22649-2a.s: Likewise.
* testsuite/ld-elf/pr22649-2b.s: Likewise.
* testsuite/ld-elf/pr22649.msg: Likewise.
* testsuite/ld-elf/shared.exp: Run ld/22649 tests.

-- 
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/22677] ld -r --gc-section does not KEEP .init_array/.fini_array

2018-01-11 Thread d+sourcew...@adaptive-enterprises.com
https://sourceware.org/bugzilla/show_bug.cgi?id=22677

--- Comment #7 from David Leonard  ---
> Please could you try it out and let me know if it works for you.
Confirmed. My tests pass without workaround. I used current master ld
(89a7f793f1). Thanks!

-- 
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/13391] .rofixup section size mismatch

2018-01-11 Thread wbx at openadk dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=13391

--- Comment #18 from wbx at openadk dot org ---
Hi Nick,
A link to all files is okay?
https://debug.openadk.org/bfin/

best regards
 Waldemar

-- 
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/22393] Add read-only segment

2018-01-11 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=22393

--- Comment #1 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=47acac12c83f173481debc64618626b50ecf7498

commit 47acac12c83f173481debc64618626b50ecf7498
Author: H.J. Lu 
Date:   Thu Jan 11 19:01:39 2018 -0800

ld: Add "-z separate-code" option to ELF linker

The new "-z separate-code" option will generate separate code LOAD
segment which must be in wholly disjoint pages from any other data.

include/

PR ld/22393
* bfdlink.h (bfd_link_info): Add separate_code.

ld/

PR ld/22393
* NEWS: Mention "-z separate-code".
* emultempl/elf32.em (gld${EMULATION_NAME}_get_script): Get
builtin linker scripts and return linker scripts from disk for
"-z separate-code".
(gld${EMULATION_NAME}_handle_option): Handle "-z separate-code"
and "-z noseparate-code".
* genscripts.sh: Generate linker scripts for "-z separate-code".
(LD_FLAG): Set to *textonly for "-z separate-code".
* ld.texinfo: Document "-z separate-code".
* lexsup.c (elf_shlib_list_options): Add linker help messsages
for "-z separate-code" and "-z noseparate-code".
* scripttempl/elf.sc (SEPARATE_TEXT): New
(TEXT_SEGMENT_ALIGN): Likewise.
Use ${TEXT_SEGMENT_ALIGN} to align and pad text segment to
${MAXPAGESIZE}.

-- 
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/22393] Add read-only segment

2018-01-11 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=22393

--- Comment #2 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=2888249fc9eb38b6d6e4bd969ce63c26e3753d5e

commit 2888249fc9eb38b6d6e4bd969ce63c26e3753d5e
Author: H.J. Lu 
Date:   Thu Jan 11 19:04:55 2018 -0800

ld: Create a new LOAD segment for separate code segment

When generating separate code LOAD segment, create a new LOAD segment
if the previous section contains text and the current section doesn't
or vice versa:

Elf file type is DYN (Shared object file)
Entry point 0x200020
There are 7 program headers, starting at offset 52

Program Headers:
  Type   Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD   0x00 0x 0x 0x00200 0x00200 R  
0x20
  LOAD   0x20 0x0020 0x0020 0x00036 0x00036 R E
0x20
  LOAD   0x40 0x0040 0x0040 0x00064 0x00064 R  
0x20
  LOAD   0x400f80 0x00600f80 0x00600f80 0x000a0 0x000a0 RW 
0x20
  DYNAMIC0x400f80 0x00600f80 0x00600f80 0x00080 0x00080 RW  0x4
  GNU_STACK  0x00 0x 0x 0x0 0x0 RW  0x10
  GNU_RELRO  0x400f80 0x00600f80 0x00600f80 0x00080 0x00080 R   0x1

 Section to Segment mapping:
  Segment Sections...
   00 .hash .gnu.hash .dynsym .dynstr .rela.plt
   01 .plt .text
   02 .rodata .eh_frame
   03 .dynamic .got.plt
   04 .dynamic
   05
   06 .dynamic

to prevent fetching or executing data in code pages as instructions.

Also don't put a writable section in a read-only segment if there is a
RELRO segment.

Since code segment is aligned and padded to the maximum page size on
disk, the minimum file size is bigger than the maximum page size which
is 2MB (0x20):

-rwxr-xr-x 1 hjl hjl 4201932 Jan 10 10:41 libfoo.so

"-z max-page-size=0x1000" can be used to reduce the maximum page size to
4KB (0x1000):

-rwxr-xr-x 1 hjl hjl   15820 Jan 10 10:44 libfoo.so

PR ld/22393
* elf.c (_bfd_elf_map_sections_to_segments): When generating
separate code and read-only data LOAD segments, create a new
LOAD segment if the previous section contains text and the
current section doesn't or vice versa.  Don't put a writable
section in a read-only segment if there is a RELRO segment.

-- 
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/22393] Add read-only segment

2018-01-11 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=22393

--- Comment #3 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=d346bb277c7f194ece73a7200d1ed6417b1194e5

commit d346bb277c7f194ece73a7200d1ed6417b1194e5
Author: H.J. Lu 
Date:   Thu Jan 11 19:17:46 2018 -0800

ld: Add tests for -z separate-code and -z noseparate-code

Verify that -z separate-code works and -z noseparate-code doesn't disable
-z relro.

PR ld/22393
* testsuite/ld-elf/pr16322.d: Add -z noseparate-code.
* testsuite/ld-elf/pr22393-1.s: New file.
* testsuite/ld-elf/pr22393-1a.d: Likewise.
* testsuite/ld-elf/pr22393-1b.d: Likewise.
* testsuite/ld-elf/pr22393-1c.d: Likewise.
* testsuite/ld-elf/pr22393-1d.d: Likewise.
* testsuite/ld-elf/pr22393-1e.d: Likewise.
* testsuite/ld-elf/pr22393-1f.d: Likewise.
* testsuite/ld-elf/pr22393-2a.c: Likewise.
* testsuite/ld-elf/pr22393-2a.rd: Likewise.
* testsuite/ld-elf/pr22393-2b.c: Likewise.
* testsuite/ld-elf/pr22393-2b.rd: Likewise.
* testsuite/ld-elf/shared.exp: Run tests for -z separate-code.

-- 
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/22393] Add read-only segment

2018-01-11 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=22393

--- Comment #4 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=cf9e7f1f07efa2ce6846d8a29015dd8fb70197b0

commit cf9e7f1f07efa2ce6846d8a29015dd8fb70197b0
Author: H.J. Lu 
Date:   Thu Jan 11 19:19:22 2018 -0800

x86-64: Add tests for -z separate-code -z max-page-size=0x1000

PR ld/22393
* testsuite/ld-x86-64/pr22393-3a.c: New file.
* testsuite/ld-x86-64/pr22393-3a.rd: Likewise.
* testsuite/ld-x86-64/pr22393-3b.c: Likewise.
* testsuite/ld-x86-64/pr22393-3b.rd: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run tests for -z separate-code
-z max-page-size=0x1000.

-- 
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/22393] Add read-only segment

2018-01-11 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22393

H.J. Lu  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |2.30

--- Comment #5 from H.J. Lu  ---
Fixed for 2.30.

-- 
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 gas/22553] .largecomm, .lbss, .ldata, and .lrodata are still not documented after many, many years

2018-01-11 Thread john at buu dot ac.th
https://sourceware.org/bugzilla/show_bug.cgi?id=22553

--- Comment #7 from john at buu dot ac.th ---
Nick Clifton,

Thank you.  I am sorry I mixed in the section names with the directives.  

I suspect the section name thing uses unwritten or perhaps Red Hat in-house
non-public rules, and I just need to compile things to assembly with each new
version of the compiler toolchain to learn what to use, and I know how to do
that.  Convincing others to follow the unwritten rules will be hard, but at
least now .largecomm exists and that's definitely a positive step and quite
helpful.

Thanks again!  JGH

__
From: nickc at redhat dot com [sourceware-bugzi...@sourceware.org]
Sent: Monday, January 8, 2018 4:41 PM
To: John Gatewood Ham
Subject: [Bug gas/22553] .largecomm, .lbss, .ldata, and .lrodata are still not
documented after many, many years

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

--- Comment #6 from Nick Clifton  ---
Hi John,

  I have checked in the patch to document the .largecomm directive.

  I do not think that .ldata, .lbss or .lrodata exists as assembler
  directives, so I do not plan on documenting these unless you can
  demonstrate a way to reproduce them.

  A scan of the x86 assembler sources indicates that there are still
  some other undocumented directives however: .code16gcc, .secrel32,
  .operand_check, .sse_check, .disallow_index_reg, and .allow_index_reg.

  So I will leave this PR open as a reminder that they ought to be
  documented one day.

Cheers
  Nick

--
You are receiving this mail because:
You reported the bug.

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