This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: The ia64 linker problems.


On Mon, Feb 05, 2001 at 03:42:28PM -0800, H . J . Lu wrote:
> On Mon, Feb 05, 2001 at 03:23:44PM -0800, H . J . Lu wrote:
> > I found a few ia64 linker problems. One of them is I cannot overide
> > functions in DSO from the executables:
> > 
> > # make
> > cc -O -B./  -c main.c
> > cc: file path prefix `./' never used
> > cc -O -B./  -fPIC -c sh1.c
> > cc: file path prefix `./' never used
> > cc -shared -o libfoo.so -O -B./  -fPIC sh1.o
> > cc: file path prefix `./' never used
> > cc -o foo -O -B./  main.o libfoo.so -Wl,-rpath,.
> > cc: file path prefix `./' never used
> > for f in foo; do echo "Running: $f"; ./$f; \
> >   if [ $? != 0 ]; then echo Failed; fi; done
> > Running: foo
> > shlib_shlibcall2 () == 7
> > shlib_overriddencall2 () == 8
> > Failed
> > 
> 
> I think I found the problem:
> 
> # gcc -c sh1.c -fPIC
> # readelf -a sh1.o | grep shlib_overriddencall2
>      9: 0000000000000060     0 FUNC    GLOBAL DEFAULT    1 shlib_overriddencall2
> 
> There is no relocation for shlib_overriddencall2. I believe the assembler is
> wrong. It can only optimize out the relocation iff the symbol is local.
> 
 
Hi, Jim,

This patch seems to work for me.


-- 
H.J. Lu (hjl@valinux.com)
---
2001-02-05  H.J. Lu  <hjl@gnu.org>

	* config/tc-ia64.c (ia64_force_relocation): Return 1 for global
	symbols.

Index: config/tc-ia64.c
===================================================================
RCS file: /work/cvs/gnu/binutils/gas/config/tc-ia64.c,v
retrieving revision 1.1.1.25
diff -u -p -r1.1.1.25 tc-ia64.c
--- config/tc-ia64.c	2001/01/23 19:00:11	1.1.1.25
+++ config/tc-ia64.c	2001/02/06 05:32:57
@@ -9300,6 +9301,10 @@ int
 ia64_force_relocation (fix)
      fixS *fix;
 {
+  /* All global symbols need relocations.  */
+  if (S_IS_EXTERN (fix->fx_addsy) || S_IS_WEAK (fix->fx_addsy))
+    return 1;
+
   switch (fix->fx_r_type)
     {
     case BFD_RELOC_IA64_FPTR64I:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]