Changeset 177703 in webkit


Ignore:
Timestamp:
Dec 23, 2014 4:13:16 PM (9 years ago)
Author:
ap@apple.com
Message:

Simplify building with ASan
https://bugs.webkit.org/show_bug.cgi?id=139916

Reviewed by Mark Rowe.

.:

  • Makefile.shared: Invoke set-webkit-configuration to store ASan choice as appropriate.

Tools:

  • Scripts/set-webkit-configuration: Store ASan state into a new configuration file.

We could also update Configuration file format, but that's a little scary because
of how many places in code read it.

  • Scripts/webkitdirs.pm:

(determineASanIsEnabled): Read it from ASan configuration file.
(argumentsForConfiguration): Added a FIXME.
(asanIsEnabled): A caching wrapper similar to what we have for other configuration options.
(XcodeOptions): Pass the options needed for ASan.

  • asan/asan.xcconfig: Use the right toolchains. Made warnings fatal again, as there

no warnings to avoid. Removed explicit linking options, as -fsanitize=address does
that automatically.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r177358 r177703  
     12014-12-23  Alexey Proskuryakov  <ap@apple.com>
     2
     3        Simplify building with ASan
     4        https://bugs.webkit.org/show_bug.cgi?id=139916
     5
     6        Reviewed by Mark Rowe.
     7
     8        * Makefile.shared: Invoke set-webkit-configuration to store ASan choice as appropriate.
     9
    1102014-12-16  Carlos Garcia Campos  <cgarcia@igalia.com>
    211
  • trunk/Makefile.shared

    r172186 r177703  
    2626endif
    2727
     28ifeq ($(ASAN),YES)
     29ASAN_OPTION=--asan
     30else
     31ifeq ($(ASAN),NO)
     32ASAN_OPTION=--no-asan
     33endif
     34endif
     35
    2836export DSYMUTIL_NUM_THREADS = $(shell sysctl -n hw.activecpu)
    2937
    30 all:
     38all: set_asan_configuration
    3139        ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
    3240
    3341debug d development dev develop: force
    34         $(SCRIPTS_PATH)/set-webkit-configuration --debug
     42        $(SCRIPTS_PATH)/set-webkit-configuration --debug $(ASAN_OPTION)
    3543        ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
    3644
    3745release r deployment dep deploy: force
    38         $(SCRIPTS_PATH)/set-webkit-configuration --release
     46        $(SCRIPTS_PATH)/set-webkit-configuration --release $(ASAN_OPTION)
    3947        ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
    4048
    4149analyze:
    42         $(SCRIPTS_PATH)/set-webkit-configuration --release
     50        $(SCRIPTS_PATH)/set-webkit-configuration --release $(ASAN_OPTION)
    4351ifndef PATH_TO_SCAN_BUILD
    4452        ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) RUN_CLANG_STATIC_ANALYZER=YES | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
     
    4755endif
    4856
     57set_asan_configuration:
     58ifneq (,$(ASAN_OPTION))
     59        $(SCRIPTS_PATH)/set-webkit-configuration $(ASAN_OPTION)
     60endif
     61
    4962clean:
    5063        ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) -alltargets clean $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
  • trunk/Tools/ChangeLog

    r177690 r177703  
     12014-12-23  Alexey Proskuryakov  <ap@apple.com>
     2
     3        Simplify building with ASan
     4        https://bugs.webkit.org/show_bug.cgi?id=139916
     5
     6        Reviewed by Mark Rowe.
     7
     8        * Scripts/set-webkit-configuration: Store ASan state into a new configuration file.
     9        We could also update Configuration file format, but that's a little scary because
     10        of how many places in code read it.
     11
     12        * Scripts/webkitdirs.pm:
     13        (determineASanIsEnabled): Read it from ASan configuration file.
     14        (argumentsForConfiguration): Added a FIXME.
     15        (asanIsEnabled): A caching wrapper similar to what we have for other configuration options.
     16        (XcodeOptions): Pass the options needed for ASan.
     17
     18        * asan/asan.xcconfig: Use the right toolchains. Made warnings fatal again, as there
     19        no warnings to avoid. Removed explicit linking options, as -fsanitize=address does
     20        that automatically.
     21
    1222014-12-23  Alexey Proskuryakov  <ap@apple.com>
    223
  • trunk/Tools/Scripts/set-webkit-configuration

    r165816 r177703  
    3737  --32-bit                Set the default architecture to 32-bit
    3838  --64-bit                Set the default architecture to 64-bit
     39  --[no-]asan             Enable or disable clang address sanitizer
    3940  --debug                 Set the default configuration to debug
    4041  --release               Set the default configuration to release
     
    4445my $configuration = passedConfiguration();
    4546my $architecture = passedArchitecture();
     47my $enableASAN = checkForArgumentAndRemoveFromARGV("--asan");
     48my $disableASAN = checkForArgumentAndRemoveFromARGV("--no-asan");
    4649
    4750if (!$architecture) {
     
    6265    unlink "$baseProductDir/Configuration";
    6366    unlink "$baseProductDir/Architecture";
     67    unlink "$baseProductDir/ASan";
    6468    exit 0;
    6569}
    6670
    67 if (!$configuration && !$architecture) {
     71if (!$configuration && !$architecture && !$enableASAN && !$disableASAN || ($enableASAN && $disableASAN)) {
    6872    print STDERR $usage;
    6973    exit 1;
     
    8589    }
    8690}
     91
     92if ($enableASAN) {
     93    open ASAN, ">", "$baseProductDir/ASan" or die;
     94    print ASAN "YES";
     95    close ASAN;
     96} elsif ($disableASAN) {
     97    unlink "$baseProductDir/ASan";
     98}
  • trunk/Tools/Scripts/webkitdirs.pm

    r175555 r177703  
    9191
    9292my $architecture;
     93my $asanIsEnabled;
    9394my $numberOfCPUs;
    9495my $maxCPULoad;
     
    348349}
    349350
     351sub determineASanIsEnabled
     352{
     353    return if defined $asanIsEnabled;
     354    determineBaseProductDir();
     355
     356    $asanIsEnabled = 0;
     357    my $asanConfigurationValue;
     358
     359    if (open ASAN, "$baseProductDir/ASan") {
     360        $asanConfigurationValue = <ASAN>;
     361        close ASAN;
     362        chomp $asanConfigurationValue;
     363        $asanIsEnabled = 1 if $asanConfigurationValue eq "YES";
     364    }
     365}
     366
    350367sub determineNumberOfCPUs
    351368{
     
    393410
    394411    my @args = ();
     412    # FIXME: Is it necessary to pass --debug, --release, --32-bit or --64-bit?
     413    # These are determined automatically from stored configuration.
    395414    push(@args, '--debug') if ($configuration =~ "^Debug");
    396415    push(@args, '--release') if ($configuration =~ "^Release");
     
    589608}
    590609
     610sub asanIsEnabled()
     611{
     612    determineASanIsEnabled();
     613    return $asanIsEnabled;
     614}
     615
    591616sub configurationForVisualStudio()
    592617{
     
    625650    determineConfiguration();
    626651    determineArchitecture();
     652    determineASanIsEnabled();
    627653    determineXcodeSDK();
    628654
    629655    my @sdkOption = ($xcodeSDK ? "SDKROOT=$xcodeSDK" : ());
    630656    my @architectureOption = ($architecture ? "ARCHS=$architecture" : ());
    631 
    632     return (@baseProductDirOption, "-configuration", $configuration, @architectureOption, @sdkOption, argumentsForXcode());
     657    my @asanOption = ($asanIsEnabled ? ("-xcconfig", sourceDir() . "/Tools/asan/asan.xcconfig", "ASAN_IGNORE=" . sourceDir() . "/Tools/asan/webkit-asan-ignore.txt") : ());
     658
     659    return (@baseProductDirOption, "-configuration", $configuration, @architectureOption, @sdkOption, @asanOption, argumentsForXcode());
    633660}
    634661
  • trunk/Tools/asan/asan.xcconfig

    r174290 r177703  
    1 GCC_TREAT_WARNINGS_AS_ERRORS = NO;
     1TOOLCHAINS[sdk=iphone*] = $(TOOLCHAINS);
     2TOOLCHAINS = $(TOOLCHAINS_$(PLATFORM_NAME)_$(MAC_OS_X_VERSION_MAJOR));
     3TOOLCHAINS_macosx_1080 = default;
     4TOOLCHAINS_macosx_1090 = default;
     5TOOLCHAINS_macosx_101000 = default;
     6TOOLCHAINS_macosx_101100 = $(TOOLCHAINS);
    27
    3 ASAN_OTHER_CFLAGS = -fsanitize=address -O1 -fsanitize-blacklist=$(ASAN_IGNORE) -Wno-error -fno-omit-frame-pointer -g -DUSE_SYSTEM_MALLOC=1;
     8ASAN_OTHER_CFLAGS = -fsanitize=address -O1 -fsanitize-blacklist=$(ASAN_IGNORE) -fno-omit-frame-pointer -g -DUSE_SYSTEM_MALLOC=1;
    49ASAN_OTHER_CPLUSPLUSFLAGS = $(ASAN_OTHER_CFLAGS);
    5 ASAN_OTHER_LDFLAGS = -fsanitize=address $(ASAN_OTHER_LDFLAGS_$(PLATFORM_NAME));
    6 ASAN_OTHER_LDFLAGS_macosx = -lclang_rt.asan_osx_dynamic;
    7 ASAN_OTHER_LDFLAGS_iphonesimulator = -lclang_rt.asan_iossim_dynamic;
     10ASAN_OTHER_LDFLAGS = -fsanitize=address;
     11
     12GCC_ENABLE_OBJC_GC = NO;
Note: See TracChangeset for help on using the changeset viewer.