[Bug ld/22300] Abort in elf32_hppa_relocate_section at elf32-hppa.c:4055 building debian polyml

2017-11-07 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22300

Alan Modra  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #8 from Alan Modra  ---
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/22300] Abort in elf32_hppa_relocate_section at elf32-hppa.c:4055 building debian polyml

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

--- Comment #7 from cvs-commit at gcc dot gnu.org  ---
The binutils-2_29-branch branch has been updated by Alan Modra
:

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

commit 1dac3b4518f811cc124df2040db3c5a0e9049bb3
Author: Alan Modra 
Date:   Sat Oct 28 14:10:55 2017 +1030

PR22300, Abort in elf32_hppa_relocate_section building polyml

polyml produces object files with the wrong OS/ABI for hppa-linux.
This, along with the fact that elf32-hppa.c is using the strictest
backend relocs_compatible, results in wrong merging of ELF symbols.

So, remove the relocs_compatible check in _bfd_elf_merge_symbol.
_bfd_elf_merge_symbol is only called nowadays from within blocks
protected by is_elf_hash_table, so "we are doing an ELF link" as the
removed comment says, is true.

Also relax relocs_compatible for hppa and powerpc.  relocs_compatible
is used for more than just merging symbols, as the name suggests.
This allows objects that are in fact reasonably compatible to be
linked.

PR 22300
* elflink.c (_bfd_elf_merge_symbol): Remove relocs_compatible check.
* elf32-hppa.c (elf_backend_relocs_compatible): Define.
* elf32-ppc.c (elf_backend_relocs_compatible): Define.
* elf64-ppc.c (elf_backend_relocs_compatible): Define.

(cherry picked from commit c0e331c794d6bd75d9be9bea6145513074c33f39)

-- 
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/22300] Abort in elf32_hppa_relocate_section at elf32-hppa.c:4055 building debian polyml

2017-10-28 Thread dave.anglin at bell dot net
https://sourceware.org/bugzilla/show_bug.cgi?id=22300

--- Comment #6 from dave.anglin at bell dot net ---
Thanks Alan. That was an excellent bit of debugging.

I created a debian bug report for the polyml bug:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=880023

--
John David Anglin   dave.ang...@bell.net

-- 
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/22300] Abort in elf32_hppa_relocate_section at elf32-hppa.c:4055 building debian polyml

2017-10-28 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=22300

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

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

commit c0e331c794d6bd75d9be9bea6145513074c33f39
Author: Alan Modra 
Date:   Sat Oct 28 14:10:55 2017 +1030

PR22300, Abort in elf32_hppa_relocate_section building polyml

polyml produces object files with the wrong OS/ABI for hppa-linux.
This, along with the fact that elf32-hppa.c is using the strictest
backend relocs_compatible, results in wrong merging of ELF symbols.

So, remove the relocs_compatible check in _bfd_elf_merge_symbol.
_bfd_elf_merge_symbol is only called nowadays from within blocks
protected by is_elf_hash_table, so "we are doing an ELF link" as the
removed comment says, is true.

Also relax relocs_compatible for hppa and powerpc.  relocs_compatible
is used for more than just merging symbols, as the name suggests.
This allows objects that are in fact reasonably compatible to be
linked.

PR 22300
* elflink.c (_bfd_elf_merge_symbol): Remove relocs_compatible check.
* elf32-hppa.c (elf_backend_relocs_compatible): Define.
* elf32-ppc.c (elf_backend_relocs_compatible): Define.
* elf64-ppc.c (elf_backend_relocs_compatible): Define.

-- 
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/22300] Abort in elf32_hppa_relocate_section at elf32-hppa.c:4055 building debian polyml

2017-10-27 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22300

Alan Modra  changed:

   What|Removed |Added

 CC|amodra at gmail dot com|
   Assignee|unassigned at sourceware dot org   |amodra at gmail dot com

--- Comment #4 from Alan Modra  ---
p *hh
$6 = {eh = {root = {root = {next = 0x288fa0, string = 0x14ede2
"PolyThreadForkThread", hash = 155903331}, 
  type = bfd_link_hash_defined, non_ir_ref_regular = 0, non_ir_ref_dynamic
= 0, linker_def = 0, ldscript_def = 0, u = {
undef = {next = 0x12fb18, abfd = 0x1581f8}, def = {next = 0x12fb18,
section = 0x1581f8, value = 225876}, i = {
  next = 0x12fb18, link = 0x1581f8, 
  warning = 0x37254 
"\b\003\002Z\350X\n\255\b\006\002C\350X\n\235\b\021\002Z4\031"}, c = {
  next = 0x12fb18, p = 0x1581f8, size = 225876}}}, indx = -1, dynindx =
39, got = {refcount = -1, offset = 4294967295, 
  glist = 0x, plist = 0x}, plt = {refcount = -1, offset =
4294967295, glist = 0x, plist = 0x}, 
size = 604, type = 2, other = 0, target_internal = 0, ref_regular = 1,
def_regular = 0, ref_dynamic = 0, def_dynamic = 1, 
ref_regular_nonweak = 1, dynamic_adjusted = 1, needs_copy = 0, needs_plt =
0, non_elf = 1, versioned = unversioned, 
forced_local = 0, dynamic = 0, mark = 0, non_got_ref = 0, dynamic_def = 1,
ref_dynamic_nonweak = 0, 
pointer_equality_needed = 0, unique_global = 0, protected_def = 0,
start_stop = 0, dynstr_index = 1527, u = {
  weakdef = 0xde9f7f4, elf_hash_value = 233437172}, verinfo = {verdef =
0x0, vertree = 0x0}, u2 = {start_stop_section = 0x0, 
  vtable = 0x0}}, hsh_cache = 0x0, dyn_relocs = 0x0, tls_type =
GOT_UNKNOWN, plabel = 0}

Huh, non_elf set?  So that comes about due to _bfd_elf_merge_symbol not getting
to elflink.c:1212 where non_elf is cleared.  And if we don't get there then
none of the proper merging of elf symbols occurs.

And that's because _bfd_elf_merge_symbol exits here:
  if (!(*bed->relocs_compatible) (abfd->xvec, info->output_bfd->xvec))
return TRUE;

The output bfd vec is hppa_elf32_linux_vec while the input (polyexport.o) is
hppa_elf32_vec, and elf32-hppa.c has no define for
elf_backend_relocs_compatible so uses the default that requires an exact match
of bfd vec.

polyexport.o is hppa_elf32_vec because os/abi is ELFOSABI_HPUX.  The output is
hppa_elf32_linux_vec because that's the default target.


bug 1: polyimport, the producer of polyexport.o is using the wrong os/abi for
hppa-linux.

bug 2: elf32-hppa.c ought to be using _bfd_elf_relocs_compatible

bug 3: _bfd_elf_merge_symbol shouldn't be using relocs_compatible

-- 
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/22300] Abort in elf32_hppa_relocate_section at elf32-hppa.c:4055 building debian polyml

2017-10-16 Thread dave.anglin at bell dot net
https://sourceware.org/bugzilla/show_bug.cgi?id=22300

--- Comment #3 from dave.anglin at bell dot net ---
On 2017-10-15, at 7:57 PM, amodra at gmail dot com wrote:

> Have you tried with current HEAD?

Same error occurs with current head.

Starting program: /home/dave/gnu/binutils/objdir/ld/.libs/ld-new -plugin
/usr/lib/gcc/hppa-linux-gnu/7/liblto_plugin.so
-plugin-opt=/usr/lib/gcc/hppa-linux-gnu/7/lto-wrapper
-plugin-opt=-fresolution=-debug.res -plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --sysroot=/
--build-id --eh-frame-hdr -dynamic-linker /lib/ld.so.1 -o .libs/poly
/usr/lib/gcc/hppa-linux-gnu/7/../../../hppa-linux-gnu/crt1.o
/usr/lib/gcc/hppa-linux-gnu/7/../../../hppa-linux-gnu/crti.o
/usr/lib/gcc/hppa-linux-gnu/7/crtbegin.o -L/usr/lib/gcc/hppa-linux-gnu/7
-L/usr/lib/gcc/hppa-linux-gnu/7/../../../hppa-linux-gnu
-L/usr/lib/gcc/hppa-linux-gnu/7/../../.. -L/lib/hppa-linux-gnu
-L/usr/lib/hppa-linux-gnu --as-needed polyexport.o
libpolymain/.libs/libpolymain.a libpolyml/.libs/libpolyml.so -lpthread -lffi
-lm -ldl -lstdc++ -lgcc_s -lgcc -v -lgcc --as-needed -lgcc_s --no-as-needed -lc
-lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/hppa-linux-gnu/7/crtend.o
/usr/lib/gcc/hppa-linux-gnu/7/../../../hppa-linux-gnu/crtn.o
GNU ld (GNU Binutils) 2.29.51.20171016
/home/dave/gnu/binutils/objdir/ld/.libs/ld-new: BFD (GNU Binutils)
2.29.51.20171016 internal error, aborting at ../../src/bfd/elf32-hppa.c:3937 in
elf32_hppa_relocate_section

--
John David Anglin   dave.ang...@bell.net

-- 
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/22300] Abort in elf32_hppa_relocate_section at elf32-hppa.c:4055 building debian polyml

2017-10-16 Thread dave.anglin at bell dot net
https://sourceware.org/bugzilla/show_bug.cgi?id=22300

--- Comment #2 from dave.anglin at bell dot net ---
Will check.  I thought the debug info that I posted was for the trunk but
I see it was for "GNU ld (GNU Binutils) 2.29.51.20170819".

-- 
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/22300] Abort in elf32_hppa_relocate_section at elf32-hppa.c:4055 building debian polyml

2017-10-15 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22300

Alan Modra  changed:

   What|Removed |Added

 CC||amodra at gmail dot com

--- Comment #1 from Alan Modra  ---
Have you tried with current HEAD?  A couple of patches have gone in that may be
relevant, 46434633f9c and 559192d89d7.

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