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]
Other format: [Raw text]

Re: libc_hidden_proto breaks things for PowerPC64


On Tue, Aug 13, 2002 at 02:08:31PM -0500, Steve Munroe wrote:
> The use of the libc_hidden_proto macro when combined with the weak_alias
> macro results in  unresolved references in libc.so. For example.
> 
>    /work/usr/src/build-23/libc.so.6: undefined reference to `.__sysconf'
>    /work/usr/src/build-23/libc.so.6: undefined reference to `.__iswpunct_l'
>    /work/usr/src/build-23/libc.so.6: undefined reference to `.__gmtime_r'
>    /work/usr/src/build-23/libc.so.6: undefined reference to `.__iswgraph_l'
>    /work/usr/src/build-23/libc.so.6: undefined reference to `.
>    ____strtoul_l_internal'
>    ...
> 
> The problem seems to be the combination of libc_hidden_proto and weak_alias
> macros. For example ./sysdeps/posix/sysconf.c is externally defined by:
> 
>     libc_hidden_proto(__sysconf)
> 
> which generates the following:
> 
>    extern long int __sysconf (int __name);
>    extern __typeof (__sysconf) __GI___sysconf; extern __typeof (__sysconf)
>    __sysconf __asm__ ("" "__GI___sysconf") ;
> 
> When  ./sysdeps/posix/sysconf.c is compiled, this causes the symbol "
> __sysconf" to be replaced for symbol "__GI___sysconf" in the function
> prolog:
> 
>     .globl __GI___sysconf
>     .section ".opd","aw"
>     .align 3
>    __GI___sysconf:
>     .quad .__GI___sysconf,.TOC.@tocbase,0
>     .previous
>     .size __GI___sysconf,24
>     .type .__GI___sysconf,@function
>     .globl .__GI___sysconf
>    .__GI___sysconf:
> 
> But the weak_alias statement at the end of ./sysdeps/posix/sysconf.c
> 
>    weak_alias(__sysconf, sysconf)
> 
> generates:
> 
>    extern __typeof (__sysconf) sysconf __attribute__ ((weak, alias ("
>    __sysconf")));
> 
> which generates the following asm:
> 
>     .weak sysconf
>     .weak .sysconf
>     .set .sysconf,.__sysconf
>     .set sysconf,__sysconf

And what does libc_hidden_def generate for you?  You ought to be
getting something like:

 .globl __sysconf
 .set __sysconf,__GI___sysconf
 .globl .__sysconf
 .set .__sysconf,.__GI___sysconf

Ah, I see.  include/libc-sysmbols.h (__hidden_def1) doesn't have the
HAVE_ASM_GLOBAL_DOT_NAME case supported when HAVE_ASM_SET_DIRECTIVE.
I'll bet you haven't added support here as you did for all the
other macros.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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