This is the mail archive of the glibc-bugs@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]

[Bug math/987] New: Cannot override libm's tan() while static linking


While compiling a simple test case that overrides libm's tan() (but not tanl()),
I get the linker error "multiple definition of tan" when static linking.  This
fails for both powerpc-linux and powerpc64-linux apps.

linux% cat tan.c 
double tan(double d) {return d;}
extern long double tanl(long double);

int main (void)
{
    return (int)tan(1.0) + (int)tanl((long double)1.0);
}

linux% gcc -static tan.c -lm
/usr/lib/gcc-lib/powerpc-suse-linux/3.3.3/../../../../lib/libm.a(s_tan.o)(.text+0x48):
In function `tan':
../sysdeps/ieee754/dbl-64/s_tan.c:45: multiple definition of `tan'
/tmp/cczeeiYk.o(.text+0x0): first defined here
/usr/lib/gcc-lib/powerpc-suse-linux/3.3.3/../../../../powerpc-suse-linux/bin/ld:
Warning: size of symbol `tan' changed from 40 in /tmp/cczeeiYk.o to 17444 in
/usr/lib/gcc-lib/powerpc-suse-linux/3.3.3/../../../../lib/libm.a(s_tan.o)
collect2: ld returned 1 exit status

This seems to be a problem with tan not being a weak alias to __tan similar to
the other math routines.  A similar problem also afflicts atan/atanl.

This does work on x86-linux, where tan is a weak alias to __tan.

-- 
           Summary: Cannot override libm's tan() while static linking
           Product: glibc
           Version: 2.3.3
            Status: NEW
          Severity: normal
          Priority: P2
         Component: math
        AssignedTo: aj at suse dot de
        ReportedBy: bergner at vnet dot ibm dot com
                CC: glibc-bugs at sources dot redhat dot com
 GCC build triplet: powerpc-linux
  GCC host triplet: powerpc-linux
GCC target triplet: powerpc-linux


http://sources.redhat.com/bugzilla/show_bug.cgi?id=987

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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