This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Can you use PIC for shared library?
- From: "H. J. Lu" <hjl at lucon dot org>
- To: dan at debian dot org
- Cc: binutils at sources dot redhat dot com
- Date: Tue, 19 Oct 2004 09:37:14 -0700
- Subject: Re: Can you use PIC for shared library?
- References: <20041019010848.GA26817@lucon.org>
On Mon, Oct 18, 2004 at 06:08:48PM -0700, H. J. Lu wrote:
> I got
>
> Running
> /net/gnu/export/linux/src/binutils/binutils/ld/testsuite/ld-elf/exclude.exp
> ...
> /export/build/linux/binutils-debug/build-x86_64-linux/ld/../gas/as-new
> -o tmpdir/exclude1.o
> /net/gnu/export/linux/src/binutils/binutils/ld/testsuite/ld-elf/exclude1.s
> /export/build/linux/binutils-debug/build-x86_64-linux/ld/../gas/as-new
> -o tmpdir/exclude2.o
> /net/gnu/export/linux/src/binutils/binutils/ld/testsuite/ld-elf/exclude2.s
> /export/build/linux/binutils-debug/build-x86_64-linux/ld/ld-new -o
> tmpdir/exclude.so --shared tmpdir/exclude1.o -Ltmpdir -lexclude
> /export/build/linux/binutils-debug/build-x86_64-linux/ld/ld-new:
> tmpdir/exclude1.o: relocation R_X86_64_PC32 against `exclude_sym' can
> not be used when making a shared object; recompile with -fPIC
> /export/build/linux/binutils-debug/build-x86_64-linux/ld/ld-new: final
> link failed: Bad value FAIL: ld link shared library
>
>
This works on ia32, ia64 and x86-64. I will check it in shortly.
H.J.
--
2004-10-19 H.J. Lu <hongjiu.lu@intel.com>
* ld-elf/exclude1.s: Add ".data".
* ld-elf/exclude2.s: Likewise.
--- ld/testsuite/ld-elf/exclude1.s.pic 2004-10-18 09:25:33.000000000 -0700
+++ ld/testsuite/ld-elf/exclude1.s 2004-10-19 09:21:17.945016383 -0700
@@ -1,3 +1,4 @@
.globl include_sym
+ .data
include_sym:
.long exclude_sym - include_sym
--- ld/testsuite/ld-elf/exclude2.s.pic 2004-10-18 09:25:33.000000000 -0700
+++ ld/testsuite/ld-elf/exclude2.s 2004-10-19 09:21:26.735879867 -0700
@@ -1,3 +1,4 @@
.globl exclude_sym
+ .data
exclude_sym:
.long 0