This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: powerpc64 linux dot symbols


On Fri, Aug 13, 2004 at 08:38:47AM -0400, Jakub Jelinek wrote:
> On Tue, Aug 10, 2004 at 08:01:41PM +0930, Alan Modra wrote:
> > --- gcc/configure.ac	23 Jul 2004 06:59:34 -0000	2.50
> > +++ gcc/configure.ac	9 Aug 2004 23:52:02 -0000
> > @@ -2857,6 +2857,47 @@ if test x"$gcc_cv_ld_as_needed" = xyes; 
> >  [Define if your linker supports --as-needed and --no-as-needed options.])
> >  fi
> >  
> > +case "$target" in
> > +  powerpc64*-*-linux*)
> > +    AC_CACHE_CHECK(linker support for omitting dot symbols,
> > +    gcc_cv_ld_no_dot_syms,
> > +    [gcc_cv_ld_no_dot_syms=no
> > +    if test $in_tree_ld = yes ; then
> > +      if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 16 -o "$gcc_cv_gld_major_version" -gt 2; then
> > +        gcc_cv_ld_no_dot_syms=yes
> > +      fi
> > +    elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x ; then
> > +      cat > conftest1.s <<EOF
> > +	.text
> > +	bl foo
> > +EOF
> > +      cat > conftest2.s <<EOF
> > +	.section ".opd","aw"
> > +	.align 3
> > +	.globl foo
> > +	.type foo,@function
> > +foo:
> > +	.quad .LEfoo,.TOC.@tocbase,0
> > +	.text
> > +.LEfoo:
> > +	blr
> > +	.size foo,.-.LEfoo
> > +EOF
> > +      if $gcc_cv_as -o conftest1.o conftest1.s > /dev/null 2>&1 \
> > +         && $gcc_cv_as -o conftest2.o conftest2.s > /dev/null 2>&1 \
> > +         && $gcc_cv_ld -o conftest conftest1.o conftest2.o > /dev/null 2>&1; then
> > +        gcc_cv_ld_no_dot_syms=yes
> > +      fi
> 
> The configure test is bad, as it signals gcc_cv_ld_no_dot_syms yes even
> if the linker doesn't support omitting the dot symbols.
> With current linker it will branch to .LEfoo, with old linker it will
> happily jump into the .opd section.

Duh.  Use "bl .foo" instead.

> What you perhaps could do is if it successfully links:
> && $gcc_cv_ld -melf64ppc -o conftest conftest1.o conftest2.o > /dev/null 2>&1
> && $gcc_cv_objdump -d -j .text conftest | grep '48 00 00 05' > /dev/null; then
> 
> (.LEfoo will immediately follow bl foo and if binutils are with your
> patchset, this will thus be branch to the next instruction, while without it
> it will branch somewhere else).
> 
> Also, $gcc_cv_as should probably use -a64.

Yes, good idea, and ld should use -melf64ppc.

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