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]

[PATCH][Revisedx5] Enable libsanitizer on darwin


   The attached patch imports the missing mach_override/mach_override.h and
mach_override/mach_override.c files from llvm.org's compiler-rt at 

r168032 | glider | 2012-11-15 03:32:16 -0500 (Thu, 15 Nov 2012) | 3 lines

[ASan] Add the "lea $imm(%rip),%rax" instruction to mach_override.c
The need for this has been reported by Jack Howarth (howarth@bromo.med.uc.edu) who's porting ASan-Darwin to GCC

The patch adds darwin to the supported target list in configure.tgt and 
defines USING_MACH_OVERRIDE for darwin in configure.ac. The definition of 
USING_MACH_OVERRIDE is used in Makefile.am as the test for appending
mach_override/mach_override.c to libinterception_la_SOURCES. LINK_COMMAND_SPEC_A 
in gcc/config/darwin.h is modified to add an entry to handle fsanitize=address
so that the required linkages are used for libasan. The static linkage of libasan.a
in LINK_COMMAND_SPEC_A is handle separately for -static-libstdc++ (which requires
libstdc++.a) and the -static, -static-gcc and -static-gfortran cases. Tested at rr193756
on x86_64-apple-darwin12 for both -m32 and -m64 with the both use-after-free.c testcase 
and...

 make -k check RUNTESTFLAGS="asan.exp --target_board=unix'{-m32,-m64}'"

without regressions.
              Jack
ps This version adds the requested importation of the LICENSE.txt file from llvm.org's
compiler-rt in interception/mach_override. It also sets TSAN_SUPPORTED=no in configure.tgt
for the 'x86_64-*-darwin* | i?86-*-darwin*' case to avoid building tsan support.

Attachment: asan_v9.diff
Description: Text document


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