From: Wei Mi Date: Wed, 21 Nov 2012 17:46:00 +0000 (+0000) Subject: common.opt: Change faddress-sanitizer to fsanitize=address. X-Git-Tag: releases/gcc-4.8.0~1858 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dde19676a42bf503b1a3ab3c901fc9d39740e569;p=thirdparty%2Fgcc.git common.opt: Change faddress-sanitizer to fsanitize=address. * common.opt: Change faddress-sanitizer to fsanitize=address. * toplev.c (process_options): Likewise. * gcc.c (LINK_COMMAND_SPEC): Likewise. * testsuite/lib/asan-dg.exp (check_effective_target_faddress_sanitizer): Likewise. (asan_init): Likewise. * doc/invoke.texi (-fsanitize=address): Document. From-SVN: r193702 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7853c37ff140..25dda30062c7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2012-11-21 Wei Mi + + * common.opt: Change faddress-sanitizer to fsanitize=address. + * toplev.c (process_options): Likewise. + * gcc.c (LINK_COMMAND_SPEC): Likewise. + * testsuite/lib/asan-dg.exp + (check_effective_target_faddress_sanitizer): Likewise. + (asan_init): Likewise. + * doc/invoke.texi (-fsanitize=address): Document. + 2012-11-21 Martin Jambor * ipa-prop.h (struct ipa_node_params): Rename clone_for_all_contexts to diff --git a/gcc/common.opt b/gcc/common.opt index be6fe4f35d2e..d3ad5ab588bc 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -840,7 +840,7 @@ fargument-noalias-anything Common Ignore Does nothing. Preserved for backward compatibility. -faddress-sanitizer +fsanitize=address Common Report Var(flag_asan) Enable AddressSanitizer, a memory error detector diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 885bf66c1a69..a1c59f005c89 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -289,7 +289,8 @@ Objective-C and Objective-C++ Dialects}. @item Debugging Options @xref{Debugging Options,,Options for Debugging Your Program or GCC}. @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol --faddress-sanitizer -fdbg-cnt-list -fdbg-cnt=@var{counter-value-list} @gol +-fsanitize=@var{style} @gol +-fdbg-cnt-list -fdbg-cnt=@var{counter-value-list} @gol -fdisable-ipa-@var{pass_name} @gol -fdisable-rtl-@var{pass_name} @gol -fdisable-rtl-@var{pass-name}=@var{range-list} @gol @@ -6855,7 +6856,7 @@ assumptions based on that. The default is @option{-fzero-initialized-in-bss}. -@item -faddress-sanitizer +@item -fsanitize=address Enable AddressSanitizer, a fast memory error detector. Memory access instructions will be instrumented to detect out-of-bounds and use-after-free bugs. So far only heap bugs will be detected. @@ -9938,7 +9939,7 @@ for the languages used in the program, or using the option @file{libgcc}. @item -static-libasan -When the @option{-faddress-sanitizer} option is used to link a program, +When the @option{-fsanitize=address} option is used to link a program, the GCC driver automatically links against @option{libasan}. If @file{libasan} is available as a shared library, and the @option{-static} option is not used, then this links against the shared version of diff --git a/gcc/gcc.c b/gcc/gcc.c index 3d515665f7ac..0f8bcea81ded 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -696,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:" LIBASAN_SPEC "}\ + %{fsanitize=address:" LIBASAN_SPEC "}\ %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\ %{!nostdlib:%{!nostartfiles:%E}} %{T*} }}}}}}" #endif diff --git a/gcc/testsuite/lib/asan-dg.exp b/gcc/testsuite/lib/asan-dg.exp index b58a91f50e3b..9a435d2dc0c1 100644 --- a/gcc/testsuite/lib/asan-dg.exp +++ b/gcc/testsuite/lib/asan-dg.exp @@ -14,13 +14,13 @@ # along with GCC; see the file COPYING3. If not see # . -# Return 1 if compilation with -faddress-sanitizer is error-free for trivial +# Return 1 if compilation with -fsanitize=address is error-free for trivial # code, 0 otherwise. proc check_effective_target_faddress_sanitizer {} { return [check_no_compiler_messages faddress_sanitizer object { void foo (void) { } - } "-faddress-sanitizer"] + } "-fsanitize=address"] } # @@ -83,12 +83,12 @@ proc asan_init { args } { } if [info exists ALWAYS_CXXFLAGS] { set ALWAYS_CXXFLAGS [concat "{ldflags=$link_flags}" $ALWAYS_CXXFLAGS] - set ALWAYS_CXXFLAGS [concat "{additional_flags=-faddress-sanitizer -g}" $ALWAYS_CXXFLAGS] + set ALWAYS_CXXFLAGS [concat "{additional_flags=-fsanitize=address -g}" $ALWAYS_CXXFLAGS] } else { if [info exists TEST_ALWAYS_FLAGS] { - set TEST_ALWAYS_FLAGS "$link_flags -faddress-sanitizer -g $TEST_ALWAYS_FLAGS" + set TEST_ALWAYS_FLAGS "$link_flags -fsanitize=address -g $TEST_ALWAYS_FLAGS" } else { - set TEST_ALWAYS_FLAGS "$link_flags -faddress-sanitizer -g" + set TEST_ALWAYS_FLAGS "$link_flags -fsanitize=address -g" } } } diff --git a/gcc/toplev.c b/gcc/toplev.c index f7e20998069c..fcdbd1aea546 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1549,7 +1549,7 @@ process_options (void) && (targetm.asan_shadow_offset == NULL || !FRAME_GROWS_DOWNWARD)) { - warning (0, "-faddress-sanitizer not supported for this target"); + warning (0, "-fsanitize=address not supported for this target"); flag_asan = 0; }