diff options
author | H.J. Lu <hongjiu.lu@intel.com> | 2012-11-17 20:31:06 +0000 |
---|---|---|
committer | H.J. Lu <hjl@gcc.gnu.org> | 2012-11-17 12:31:06 -0800 |
commit | 7e8d1b2d1ef3ab73a6123b0fa5000e4675752d97 (patch) | |
tree | 2d820ab7aa3aa6203fee051f0c0d85dc991da942 /gcc/gcc.c | |
parent | 295d875ce02f75bf3485027a91642a2c31ab01e4 (diff) | |
download | gcc-7e8d1b2d1ef3ab73a6123b0fa5000e4675752d97.zip gcc-7e8d1b2d1ef3ab73a6123b0fa5000e4675752d97.tar.gz gcc-7e8d1b2d1ef3ab73a6123b0fa5000e4675752d97.tar.bz2 |
Add -static-libasan option to the GCC driver
* common.opt (static-libasan): New option.
* gcc.c (LIBASAN_SPEC): New macro.
(LINK_COMMAND_SPEC): Replace -lasan with LIBASAN_SPEC.
* doc/invoke.texi: Document -static-libasan.
From-SVN: r193589
Diffstat (limited to 'gcc/gcc.c')
-rw-r--r-- | gcc/gcc.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -544,6 +544,15 @@ proper position among the other output files. */ wrapping. */ #define STACK_SPLIT_SPEC " %{fsplit-stack: --wrap=pthread_create}" +#ifndef LIBASAN_SPEC +#ifdef HAVE_LD_STATIC_DYNAMIC +#define LIBASAN_SPEC "%{static-libasan:" LD_STATIC_OPTION \ + "} -lasan %{static-libasan:" LD_DYNAMIC_OPTION "}" +#else +#define LIBASAN_SPEC "-lasan" +#endif +#endif + /* config.h can define LIBGCC_SPEC to override how and when libgcc.a is included. */ #ifndef LIBGCC_SPEC @@ -687,7 +696,7 @@ proper position among the other output files. */ %{fgnu-tm:%:include(libitm.spec)%(link_itm)}\ %(mflib) " STACK_SPLIT_SPEC "\ %{fprofile-arcs|fprofile-generate*|coverage:-lgcov}\ - %{faddress-sanitizer:-lasan}\ + %{faddress-sanitizer:" LIBASAN_SPEC "}\ %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\ %{!nostdlib:%{!nostartfiles:%E}} %{T*} }}}}}}" #endif |