http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55289
--- Comment #41 from Jack Howarth <howarth at nitro dot med.uc.edu> 2012-11-15
13:51:11 UTC ---
I will also post a small patch to gcc-patches to allow darwin to automatically
pass the required linker flags on the link spec in darwin.h...
ndex: gcc/config/darwin.h
===================================================================
--- gcc/config/darwin.h (revision 193503)
+++ gcc/config/darwin.h (working copy)
@@ -180,6 +180,8 @@ extern GTY(()) int darwin_ms_struct;
%{L*} %(link_libgcc) %o
%{fprofile-arcs|fprofile-generate*|coverage:-lgcov} \
%{fopenmp|ftree-parallelize-loops=*: \
%{static|static-libgcc|static-libstdc++|static-libgfortran: libgomp.a%s;
: -lgomp } } \
+ %{faddress-sanitizer: \
+ %{static|static-libgcc|static-libstdc++|static-libgfortran: -framework
CoreFoundation libasan.a%s; : -framework CoreFoundation -lasan } } \
%{fgnu-tm: \
%{static|static-libgcc|static-libstdc++|static-libgfortran: libitm.a%s;
: -litm } } \
%{!nostdlib:%{!nodefaultlibs:\
It works fine for the dynamic linkage although we do seem to have an issue with
the static libasan.a that will require a new PR to be opened...
% gcc-fsf-4.8 -faddress-sanitizer -O1 -fno-omit-frame-pointer -static-libgcc
-g -o use-after-free use-after-free.c
Undefined symbols for architecture x86_64:
"___cxa_throw", referenced from:
__asan::InitializeAsanInterceptors() in
libasan.a(asan_interceptors.o)
(maybe you meant: __interception::real___cxa_throw, _wrap___cxa_throw )
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
However I don't see that as a blocker to getting libsanitizer building on intel
darwin.