Bug 6748 - regression: arm ld segfaults
Summary: regression: arm ld segfaults
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.19
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-15 18:27 UTC by Adrian Bunk
Modified: 2008-07-18 12:49 UTC (History)
3 users (show)

See Also:
Host: x86_64-unknown-linux-gnu
Target: arm-unknown-linux-gnu
Build: x86_64-unknown-linux-gnu
Last reconfirmed:


Attachments
.tmp_main.o (43.23 KB, application/octet-stream)
2008-07-15 18:27 UTC, Adrian Bunk
Details
.tmp_main.ver (92 bytes, application/octet-stream)
2008-07-15 18:28 UTC, Adrian Bunk
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Bunk 2008-07-15 18:27:13 UTC
Working: 2.18.50.0.7
Broken: 2.18.50.0.8

Several arm configurations of the Linux kernel fail to build due to an ld segfault:

$  arm-linux-ld -EL -r -o init/main.o init/.tmp_main.o -T init/.tmp_main.ver
Segmentation fault
$ 


Backtrace:

#0  0x0808c8b4 in elf32_arm_output_arch_local_syms ()
#1  0x080b3171 in bfd_elf_final_link ()
#2  0x0805e4a3 in ldwrite ()
#3  0x0805d82c in main ()


My first guess (that might be wrong) is that the 2008-05-22 bfd change might
cause it.
Comment 1 Adrian Bunk 2008-07-15 18:27:52 UTC
Created attachment 2831 [details]
.tmp_main.o
Comment 2 Adrian Bunk 2008-07-15 18:28:08 UTC
Created attachment 2832 [details]
.tmp_main.ver
Comment 3 H.J. Lu 2008-07-15 19:03:54 UTC
I can't reproduce it on Fedora 9/x86-64

[hjl@gnu-6 ld]$ ./ld-new -EL -r /tmp/tmp_main.o -T /tmp/tmp_main.ver -V
GNU ld (Linux/GNU Binutils) 2.18.50.0.8.20080709
  Supported emulations:
   armelf_linux
   armelf
   armelfb
   armelfb_linux
[hjl@gnu-6 ld]$ 
Comment 4 Adrian Bunk 2008-07-15 19:43:45 UTC
Perhaps since I have a 32bit userspace (I verbatim copied Host/Build from the
configure output, but although I have a 64bit kernel it's a 32bit userspace)?

After compiling with "-O0 -g" it becomes clear the problem is in the following code:

  /* Long calls stubs. */
  if (htab->stub_bfd && htab->stub_bfd->sections) {


gdb says:

(gdb) print htab->stub_bfd
$1 = (bfd *) 0xf5
(gdb) print htab->stub_bfd->sections
Cannot access memory at address 0x159
(gdb) 
Comment 5 H.J. Lu 2008-07-15 19:50:13 UTC
A patch is posted at

http://sourceware.org/ml/binutils/2008-07/msg00214.html
Comment 6 Adrian Bunk 2008-07-15 20:05:26 UTC
Thanks, I can confirm that your patch fixes the segfault.
Comment 7 H.J. Lu 2008-07-18 12:49:27 UTC
Fixed.