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?
On Tue, Oct 19, 2004 at 12:39:28PM -0400, Daniel Jacobowitz wrote:
> On Tue, Oct 19, 2004 at 09:37:14AM -0700, H. J. Lu wrote:
> > 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.
>
> Fine with me. Does it work if you remove the " - include_sym" also?
> That should fix cris.
>
I still need ".data". I will check in this one then.
H.J.
----
2004-10-19 H.J. Lu <hongjiu.lu@intel.com>
* ld-elf/exclude.exp: Allow cris-*-elf.
* ld-elf/exclude1.s: Add ".data". Remove "- include_sym".
* ld-elf/exclude2.s: Add ".data".
--- ld/testsuite/ld-elf/exclude.exp.pic 2004-10-19 09:07:16.000000000 -0700
+++ ld/testsuite/ld-elf/exclude.exp 2004-10-19 10:09:50.687630231 -0700
@@ -23,8 +23,8 @@ if ![is_elf_format] {
return
}
-# No shared lib support on these targets.
-if { [istarget "mcore-*-*"] || [istarget "cris-*-elf"] } {
+# No shared lib support on this target.
+if { [istarget "mcore-*-*"] } {
return
}
--- ld/testsuite/ld-elf/exclude1.s.pic 2004-10-18 09:25:33.000000000 -0700
+++ ld/testsuite/ld-elf/exclude1.s 2004-10-19 10:08:07.927889729 -0700
@@ -1,3 +1,4 @@
.globl include_sym
+ .data
include_sym:
- .long exclude_sym - include_sym
+ .long exclude_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