FS#40680 - [binutils] Cannot link to shared libraries

Attached to Project: Arch Linux
Opened by Zulan (Zulan) - Wednesday, 04 June 2014, 12:02 GMT
Last edited by Allan McRae (Allan) - Wednesday, 04 June 2014, 14:00 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Allan McRae (Allan)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

Cannot link a shared library with libbfd. Arch binutils deletes the libbfd.so symlink, so libbfd.a is used.

Additional info:
* binutils-2.24-3

Steps to reproduce:

// foo.c
#define PACKAGE "foo"
#include <bfd.h>
void foo() {
void *argh = bfd_check_format_matches;
}

% gcc -shared -fPIC foo.c -o foo.so -lbfd

/usr/bin/ld: /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../lib/libbfd.a(format.o): relocation R_X86_64_32S against `binary_vec' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../lib/libbfd.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status

Specifying the specific version of the library yields no error. (so. version used)

% gcc -shared -fPIC foo.c -o foo.so -lbfd-2.24
This task depends upon

Closed by  Allan McRae (Allan)
Wednesday, 04 June 2014, 14:00 GMT
Reason for closing:  Fixed
Additional comments about closing:  binutils-2.24-5 in [testing]
Comment by Zulan (Zulan) - Wednesday, 04 June 2014, 12:05 GMT
Note: the binutils PKGBUILD explicity deletes the /usr/lib/libbfd.so symlink in package().
Comment by Allan McRae (Allan) - Wednesday, 04 June 2014, 14:00 GMT
Looks like despite what the configure looks like it is doing, the libraries are not build with PIC by default.

Loading...