[Bug gold/14592] gold segfaults with internal error in set_address

2012-09-17 Thread raj.khem at gmail dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=14592

Khem Raj  changed:

   What|Removed |Added

 Target||arm-linux-gnueabi

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- 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/14592] New: gold segfaults with internal error in set_address

2012-09-17 Thread raj.khem at gmail dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=14592

 Bug #: 14592
   Summary: gold segfaults with internal error in set_address
   Product: binutils
   Version: 2.23
Status: NEW
  Severity: normal
  Priority: P2
 Component: gold
AssignedTo: i...@airs.com
ReportedBy: raj.k...@gmail.com
CC: ccout...@google.com
Classification: Unclassified


gold is segfaulting on ARM using following set up

foo.S

_start:


foo.ld

SECTIONS {
.stack (NOLOAD) : {
   . = ALIGN(8);
}
}


$ ./gas/as-new -o foo.o foo.S
$ ./gold/ld-new -T foo.ld foo.o

./gold/ld-new: internal error in set_address, at
/home/kraj/work/binutils/gold/output.h:189

I first saw it on 2.22 branch and it is triggered after this commit

commit 624da0376264205e399bc14fe2fa7b6fa659d0ee
Author: Ian Lance Taylor 
Date:   Mon Dec 19 21:14:39 2011 +

Copy from mainline to binutils 2.22 branch:


This also happens on trunk


./gold/ld-new --version
GNU gold (GNU Binutils 2.23.51.20120917) 1.11
Copyright 2011 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- 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/14590] ifunc problem: internal error, aborting at elf64-x86-64.c line 3175 in elf_x86_64_relocate_section

2012-09-17 Thread hjl.tools at gmail dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=14590

H.J. Lu  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||DUPLICATE

--- Comment #3 from H.J. Lu  2012-09-17 16:29:52 
UTC ---
Dup.

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

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- 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/14591] Wrong symbol type with common symbol and weak function

2012-09-17 Thread hjl.tools at gmail dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=14591

H.J. Lu  changed:

   What|Removed |Added

 CC||matz at suse dot de

--- Comment #1 from H.J. Lu  2012-09-17 16:29:52 
UTC ---
*** Bug 14590 has been marked as a duplicate of this bug. ***

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- 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/14591] New: Wrong symbol type with common symbol and weak function

2012-09-17 Thread hjl.tools at gmail dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=14591

 Bug #: 14591
   Summary: Wrong symbol type with common symbol and weak function
   Product: binutils
   Version: unspecified
Status: NEW
  Severity: normal
  Priority: P2
 Component: ld
AssignedTo: unassig...@sourceware.org
ReportedBy: hjl.to...@gmail.com
Classification: Unclassified


[hjl@gnu-6 pr14590]$ cat x.c 
#include 

int foo;
int
main ()
{
  foo = getchar ();
  return foo != 0;
}
[hjl@gnu-6 pr14590]$ cat y.c
void alt (void) { }

void foo (void);
void * foo_ifunc (void) __asm__ ("foo");
//__asm__(".type foo, %gnu_indirect_function");
__asm__(".weak foo");

void *
foo_ifunc (void)
{
  return alt;
}
[hjl@gnu-6 pr14590]$ make
gcc -B./ -g   -c -o x.o x.c
gcc -B./ -g   -c -o y.o y.c
gcc -B./ -static -o x x.o y.o
readelf -s --wide x | grep foo
  1793: 006b4f70 4 FUNCGLOBAL DEFAULT   26 foo
echo 0 | ./x
make: *** [all] Error 1
[hjl@gnu-6 pr14590]$ 

"foo" should be marked as OBJECT, not FUNC.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- 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/14590] ifunc problem: internal error, aborting at elf64-x86-64.c line 3175 in elf_x86_64_relocate_section

2012-09-17 Thread hjl.tools at gmail dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=14590

--- Comment #2 from H.J. Lu  2012-09-17 16:03:20 
UTC ---
[hjl@gnu-6 pr14590]$ cat x.c
int foo;
int
main ()
{
  return foo != 0;
}
[hjl@gnu-6 pr14590]$ cat y.c
void alt (void) { }

#pragma foo_ifunc weak
void foo (void);
void * foo_ifunc (void) __asm__ ("foo");
__asm__(".type foo, %gnu_indirect_function");

void *
foo_ifunc (void)
{
  return alt;
}
[hjl@gnu-6 pr14590]$ make
gcc -B./ -g   -c -o x.o x.c
gcc -B./ -g   -c -o y.o y.c
gcc -B./ -static -o x x.o y.o
./ld: Warning: alignment 2 of symbol `foo' in y.o is smaller than 4 in x.o
./ld: Warning: size of symbol `foo' changed from 4 in x.o to 11 in y.o
./ld: Warning: type of symbol `foo' changed from 1 to 10 in y.o
./ld: BFD (GNU Binutils) 2.23.51.20120917 internal error, aborting at
/export/gnu/import/git/binutils/bfd/elf64-x86-64.c line 3335 in
elf_x86_64_relocate_section

./ld: Please report this bug.

collect2: error: ld returned 1 exit status
make: *** [x] Error 1
[hjl@gnu-6 pr14590]$

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- 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/14590] ifunc problem: internal error, aborting at elf64-x86-64.c line 3175 in elf_x86_64_relocate_section

2012-09-17 Thread matz at suse dot de
http://sourceware.org/bugzilla/show_bug.cgi?id=14590

--- Comment #1 from Michael Matz  2012-09-17 15:31:45 UTC 
---
The problem seems to be specific to common symbols.  With -fno-common
it goes away.  The hash slot for the 'index' symbol get type STT_GNU_IFUNC
in elf_link_add_object_symbols when reading the libc.a symbol table,
even though it's only a weak def, and the slot referred to STT_OBJECT before.

We don't get a type-changed warning because type_change_ok is true.
I think we shouldn't regard weak defs to override common symbols.
But whatever we do, we must not segfault here, and preferrably still generate
expected code (as in, all references to index resolving to the common symbol).

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- 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/14590] ifunc problem: internal error, aborting at elf64-x86-64.c line 3175 in elf_x86_64_relocate_section

2012-09-17 Thread matz at suse dot de
http://sourceware.org/bugzilla/show_bug.cgi?id=14590

Michael Matz  changed:

   What|Removed |Added

 CC||hjl.tools at gmail dot com

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- 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/14590] New: ifunc problem: internal error, aborting at elf64-x86-64.c line 3175 in elf_x86_64_relocate_section

2012-09-17 Thread matz at suse dot de
http://sourceware.org/bugzilla/show_bug.cgi?id=14590

 Bug #: 14590
   Summary: ifunc problem: internal error, aborting at
elf64-x86-64.c line 3175 in
elf_x86_64_relocate_section
   Product: binutils
   Version: 2.24 (HEAD)
Status: NEW
  Severity: normal
  Priority: P2
 Component: ld
AssignedTo: unassig...@sourceware.org
ReportedBy: m...@suse.de
Classification: Unclassified


% cat x.c
#include 
int index;
int main() {
index=getchar();
return index;
}
% gcc -fno-builtin -static -g x.c
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: BFD
(GNU Binutils; devel:gcc / SLE-11) 2.22 internal error, aborting at
../../bfd/elf64-x86-64.c line 3094 in elf_x86_64_relocate_section

This is a problem also with older binutils.  This requires a libc which has
the symbol 'index' defined as weak ifunc:

18: 41 IFUNC   WEAK   DEFAULT1 index

It only happens when linking statically.  The abort is this one:

3170  bfd_vma plt_index;
3171  const char *name;
3172
3173  if ((input_section->flags & SEC_ALLOC) == 0
3174  || h->plt.offset == (bfd_vma) -1)
3175abort ();

The reference this is about is from .debug_info (i.e. !SEC_ALLOC), hence
the abort.  I don't know why it things it finds the ifunc definition
first (h->type is STT_GNU_IFUNC here), not the one in the COMMON section.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- 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