[Bug gold/21894] New: gdb-index fails to parse debug_ranges base address specifiers in 32 bit address files

2017-08-02 Thread dblaikie at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21894

Bug ID: 21894
   Summary: gdb-index fails to parse debug_ranges base address
specifiers in 32 bit address files
   Product: binutils
   Version: unspecified
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: gold
  Assignee: ccoutant at gmail dot com
  Reporter: dblaikie at gmail dot com
CC: ian at airs dot com
  Target Milestone: ---

LLVM recently gained support for using DWARF debug_range base address
specifiers to reduce relocations.

This broke Chromium builds using gold's gdb-index in a 32 bit build. 

https://bugs.llvm.org/show_bug.cgi?id=34007

Looks like this is a bug in gold's parsing of debug_range. From the last
comment in the above bug:

"Yep, gold bug in parsing 32 bit range lists. The value in the table is read as
32 bit unsigned, widened to long, then compared to -1."

"Here's a dodgy change but at least demonstrates that gold seems to work fine
with this issue addressed:

---
../.citc/baseline/google3/third_party/binutils/binutils/gold/dwarf_reader.cc   
2017-06-22 19:38:27.0 -0700
+++ third_party/binutils/binutils/gold/dwarf_reader.cc  2017-07-31
16:48:58.0 -0700
@@ -442,12 +442,12 @@
 break;

   // A "base address selection entry" is identified by
   // 0x for the first value of the pair.  The second
   // value is used as a base for subsequent range list entries.
-  if (shndx1 == 0 && start == -1)
-   base = end;
+  if (shndx1 == 0 && start == (addr_size == 4 ? 4294967295 : -1))
+base = end;
   else if (shndx1 == shndx2)
{
  if (shndx1 == 0 || object->is_section_included(shndx1))
ranges->add(shndx1, base + start, base + end);
}

A little above in the code the 'start' value is read as an unsigned 4 byte int,
widened into an signed 8 byte int, which doesn't sign extend (since it wasn't
signed)."

-- 
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/21884] [2.29/2.30 Regression] ld segfaulting building memtest86

2017-08-02 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=21884

--- Comment #10 from cvs-commit at gcc dot gnu.org  ---
The binutils-2_29-branch branch has been updated by H.J. Lu
:

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

commit a388b7afeffad6411686d39dc1c62294da48a814
Author: H.J. Lu 
Date:   Wed Aug 2 05:10:29 2017 -0700

Check ELF section header only for ELF output

When placing an orphan input section, check ELF section header only for
ELF output.

PR ld/21884
* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Check
ELF section header only for ELF output.
* testsuite/ld-elf/pr21884.d: New test.
* testsuite/ld-elf/pr21884.t: Likewise.
* testsuite/ld-elf/pr21884a.s: Likewise.
* testsuite/ld-elf/pr21884b.s: Likewise.

(cherry picked from commit db99ecc08f5b66fbe9cb72e90352c7f77ec71a6e)

-- 
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/21884] [2.29/2.30 Regression] ld segfaulting building memtest86

2017-08-02 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=21884

--- Comment #8 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=db99ecc08f5b66fbe9cb72e90352c7f77ec71a6e

commit db99ecc08f5b66fbe9cb72e90352c7f77ec71a6e
Author: H.J. Lu 
Date:   Wed Aug 2 05:10:29 2017 -0700

Check ELF section header only for ELF output

When placing an orphan input section, check ELF section header only for
ELF output.

PR ld/21884
* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Check
ELF section header only for ELF output.
* testsuite/ld-elf/pr21884.d: New test.
* testsuite/ld-elf/pr21884.t: Likewise.
* testsuite/ld-elf/pr21884a.s: Likewise.
* testsuite/ld-elf/pr21884b.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/21884] [2.29/2.30 Regression] ld segfaulting building memtest86

2017-08-02 Thread nickc at redhat dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21884

--- Comment #7 from Nick Clifton  ---
Hi H.J.,

> I prefer a different patch in comment 5, which also includes a testcase.
> There is no need to check ELF section header at all if output isn't ELF.

That makes sense.  I have approved your patch.

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/21884] [2.29/2.30 Regression] ld segfaulting building memtest86

2017-08-02 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21884

--- Comment #6 from H.J. Lu  ---
(In reply to Nick Clifton from comment #4)
> Hi Matthias,
> 
>   Thanks for reporting this problem.  I have checked in a patch to fix the
>   issue - the orphan section placement code was assuming that it was
>   dealing with ELF format sections - and the test now succeeds.
> 
>   H.J. - if you have the time, would you mind converting your testcase 
>   into a new linker testsuite test ?  Thanks.
> 

I prefer a different patch in comment 5, which also includes a testcase.
There is no need to check ELF section header at all if output isn't ELF.

-- 
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/21884] [2.29/2.30 Regression] ld segfaulting building memtest86

2017-08-02 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21884

--- Comment #5 from H.J. Lu  ---
Created attachment 10310
  --> https://sourceware.org/bugzilla/attachment.cgi?id=10310=edit
A patch

-- 
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 binutils/21702] ar cannot handle (slim) LTO object files when in MRI script mode

2017-08-02 Thread spam.martin.schulze at gmx dot de
https://sourceware.org/bugzilla/show_bug.cgi?id=21702

--- Comment #8 from Martin Schulze  ---
I'll keep my eyes open. Thanks for the fast solution.

-- 
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 binutils/21702] ar cannot handle (slim) LTO object files when in MRI script mode

2017-08-02 Thread nickc at redhat dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21702

Nick Clifton  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #7 from Nick Clifton  ---
Hi Martin,

  OK - I have applied the patch.  If more problems like this arise, please feel
free to reopen this PR, or create a new one.

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 binutils/21702] ar cannot handle (slim) LTO object files when in MRI script mode

2017-08-02 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=21702

--- Comment #6 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by Nick Clifton :

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

commit 70b0cf90bc6c071895b989666bcf3e6eca7b99ce
Author: Nick Clifton 
Date:   Wed Aug 2 12:12:37 2017 +0100

Add support for creating archives of slim-LTO modules using MRi script
commands.

PR 21702
* arsup.c (ar_addmod): Add plugin support for the MRI ADDMOD
command.

-- 
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/21884] [2.29/2.30 Regression] ld segfaulting building memtest86

2017-08-02 Thread nickc at redhat dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21884

Nick Clifton  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||nickc at redhat dot com
 Resolution|--- |FIXED

--- Comment #4 from Nick Clifton  ---
Hi Matthias,

  Thanks for reporting this problem.  I have checked in a patch to fix the
  issue - the orphan section placement code was assuming that it was
  dealing with ELF format sections - and the test now succeeds.

  H.J. - if you have the time, would you mind converting your testcase 
  into a new linker testsuite test ?  Thanks.

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/21884] [2.29/2.30 Regression] ld segfaulting building memtest86

2017-08-02 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=21884

--- Comment #3 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by Nick Clifton :

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

commit ddff3d84be42fa80c2c9aaa635f2b9269e74e4f9
Author: Nick Clifton 
Date:   Wed Aug 2 11:45:05 2017 +0100

Fix seg-fault when trying to place non-ELF orphan sections.

PR 21884
* emultempl/elf32.em (_place_orphan): Skip non-ELF binaries when
looking for sections to merge.

-- 
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/21884] [2.29/2.30 Regression] ld segfaulting building memtest86

2017-08-02 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21884

--- Comment #2 from H.J. Lu  ---
[hjl@gnu-tools-1 pr21884]$ cat x.t
OUTPUT_FORMAT("binary")

ENTRY(_main);
SECTIONS {
. = 0;
.setup : { *(.setup) }
}
[hjl@gnu-tools-1 pr21884]$ cat x.s
.text
.globl  _main
.type _main,%function
_main:
.dc.a bar
[hjl@gnu-tools-1 pr21884]$ cat y.s
.text
.globl  bar
.type bar,%function
bar:
.byte 0
[hjl@gnu-tools-1 pr21884]$ make
as   -o x.o x.s
as   -o y.o y.s
./ld  -T x.t -o x x.o y.o
make: *** [Makefile:13: x] Segmentation fault (core dumped)
make: *** Deleting file 'x'
[hjl@gnu-tools-1 pr21884]$

-- 
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/21884] [2.29/2.30 Regression] ld segfaulting building memtest86

2017-08-02 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21884

H.J. Lu  changed:

   What|Removed |Added

 CC|hjl at sourceware dot org  |hjl.tools at gmail dot 
com

-- 
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 binutils/21702] ar cannot handle (slim) LTO object files when in MRI script mode

2017-08-02 Thread spam.martin.schulze at gmx dot de
https://sourceware.org/bugzilla/show_bug.cgi?id=21702

--- Comment #5 from Martin Schulze  ---
Sorry about the confusion, I see now that it was worded ambiguously.
I tried the patch and it works.

-- 
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/21884] [2.29/2.30 Regression] ld segfaulting building memtest86

2017-08-02 Thread doko at debian dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=21884

--- Comment #1 from Matthias Klose  ---
Program received signal SIGSEGV, Segmentation fault.
0x5558d9c9 in gldelf_x86_64_place_orphan (s=0x558c73d0,
secname=0x558c72f3 ".text", 
constraint=382) at eelf_x86_64.c:1991
1991&& (elf_section_data (os->bfd_section)->this_hdr.sh_info
(gdb) bt
#0  0x5558d9c9 in gldelf_x86_64_place_orphan (s=0x558c73d0,
secname=0x558c72f3 ".text", 
constraint=382) at eelf_x86_64.c:1991
#1  0x5558354d in ldemul_place_orphan (s=0x558c73d0,
name=0x558c72f3 ".text", constraint=0)
at ../../ld/ldemul.c:124
#2  0x55577562 in ldlang_place_orphan (s=0x558c73d0) at
../../ld/ldlang.c:6376
#3  0x55577749 in lang_place_orphans () at ../../ld/ldlang.c:6433
#4  0x55578715 in lang_process () at ../../ld/ldlang.c:7147
#5  0x5557cb8f in main (argc=10, argv=0x7fffe528) at
../../ld/ldmain.c:437

-- 
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/21884] [2.29/2.30 Regression] ld segfaulting building memtest86

2017-08-02 Thread doko at debian dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=21884

Matthias Klose  changed:

   What|Removed |Added

 CC||hjl at sourceware dot org

-- 
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/21884] New: [2.29/2.30 Regression] ld segfaulting building memtest86

2017-08-02 Thread doko at debian dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=21884

Bug ID: 21884
   Summary: [2.29/2.30 Regression] ld segfaulting building
memtest86
   Product: binutils
   Version: 2.29
Status: NEW
  Severity: normal
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: doko at debian dot org
  Target Milestone: ---

Created attachment 10309
  --> https://sourceware.org/bugzilla/attachment.cgi?id=10309=edit
test case

[forwarded from https://bugs.debian.org/870343]

seen with the 2.29 branch on x86_64-linux-gnu, 2.28 works fine.

ld -T memtest.bin.lds bootsect.o setup.o -b binary memtest_shared.bin -o
memtest.bin
Makefile:46: recipe for target 'memtest.bin' failed
make[1]: *** [memtest.bin] Segmentation fault

-- 
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/21883] gold crashes with --cref

2017-08-02 Thread raj.khem at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21883

Khem Raj  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #1 from Khem Raj  ---
same bug entered twice due to slow connection.

*** This bug has been marked as a duplicate of bug 21882 ***

-- 
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/21882] gold crashes with --cref

2017-08-02 Thread raj.khem at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21882

--- Comment #1 from Khem Raj  ---
*** Bug 21883 has been marked as a duplicate of this 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


[Bug gold/21883] New: gold crashes with --cref

2017-08-02 Thread raj.khem at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21883

Bug ID: 21883
   Summary: gold crashes with --cref
   Product: binutils
   Version: 2.30 (HEAD)
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: gold
  Assignee: ccoutant at gmail dot com
  Reporter: raj.khem at gmail dot com
CC: ian at airs dot com
  Target Milestone: ---

The example here

https://uclibc.org/~kraj/ldbug.tar.bz2

crashes when run.sh is executed with gold linker

$ ./run.sh 
   
   
/tmp/binutils-gdb/gold/ld-new: internal error in operator(), at cref.cc:242


works fine with BFD linker.

-- 
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/21882] New: gold crashes with --cref

2017-08-02 Thread raj.khem at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21882

Bug ID: 21882
   Summary: gold crashes with --cref
   Product: binutils
   Version: 2.30 (HEAD)
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: gold
  Assignee: ccoutant at gmail dot com
  Reporter: raj.khem at gmail dot com
CC: ian at airs dot com
  Target Milestone: ---

The example here

https://uclibc.org/~kraj/ldbug.tar.bz2

crashes when run.sh is executed with gold linker

$ ./run.sh 
   
   
/tmp/binutils-gdb/gold/ld-new: internal error in operator(), at cref.cc:242


works fine with BFD linker.

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