This is the mail archive of the binutils@sourceware.cygnus.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: GNU linker and Function stubs on mips.


   Date: Fri, 03 Mar 2000 07:34:42 -0700
   From: Koundinya K <knk@dde.dk>

   Yes you are right. In fact even in the second test we don't need to test for
   STT_FUNC at all.

Will that really handle weakdefs correctly?  Make sure you think about
the consequences of your changes with respect to the existing code.
Just because it works for your test case does not mean that it works
for all test cases.

   because in libstdc++.so generated bt GNU linker, cout is defined to be a
   object. I don't understand why it has to put cout as an object type.

   [187324]        |0x60070e54|0x00000028|OBJT |GLOB |0    |65282  |cout

cout is a variable, not a function, so making it STT_OBJECT sounds
right to me.

   > However, I'm not convinced that it will always work.  If a symbol has
   > both call relocations and ordinary relocations, then I think that
   > NEEDS_PLT will be set, but we want to set the dynamic symbol table
   > entry to 0.  Try something like this with the native tools and with
   > your linker, to see what happens:
   >     extern int foo ();
   >     int (*pfn) = foo;
   >     int bar () { return foo (); }

   I  did not quite understand this. Here is the objdump -r of the above you
   asked me to check. I just wrote a main and tried to link main.o and ruf.o. I
   got undefined references to foo. I am not sure what I am supposed to do.
   Please clarify ? What results from the Linker am I supposed to expect ??

Build a shared library out of that code.  Look at the dynamic symbol
entry for foo.  Try this with the native tools and the patched GNU
linker.

You are suggesting that we only need to check NEEDS_PLT.  Therefore, I
am constructing a test case which I believe will set NEEDS_PLT, but
which also refers to the symbol without calling it.  It's clear that
you have tested symbols which are called, since that is done by any
actual program.  It's clear that you have tested symbols whose address
is taken, since that is the bug you are fixing.  It is not clear that
you have tested symbols which are both called and whose address is
taken.

I am suggesting that you look at the dynamic symbol entry for such a
symbol, because that is what your patch affects.  This should actually
be done with the symbol both defined and undefind.

Ian

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