[Bug ld/6747] New: regression: ld adds -fpic private flag

2008-07-15 Thread bunk at stusta dot de
Toolchain:
- gcc 4.3.1
- binutils 2.18.50.0.7 and 2.18.50.0.8
- configured for frv-linux

Linux kernel 2.6.26 builds fine when using binutils 2.18.50.0.7, but fails as
follows with binutils 2.18.50.0.8:

<--  snip  -->

...
  HOSTCC  scripts/kallsyms
  CC  init/main.o
  CHK include/linux/compile.h
  UPD include/linux/compile.h
  CC  init/version.o
  CC  init/do_mounts.o
  LD  init/mounts.o
  CC  init/noinitramfs.o
  LD  init/built-in.o
frv-linux-ld: init/mounts.o: compiled with -fpic and linked with modules that se
non-pic relocations
frv-linux-ld: failed to merge target specific data of file init/mounts.o
make[2]: *** [init/built-in.o] Error 1

<--  snip  -->



- compiled the kernel with 2.18.50.0.7.
- then changed binutils to 2.18.50.0.8

Works:
frv-linux-ld-r -o init/built-in.o init/main.o init/version.o init/mounts.o
init/noinitramfs.o

Fails:
frv-linux-ld-r -o init/mounts.o init/do_mounts.o
frv-linux-ld-r -o init/built-in.o init/main.o init/version.o init/mounts.o
init/noinitramfs.o


I did an "frv-linux-objdump  -Dx" on the init/mounts.o files generated 
with both binutils versions, and the diff is:

--- working 2008-07-15 16:34:49.0 +0300
+++ broken  2008-07-15 16:34:40.0 +0300
 architecture: fr450, flags 0x0011:
 HAS_RELOC, HAS_SYMS
 start address 0x
-private flags = 0x800020d: -mcpu=fr450 -mgpr-32 -msoft-float non-pic 
relocations
+private flags = 0x800030d: -mcpu=fr450 -mgpr-32 -msoft-float -fpic non-pic
relocations


-fpic is *not* part of the private flags in do_mounts.o

-- 
   Summary: regression: ld adds -fpic private flag
   Product: binutils
   Version: 2.19 (HEAD)
Status: NEW
  Severity: normal
  Priority: P2
 Component: ld
AssignedTo: unassigned at sources dot redhat dot com
ReportedBy: bunk at stusta dot de
CC: bug-binutils at gnu dot org
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: frv-unknown-linux-gnu


http://sourceware.org/bugzilla/show_bug.cgi?id=6747

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


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


[Bug ld/6747] regression: ld adds -fpic private flag

2008-07-15 Thread bunk at stusta dot de

--- Additional Comments From bunk at stusta dot de  2008-07-15 14:15 ---
Created an attachment (id=2829)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=2829&action=view)
verbose build log


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=6747

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


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


[Bug ld/6747] regression: ld adds -fpic private flag

2008-07-15 Thread bunk at stusta dot de

--- Additional Comments From bunk at stusta dot de  2008-07-15 14:17 ---
Created an attachment (id=2830)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=2830&action=view)
do_mounts.o


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=6747

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


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


[Bug ld/6747] regression: ld adds -fpic private flag

2008-07-15 Thread hjl dot tools at gmail dot com


-- 
   What|Removed |Added

 CC||hjl dot tools at gmail dot
   ||com


http://sourceware.org/bugzilla/show_bug.cgi?id=6747

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


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


[Bug ld/4424] Can't link in Linux object files on FreeBSD

2008-07-15 Thread hjl dot tools at gmail dot com

--- Additional Comments From hjl dot tools at gmail dot com  2008-07-15 
17:22 ---
We missed a case of linking Linux .o against FreeBSD .so:

[EMAIL PROTECTED] weak-11]$ cat foo.c
extern void  () __attribute__((weak));
void _start(void)
{ 
  if (& != 0)
 ();
}
[EMAIL PROTECTED] weak-11]$ cat bar.c
void
__attribute__((weak))
 ()
{
}
[EMAIL PROTECTED] weak-11]$ make
gcc -O2 -fno-asynchronous-unwind-tables   -c -o foo.o foo.c
gcc -O2 -fno-asynchronous-unwind-tables -fPIC   -c -o bar.o bar.c
./ld -shared -o libbar.so bar.o
./ld  -o foo foo.o libbar.so
readelf -s foo | grep 
 1: 004002a0 2 FUNCGLOBAL   DEFAULT  UND 
15: 004002a0 2 FUNCGLOBAL   DEFAULT  UND 
[EMAIL PROTECTED] weak-11]$ ./ld -V
GNU ld (GNU Binutils) 2.18.50.20080715
  Supported emulations:
   elf_x86_64_fbsd
   elf_i386_fbsd
   elf_x86_64
   elf_i386
[EMAIL PROTECTED] weak-11]$ 

It should be

readelf -s foo | grep 
 1: 004002a0 2 FUNCWEAK   DEFAULT  UND 
15: 004002a0 2 FUNCWEAK   DEFAULT  UND 

-- 
   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |


http://sourceware.org/bugzilla/show_bug.cgi?id=4424

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


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


[Bug ld/4424] Can't link in Linux object files on FreeBSD

2008-07-15 Thread hjl dot tools at gmail dot com

--- Additional Comments From hjl dot tools at gmail dot com  2008-07-15 
17:34 ---
A new patch is posted at

http://sourceware.org/ml/binutils/2008-07/msg00207.html

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=4424

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


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


[Bug ld/4424] Can't link in Linux object files on FreeBSD

2008-07-15 Thread hjl dot tools at gmail dot com


-- 
   What|Removed |Added

Version|2.18|2.19 (HEAD)


http://sourceware.org/bugzilla/show_bug.cgi?id=4424

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


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


[Bug ld/6748] New: regression: arm ld segfaults

2008-07-15 Thread bunk at stusta dot de
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.

-- 
   Summary: regression: arm ld segfaults
   Product: binutils
   Version: 2.19 (HEAD)
Status: NEW
  Severity: normal
  Priority: P2
 Component: ld
AssignedTo: unassigned at sources dot redhat dot com
ReportedBy: bunk at stusta dot de
CC: bug-binutils at gnu dot org
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: arm-unknown-linux-gnu


http://sourceware.org/bugzilla/show_bug.cgi?id=6748

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


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


[Bug ld/6748] regression: arm ld segfaults

2008-07-15 Thread bunk at stusta dot de

--- Additional Comments From bunk at stusta dot de  2008-07-15 18:27 ---
Created an attachment (id=2831)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=2831&action=view)
.tmp_main.o


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=6748

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


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


[Bug ld/6748] regression: arm ld segfaults

2008-07-15 Thread bunk at stusta dot de

--- Additional Comments From bunk at stusta dot de  2008-07-15 18:28 ---
Created an attachment (id=2832)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=2832&action=view)
.tmp_main.ver


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=6748

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


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


[Bug ld/6446] Handling of EF_FRV_PIC

2008-07-15 Thread hjl dot tools at gmail dot com


-- 
   What|Removed |Added

OtherBugsDependingO||6747
  nThis||


http://sourceware.org/bugzilla/show_bug.cgi?id=6446

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


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


[Bug ld/6747] regression: ld adds -fpic private flag

2008-07-15 Thread hjl dot tools at gmail dot com

--- Additional Comments From hjl dot tools at gmail dot com  2008-07-15 
18:35 ---
This is caused by

http://sourceware.org/ml/binutils-cvs/2008-05/msg00092.html

specifically the proposed patch for

http://www.sourceware.org/bugzilla/show_bug.cgi?id=6446

-- 
   What|Removed |Added

  BugsThisDependsOn||6446


http://sourceware.org/bugzilla/show_bug.cgi?id=6747

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


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


[Bug ld/6748] regression: arm ld segfaults

2008-07-15 Thread hjl dot tools at gmail dot com


-- 
   What|Removed |Added

 CC||hjl dot tools at gmail dot
   ||com


http://sourceware.org/bugzilla/show_bug.cgi?id=6748

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


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


[Bug ld/6747] regression: ld adds -fpic private flag

2008-07-15 Thread hjl dot tools at gmail dot com


-- 
   What|Removed |Added

 CC||nickc at redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=6747

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


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


[Bug ld/6446] Handling of EF_FRV_PIC

2008-07-15 Thread hjl dot tools at gmail dot com

--- Additional Comments From hjl dot tools at gmail dot com  2008-07-15 
18:52 ---
(In reply to comment #1)
> Created an attachment (id=2748)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=2748&action=view)
> Set EF_FRV_PIC by default (for FDPIC).Clear it if any inter-segment
> relocations are found
> 

This patch caused PR 6747.

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=6446

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


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


[Bug ld/6748] regression: arm ld segfaults

2008-07-15 Thread hjl dot tools at gmail dot com

--- Additional Comments From hjl dot tools at gmail dot com  2008-07-15 
19:03 ---
I can't reproduce it on Fedora 9/x86-64

[EMAIL PROTECTED] 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
[EMAIL PROTECTED] ld]$ 

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=6748

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


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


[Bug ld/6748] regression: arm ld segfaults

2008-07-15 Thread bunk at stusta dot de

--- Additional Comments From bunk at stusta dot de  2008-07-15 19:43 ---
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) 

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=6748

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


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


[Bug ld/6748] regression: arm ld segfaults

2008-07-15 Thread hjl dot tools at gmail dot com

--- Additional Comments From hjl dot tools at gmail dot com  2008-07-15 
19:50 ---
A patch is posted at

http://sourceware.org/ml/binutils/2008-07/msg00214.html

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=6748

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


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


[Bug ld/6748] regression: arm ld segfaults

2008-07-15 Thread bunk at stusta dot de

--- Additional Comments From bunk at stusta dot de  2008-07-15 20:05 ---
Thanks, I can confirm that your patch fixes the segfault.

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=6748

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


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