This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


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

Re: Versioning mess proved!!!


> Cc: Franz.Sirl-kernel@lauterbach.com, philb@gnu.org, howarth@fuse.net,
>         libc-alpha@sourceware.cygnus.com, aj@suse.de
> Reply-To: drepper@cygnus.com (Ulrich Drepper)
> From: Ulrich Drepper <drepper@redhat.com>
> Date: 01 Oct 2000 22:20:33 -0700
> User-Agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Capitol Reef)
> 
> Geoff Keating <geoffk@cygnus.com> writes:
> 
> > To fix this, the do_lookup routines in libc/elf/do-lookup.h need to be
> > changed so that if this condition has not triggered:
> > 
> > 	  if (sym->st_value == 0 || /* No value.  */
> > 	      (noplt && sym->st_shndx == SHN_UNDEF))
> > 	    continue;
> 
> I don't like this a bit.  This is a hack to work around a problem.  It
> seems to me that the PPC linker is broken.  It works on other
> architectures and such a test is just adding unnecessary work.

Actually, weak symbols don't work at all in executables on x86, which
is probably why x86 doesn't see this problem.

Try this in bash:

cat > tA.c <<END
extern void foo(void) __attribute__((weak));

int main(void)
{
  printf ("%p\n", &foo);
  if (&foo)
    foo();
  return 0;
}
END
cat > tB.c <<END
void foo(void)
{
  printf ("foo\n");
}
END
gcc tA.c -o tA
gcc -fpic -shared tB.c -o tB.so
LD_PRELOAD=./tB.so ./tA

you will see that (at least on my Red Hat 7 box thief) it prints
(nil)
despite foo() being defined.  It doesn't matter if the executable is
compiled with -fpic or not.

-- 
- 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]