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

Unified Diff: build/standalone.gypi

Issue 1267773004: Port cfi configuration from chromium. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 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
« build/download_gold_plugin.py ('K') | « build/download_gold_plugin.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/standalone.gypi
diff --git a/build/standalone.gypi b/build/standalone.gypi
index f175ce004020251845964c3ad88b3517fcb9b459..3d81a16c00bcc8f48dfbbcb0dfbce8c7b7268042 100644
--- a/build/standalone.gypi
+++ b/build/standalone.gypi
@@ -88,6 +88,13 @@
'clang_dir%': '<(base_dir)/third_party/llvm-build/Release+Asserts',
+ 'use_lto%': 0,
+
+ # Control Flow Integrity for virtual calls and casts.
+ # See http://clang.llvm.org/docs/ControlFlowIntegrity.html
+ 'cfi_vptr%': 0,
+ 'cfi_diag%': 0,
+
# goma settings.
# 1 to use goma.
# If no gomadir is set, it uses the default gomadir.
@@ -105,6 +112,16 @@
}, {
'host_clang%': '0',
}],
+ # linux_use_bundled_gold: whether to use the gold linker binary checked
+ # into third_party/binutils. Force this off via GYP_DEFINES when you
+ # are using a custom toolchain and need to control -B in ldflags.
+ # Do not use 32-bit gold on 32-bit hosts as it runs out address space
+ # for component=static_library builds.
+ ['(OS=="linux" or OS=="android") and (target_arch=="x64" or target_arch=="arm" or (target_arch=="ia32" and host_arch=="x64"))', {
+ 'linux_use_bundled_gold%': 1,
+ }, {
+ 'linux_use_bundled_gold%': 0,
+ }],
],
},
'base_dir%': '<(base_dir)',
@@ -122,6 +139,10 @@
'tsan%': '<(tsan)',
'sanitizer_coverage%': '<(sanitizer_coverage)',
'use_custom_libcxx%': '<(use_custom_libcxx)',
+ 'linux_use_bundled_gold%': '<(linux_use_bundled_gold)',
+ 'use_lto%': '<(use_lto)',
+ 'cfi_vptr%': '<(cfi_vptr)',
+ 'cfi_diag%': '<(cfi_diag)',
# Add a simple extra solely for the purpose of the cctests
'v8_extra_library_files': ['../test/cctest/test-extra.js'],
@@ -207,6 +228,9 @@
# the C++ standard library is used.
'use_custom_libcxx%': 1,
}],
+ ['cfi_vptr==1', {
+ 'use_lto%': 1,
+ }],
['OS=="linux"', {
# Gradually roll out v8_use_external_startup_data.
# Should eventually be default enabled on all platforms.
@@ -535,6 +559,21 @@
}],
],
}],
+ ['linux_use_bundled_gold==1 and not (clang==0 and use_lto==1)', {
+ # Put our binutils, which contains gold in the search path. We pass
+ # the path to gold to the compiler. gyp leaves unspecified what the
+ # cwd is when running the compiler, so the normal gyp path-munging
+ # fails us. This hack gets the right path.
+ #
+ # Disabled when using GCC LTO because GCC also uses the -B search
+ # path at link time to find "as", and our bundled "as" can only
+ # target x86.
+ 'ldflags': [
+ # Note, Chromium allows ia32 host arch as well, we limit this to
+ # x64 in v8.
+ '-B<(base_dir)/third_party/binutils/Linux_x64/Release/bin',
+ ],
+ }],
],
},
}],
@@ -1144,5 +1183,100 @@
['CXX.host_wrapper', '<(gomadir)/gomacc'],
],
}],
+ ['use_lto==1', {
+ 'target_defaults': {
+ 'target_conditions': [
+ ['_toolset=="target"', {
+ 'cflags': [
+ '-flto',
+ ],
+ }],
+ ],
+ },
+ }],
+ ['use_lto==1 and clang==0', {
+ 'target_defaults': {
+ 'target_conditions': [
+ ['_toolset=="target"', {
+ 'cflags': [
+ '-ffat-lto-objects',
+ ],
+ }],
+ ],
+ },
+ }],
+ ['use_lto==1 and clang==1', {
+ 'target_defaults': {
+ 'target_conditions': [
+ ['_toolset=="target"', {
+ 'arflags': [
+ '--plugin', '<(clang_dir)/lib/LLVMgold.so',
+ ],
+ # Apply a lower optimization level with lto. Chromium does this
+ # for non-official builds only - a differentiation that doesn't
+ # exist in v8.
+ 'ldflags': [
+ '-Wl,--plugin-opt,O1',
+ ],
+ }],
+ ],
+ },
+ }],
+ ['use_lto==1 and clang==0', {
+ 'target_defaults': {
+ 'target_conditions': [
+ ['_toolset=="target"', {
+ 'ldflags': [
+ '-flto=32',
+ ],
+ }],
+ ],
+ },
+ }],
+ ['use_lto==1 and clang==1', {
+ 'target_defaults': {
+ 'target_conditions': [
+ ['_toolset=="target"', {
+ 'ldflags': [
+ '-flto',
+ ],
+ }],
+ ],
+ },
+ }],
+ ['cfi_diag==1', {
+ 'target_defaults': {
+ 'target_conditions': [
+ ['_toolset=="target"', {
+ 'cflags': [
+ '-fno-sanitize-trap=cfi',
+ '-fsanitize-recover=cfi',
+ ],
+ 'ldflags': [
+ '-fno-sanitize-trap=cfi',
+ '-fsanitize-recover=cfi',
+ ],
+ }],
+ ],
+ },
+ }],
+ ['cfi_vptr==1', {
+ 'target_defaults': {
+ 'target_conditions': [
+ ['_toolset=="target"', {
+ 'cflags': [
+ '-fsanitize=cfi-vcall',
+ '-fsanitize=cfi-derived-cast',
+ '-fsanitize=cfi-unrelated-cast',
+ ],
+ 'ldflags': [
+ '-fsanitize=cfi-vcall',
+ '-fsanitize=cfi-derived-cast',
+ '-fsanitize=cfi-unrelated-cast',
+ ],
+ }],
+ ],
+ },
+ }],
],
}
« build/download_gold_plugin.py ('K') | « build/download_gold_plugin.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698