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: [hjl@valinux.com: Re: An ELF/PPC patch for ld/testsuite]


> Date: 19 Oct 2000 13:22:33 -0700
> From: Ian Lance Taylor <ian@zembu.com>

> I agree with every thing you say right up to ``and so this will not
> work.''  Yes, the case is dynamic.  But as far as I can tell, it is
> fully predictable by someone who knows which shared libraries are
> being loaded.  The reason to write code like this is precisely to
> permit late binding of foo.

Aah, I take it all back.  There is no such testcase in the testsuite.
All the failing testcases are covered by the other items I listed.

The case I was referring to above is something like this:

[geoffk@envy geoffk]$ head -20 t2.c t.c
==> t2.c <==
extern int foo(void) __attribute__((weak));
int main(void)
{
  if (&foo) return foo(); 
  return 0;
}

==> t.c <==
int foo(void)
{ return 1; }
[geoffk@envy geoffk]$ gcc -shared -fpic t.c -o t.so
[geoffk@envy geoffk]$ echo '' > t3.c
[geoffk@envy geoffk]$ gcc t2.c ./t.so -o t2
[geoffk@envy geoffk]$ ./t2 ; echo $?
1
[geoffk@envy geoffk]$ gcc -shared -fpic t3.c -o t.so
[geoffk@envy geoffk]$ ./t2 ; echo $?
Segmentation fault (core dumped)
139

it occurs only when the shared object seen by the application, and the
shared object seen by the linker, are different.
-- 
- Geoffrey Keating <geoffk@cygnus.com>

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