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.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@177703
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2014-12-23 Alexey Proskuryakov <ap@apple.com>
+
+ 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.
+
2014-12-16 Carlos Garcia Campos <cgarcia@igalia.com>
Unreviewed. Update OptionsGTK.cmake and NEWS for 2.7.3 release.
endif
endif
+ifeq ($(ASAN),YES)
+ASAN_OPTION=--asan
+else
+ifeq ($(ASAN),NO)
+ASAN_OPTION=--no-asan
+endif
+endif
+
export DSYMUTIL_NUM_THREADS = $(shell sysctl -n hw.activecpu)
-all:
+all: set_asan_configuration
( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
debug d development dev develop: force
- $(SCRIPTS_PATH)/set-webkit-configuration --debug
+ $(SCRIPTS_PATH)/set-webkit-configuration --debug $(ASAN_OPTION)
( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
release r deployment dep deploy: force
- $(SCRIPTS_PATH)/set-webkit-configuration --release
+ $(SCRIPTS_PATH)/set-webkit-configuration --release $(ASAN_OPTION)
( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
analyze:
- $(SCRIPTS_PATH)/set-webkit-configuration --release
+ $(SCRIPTS_PATH)/set-webkit-configuration --release $(ASAN_OPTION)
ifndef PATH_TO_SCAN_BUILD
( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) RUN_CLANG_STATIC_ANALYZER=YES | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
else
( $(SET_COLOR_DIAGNOSTICS_ARG); $(PATH_TO_SCAN_BUILD) xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
endif
+set_asan_configuration:
+ifneq (,$(ASAN_OPTION))
+ $(SCRIPTS_PATH)/set-webkit-configuration $(ASAN_OPTION)
+endif
+
clean:
( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) -alltargets clean $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
+2014-12-23 Alexey Proskuryakov <ap@apple.com>
+
+ Simplify building with ASan
+ https://bugs.webkit.org/show_bug.cgi?id=139916
+
+ Reviewed by Mark Rowe.
+
+ * 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.
+
2014-12-23 Alexey Proskuryakov <ap@apple.com>
TestWebKitAPI build is broken when ASan is enabled
Usage: $programName [options]
--32-bit Set the default architecture to 32-bit
--64-bit Set the default architecture to 64-bit
+ --[no-]asan Enable or disable clang address sanitizer
--debug Set the default configuration to debug
--release Set the default configuration to release
--reset Reset configurations
my $configuration = passedConfiguration();
my $architecture = passedArchitecture();
+my $enableASAN = checkForArgumentAndRemoveFromARGV("--asan");
+my $disableASAN = checkForArgumentAndRemoveFromARGV("--no-asan");
if (!$architecture) {
# Handle --64-bit explicitly here, as we don't want our other scripts to accept it
if (checkForArgumentAndRemoveFromARGV("--reset")) {
unlink "$baseProductDir/Configuration";
unlink "$baseProductDir/Architecture";
+ unlink "$baseProductDir/ASan";
exit 0;
}
-if (!$configuration && !$architecture) {
+if (!$configuration && !$architecture && !$enableASAN && !$disableASAN || ($enableASAN && $disableASAN)) {
print STDERR $usage;
exit 1;
}
unlink "$baseProductDir/Architecture";
}
}
+
+if ($enableASAN) {
+ open ASAN, ">", "$baseProductDir/ASan" or die;
+ print ASAN "YES";
+ close ASAN;
+} elsif ($disableASAN) {
+ unlink "$baseProductDir/ASan";
+}
our @EXPORT_OK;
my $architecture;
+my $asanIsEnabled;
my $numberOfCPUs;
my $maxCPULoad;
my $baseProductDir;
$architecture = 'x86_64' if ($architecture =~ /amd64/ && isBSD());
}
+sub determineASanIsEnabled
+{
+ return if defined $asanIsEnabled;
+ determineBaseProductDir();
+
+ $asanIsEnabled = 0;
+ my $asanConfigurationValue;
+
+ if (open ASAN, "$baseProductDir/ASan") {
+ $asanConfigurationValue = <ASAN>;
+ close ASAN;
+ chomp $asanConfigurationValue;
+ $asanIsEnabled = 1 if $asanConfigurationValue eq "YES";
+ }
+}
+
sub determineNumberOfCPUs
{
return if defined $numberOfCPUs;
determineXcodeSDK();
my @args = ();
+ # FIXME: Is it necessary to pass --debug, --release, --32-bit or --64-bit?
+ # These are determined automatically from stored configuration.
push(@args, '--debug') if ($configuration =~ "^Debug");
push(@args, '--release') if ($configuration =~ "^Release");
push(@args, '--device') if (defined $xcodeSDK && $xcodeSDK =~ /^iphoneos/);
return $configuration;
}
+sub asanIsEnabled()
+{
+ determineASanIsEnabled();
+ return $asanIsEnabled;
+}
+
sub configurationForVisualStudio()
{
determineConfigurationForVisualStudio();
determineBaseProductDir();
determineConfiguration();
determineArchitecture();
+ determineASanIsEnabled();
determineXcodeSDK();
my @sdkOption = ($xcodeSDK ? "SDKROOT=$xcodeSDK" : ());
my @architectureOption = ($architecture ? "ARCHS=$architecture" : ());
+ my @asanOption = ($asanIsEnabled ? ("-xcconfig", sourceDir() . "/Tools/asan/asan.xcconfig", "ASAN_IGNORE=" . sourceDir() . "/Tools/asan/webkit-asan-ignore.txt") : ());
- return (@baseProductDirOption, "-configuration", $configuration, @architectureOption, @sdkOption, argumentsForXcode());
+ return (@baseProductDirOption, "-configuration", $configuration, @architectureOption, @sdkOption, @asanOption, argumentsForXcode());
}
sub XcodeOptionString
-GCC_TREAT_WARNINGS_AS_ERRORS = NO;
+TOOLCHAINS[sdk=iphone*] = $(TOOLCHAINS);
+TOOLCHAINS = $(TOOLCHAINS_$(PLATFORM_NAME)_$(MAC_OS_X_VERSION_MAJOR));
+TOOLCHAINS_macosx_1080 = default;
+TOOLCHAINS_macosx_1090 = default;
+TOOLCHAINS_macosx_101000 = default;
+TOOLCHAINS_macosx_101100 = $(TOOLCHAINS);
-ASAN_OTHER_CFLAGS = -fsanitize=address -O1 -fsanitize-blacklist=$(ASAN_IGNORE) -Wno-error -fno-omit-frame-pointer -g -DUSE_SYSTEM_MALLOC=1;
+ASAN_OTHER_CFLAGS = -fsanitize=address -O1 -fsanitize-blacklist=$(ASAN_IGNORE) -fno-omit-frame-pointer -g -DUSE_SYSTEM_MALLOC=1;
ASAN_OTHER_CPLUSPLUSFLAGS = $(ASAN_OTHER_CFLAGS);
-ASAN_OTHER_LDFLAGS = -fsanitize=address $(ASAN_OTHER_LDFLAGS_$(PLATFORM_NAME));
-ASAN_OTHER_LDFLAGS_macosx = -lclang_rt.asan_osx_dynamic;
-ASAN_OTHER_LDFLAGS_iphonesimulator = -lclang_rt.asan_iossim_dynamic;
+ASAN_OTHER_LDFLAGS = -fsanitize=address;
+
+GCC_ENABLE_OBJC_GC = NO;