Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Unified Diff: third_party/instrumented_libraries/BUILD.gn

Issue 1150193002: GN: Add support for prebuilt instrumented libraries. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/instrumented_libraries/BUILD.gn
diff --git a/third_party/instrumented_libraries/BUILD.gn b/third_party/instrumented_libraries/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..70b25d67949ac09340361c2adedaceecdb8f5fa0
--- /dev/null
+++ b/third_party/instrumented_libraries/BUILD.gn
@@ -0,0 +1,63 @@
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//build/config/sanitizers/sanitizers.gni")
+
+prebuilt_available =
+ is_msan && (msan_track_origins == 0 || msan_track_origins == 2)
+
+group("deps") {
+ if (use_prebuilt_instrumented_libraries) {
+ assert(prebuilt_available,
+ "Prebuilt instrumented libraries are only available when " +
+ "is_msan = true and msan_track_origins = {0, 2}")
+ deps = [
+ ":prebuilt",
+ ]
+ }
+}
+
+if (prebuilt_available) {
+ group("prebuilt") {
+ visibility = [ ":deps" ]
+ public_configs = [ ":prebuilt_link_helper" ]
+ deps = [
+ ":extract_prebuilt_instrumented_libraries",
earthdok 2015/05/28 18:27:46 You have to download the archive before you can ex
Sam McNally 2015/05/29 08:33:00 This assumes that hook would still download the ar
earthdok 2015/05/29 15:28:03 You're probably aware of this, but just in case, I
+ ]
+ }
+
+ if (is_msan) {
+ sanitizer_type = "msan"
+ if (msan_track_origins == 0) {
+ archive_name = "msan-no-origins"
+ } else if (msan_track_origins == 2) {
+ archive_name = "msan-chained-origins"
+ }
+ }
+
+ action("extract_prebuilt_instrumented_libraries") {
+ visibility = [ ":prebuilt" ]
+ script = "scripts/unpack_binaries.py"
+ depfile = "$target_out_dir/$archive_name.d"
+ args = [
+ archive_name,
+ rebase_path("binaries"),
+ rebase_path(root_build_dir + "/instrumented_libraries_prebuilt"),
+ rebase_path(target_out_dir, root_build_dir),
+ ]
+ outputs = [
+ "$target_out_dir/$archive_name.txt",
earthdok 2015/05/28 18:27:46 The stamp file no longer references the Ubuntu rel
Sam McNally 2015/05/29 08:33:00 I don't think we can detect this unless ninja can
earthdok 2015/05/29 15:28:03 Ninja doesn't rerun GYP either, but GYP would at l
Sam McNally 2015/06/01 01:05:15 Done.
+ ]
+ }
+
+ config("prebuilt_link_helper") {
+ visibility = [ ":prebuilt" ]
+ ldflags = [
+ # Add a relative RPATH entry to Chromium binaries. This puts instrumented
+ # DSOs before system-installed versions in library search path.
+ "-Wl,-R,\$ORIGIN/instrumented_libraries_prebuilt/$sanitizer_type/lib",
+ "-Wl,-z,origin",
+ ]
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698