diff options
author | Andreas Tobler <andreast@gcc.gnu.org> | 2020-05-01 09:04:01 +0200 |
---|---|---|
committer | Andreas Tobler <andreast@gcc.gnu.org> | 2020-05-01 17:18:47 +0200 |
commit | d730fd95eebaecad8e26f9e089c7df4630e94f1c (patch) | |
tree | 8cf46989a075ad91f0be9d2eb137882a5c3a9d0a /gcc/config/freebsd.h | |
parent | bf1dde9790d304188b10228c24a448fa454ed7b0 (diff) | |
download | gcc-d730fd95eebaecad8e26f9e089c7df4630e94f1c.zip gcc-d730fd95eebaecad8e26f9e089c7df4630e94f1c.tar.gz gcc-d730fd95eebaecad8e26f9e089c7df4630e94f1c.tar.bz2 |
gcc: Enable bits for sanitizer support on FreeBSD x86_64
This patch add the necessary bits to suport libasan on FreeBSD x86_64.
gcc
* config/i386/i386.h: Define a new macro: SUBTARGET_SHADOW_OFFSET.
* config/i386/i386.c (ix86_asan_shadow_offset): Use this macro.
* config/i386/darwin.h: Override the SUBTARGET_SHADOW_OFFSET macro.
* config/i386/freebsd.h: Likewise.
* config/freebsd.h (LIBASAN_EARLY_SPEC): Define.
LIBTSAN_EARLY_SPEC): Likewise. (LIBLSAN_EARLY_SPEC): Likewise.
libsanitizer:
* configure.tgt: Add x86_64- and i?86-*-freebsd* targets.
Diffstat (limited to 'gcc/config/freebsd.h')
-rw-r--r-- | gcc/config/freebsd.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/config/freebsd.h b/gcc/config/freebsd.h index d9d6be7..4b5140b 100644 --- a/gcc/config/freebsd.h +++ b/gcc/config/freebsd.h @@ -62,6 +62,27 @@ along with GCC; see the file COPYING3. If not see #define USE_LD_AS_NEEDED 1 #endif +/* Link -lasan early on the command line. For -static-libasan, don't link + it for -shared link, the executable should be compiled with -static-libasan + in that case, and for executable link with --{,no-}whole-archive around + it to force everything into the executable. And similarly for -ltsan + and -llsan. */ +#if defined(HAVE_LD_STATIC_DYNAMIC) +#undef LIBASAN_EARLY_SPEC +#define LIBASAN_EARLY_SPEC "%{!shared:libasan_preinit%O%s} " \ + "%{static-libasan:%{!shared:" \ + LD_STATIC_OPTION " --whole-archive -lasan --no-whole-archive " \ + LD_DYNAMIC_OPTION "}}%{!static-libasan:-lasan -lpthread}" +#undef LIBTSAN_EARLY_SPEC +#define LIBTSAN_EARLY_SPEC "%{static-libtsan:%{!shared:" \ + LD_STATIC_OPTION " --whole-archive -ltsan --no-whole-archive " \ + LD_DYNAMIC_OPTION "}}%{!static-libtsan:-ltsan -lpthread}" +#undef LIBLSAN_EARLY_SPEC +#define LIBLSAN_EARLY_SPEC "%{static-liblsan:%{!shared:" \ + LD_STATIC_OPTION " --whole-archive -llsan --no-whole-archive " \ + LD_DYNAMIC_OPTION "}}%{!static-liblsan:-llsan -lpthread}" +#endif + /************************[ Target stuff ]***********************************/ /* All FreeBSD Architectures support the ELF object file format. */ |