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

x86 Darwin an libgcc-math


<http://gcc.gnu.org/ml/gcc-patches/2006-02/msg00057.html>

With trunk and those set of patches, x86 Darwin bootstraps and builds libgcc-math. However, there are some issues actually using it:

alias:/tmp ssen$ cat test.c
#include <math.h>
#include <stdio.h>

int main(int argc, char *argv[]) {
  double a = 1.5900;
  printf("%f\n", sin(a));
  return 0;
}
alias:/tmp ssen$ /opt/gcc/bin/gcc -o test test.c -msselibm
/usr/bin/ld: Undefined symbols:
___libm_sse2_sin
collect2: ld returned 1 exit status
alias:/tmp ssen$

The problem appears to be that Darwin's specs override LINK_COMMAND_SPEC and don't include %(link_gcc_math). Something like this may be needed:
Index: config/darwin.h
===================================================================
--- config/darwin.h (revision 110474)
+++ config/darwin.h (working copy)
@@ -202,17 +202,17 @@
#define LINK_COMMAND_SPEC "\
%{!fdump=*:%{!fsyntax-only:%{!precomp:%{!c:%{!M:%{!MM:%{!E:%{!S:\
%{!Zdynamiclib:%(linker)}%{Zdynamiclib:/usr/bin/libtool} \
%l %X %{d} %{s} %{t} %{Z} \
%{!Zdynamiclib:%{A} %{e*} %{m} %{N} %{n} %{r} %{u*} %{x} %{z}} \
%{@:-o %f%u.out}%{!@:%{o*}%{!o:-o a.out}} \
%{!Zdynamiclib:%{!A:%{!nostdlib:%{!nostartfiles:%S}}}} \
%{L*} %(link_libgcc) %o %{fprofile-arcs|fprofile-generate| coverage:-lgcov} \
- %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %G %L}} \
+ %{!nostdlib:%{!nodefaultlibs:%(link_gcc_math) %(link_ssp) %G %L}} \
%{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} %{F*} }}}}}}}}"


/* Please keep the random linker options in alphabetical order (modulo
    'Z' and 'no' prefixes).  Options that can only go to one of libtool
    or ld must be listed twice, under both !Zdynamiclib and
    Zdynamiclib, with one of the cases reporting an error.  */
/* Note that options taking arguments may appear multiple times on a
    command line with different arguments each time, so put a * after


However, once you make that change:
alias:/tmp ssen$ /opt/gccmath-bootstrap/bin/gcc -o test test.c -msselibm
symbol ___isinf used from dynamic library /usr/lib/libSystem.dylib (xmm_misc.o) not from earlier dynamic library /opt/gccmath-bootstrap/ lib/libgcc-math.0.dylib(libsse2_la-s_isinf.o)
symbol ___isinff used from dynamic library /usr/lib/libSystem.dylib (xmm_misc.o) not from earlier dynamic library /opt/gccmath-bootstrap/ lib/libgcc-math.0.dylib(libsse2_la-s_isinff.o)
/usr/bin/ld: warning suggest use of -bind_at_load, as lazy binding may result in errors or different symbols being used
alias:/tmp ssen$


Is it intentional that these functions have global visibility and interfere with functions declared and implemented by the system libraries? If not, can they be compilied with hidden visibility?

Shantonu


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