Chromium Code Reviews| Index: build/untrusted.gypi |
| diff --git a/build/untrusted.gypi b/build/untrusted.gypi |
| index 77b9f11fb2114242e705a59d1ef9ca94f8fa2fdc..fdaff139a98715e30c5d67df010c04867bc60902 100755 |
| --- a/build/untrusted.gypi |
| +++ b/build/untrusted.gypi |
| @@ -130,7 +130,7 @@ |
| # X86-32 IRT needs to be callable with an under-aligned stack so we |
| # disable SSE instructions, which can fault on misaligned addresses: |
| # see https://code.google.com/p/nativeclient/issues/detail?id=3935 |
| - 'irt_flags_x86_32': '-Wt,-mattr=-sse', |
| + 'irt_flags_x86_32': '-mstackrealign -mno-sse', |
| }, |
| }, |
| }], |
| @@ -333,7 +333,7 @@ |
| '>@(extra_deps)', |
| '>@(extra_deps_newlib64)', |
| '^(source_list_newlib64)', |
| - '<(DEPTH)/native_client/toolchain/<(TOOLCHAIN_OS)_x86/nacl_x86_newlib/nacl_x86_newlib.json', |
| + '<(DEPTH)/native_client/toolchain/<(TOOLCHAIN_OS)_x86/pnacl_newlib/pnacl_newlib.json', |
| '<(PRODUCT_DIR)/tls_edit<(EXECUTABLE_SUFFIX)', |
| ], |
| 'outputs': ['>(out_newlib64)'], |
| @@ -341,14 +341,14 @@ |
| '<@(common_args)', |
| '>@(extra_args)', |
| '--arch', 'x86-64', |
| - '--build', 'newlib_nexe_pnacl', |
| + '--build', 'newlib_nexe_clang', |
| '--name', '>(out_newlib64)', |
| '--objdir', '>(objdir_newlib64)', |
| '--include-dirs=>(tc_include_dir_newlib) ^(include_dirs) >(_include_dirs)', |
| - '--compile_flags=--target=x86_64-unknown-nacl ^(compile_flags) >(_compile_flags) -gline-tables-only ^(pnacl_compile_flags) >(_pnacl_compile_flags)', |
| + '--compile_flags=^(pnacl_compile_flags) >(_pnacl_compile_flags) ^(native_irt_compile_flags) ^(clang_irt_compile_flags)', |
| '--gomadir', '<(gomadir)', |
| '--defines=^(defines) >(_defines)', |
| - '--link_flags=--target=x86_64-unknown-nacl -arch x86-64 --pnacl-allow-translate --pnacl-allow-native -B>(tc_lib_dir_irt64) -L>(tc_lib_dir_irt64) ^(pnacl_irt_link_flags) ^(link_flags) >(_link_flags) >(libcpp_irt_stdlibs)', |
| + '--link_flags=-B>(tc_lib_dir_irt64) -L>(tc_lib_dir_irt64) ^(link_flags) >(_link_flags) ^(native_irt_link_flags) >(libcpp_irt_stdlibs)', |
| '--source-list=^(source_list_newlib64)', |
| '--tls-edit=<(PRODUCT_DIR)/tls_edit<(EXECUTABLE_SUFFIX)', |
| '--irt-linker=<(DEPTH)/native_client/build/link_irt.py', |
| @@ -377,21 +377,21 @@ |
| '>@(extra_deps)', |
| '>@(extra_deps_newlib64)', |
| '^(source_list_newlib64)', |
| - '<(DEPTH)/native_client/toolchain/<(TOOLCHAIN_OS)_x86/nacl_x86_newlib/nacl_x86_newlib.json', |
| + '<(DEPTH)/native_client/toolchain/<(TOOLCHAIN_OS)_x86/pnacl_newlib/pnacl_newlib.json', |
| ], |
| 'outputs': ['>(out_newlib64)'], |
| 'action': [ |
| '<@(common_args)', |
| '>@(extra_args)', |
| '--arch', 'x86-64', |
| - '--build', 'newlib_nlib_pnacl', |
| + '--build', 'newlib_nlib_clang', |
| '--name', '>(out_newlib64)', |
| '--objdir', '>(objdir_newlib64)', |
| '--include-dirs=>(tc_include_dir_newlib) ^(include_dirs) >(_include_dirs)', |
| - '--compile_flags=--target=x86_64-unknown-nacl ^(compile_flags) >(_compile_flags) -gline-tables-only ^(pnacl_compile_flags) >(_pnacl_compile_flags)', |
| + '--compile_flags=^(compile_flags) >(_compile_flags) ^(pnacl_compile_flags) >(_pnacl_compile_flags) ^(native_irt_compile_flags) ^(clang_irt_compile_flags)', |
| '--gomadir', '<(gomadir)', |
| '--defines=^(defines) >(_defines)', |
| - '--link_flags=--target=x86_64-unknown-nacl -B>(tc_lib_dir_irt64) ^(pnacl_irt_link_flags) ^(link_flags) >(_link_flags)', |
| + '--link_flags=-B>(tc_lib_dir_irt64) ^(link_flags) >(_link_flags) ^(native_irt_link_flags) >(libcpp_irt_stdlibs)', |
| '--source-list=^(source_list_newlib64)', |
| ], |
| }, |
| @@ -501,7 +501,7 @@ |
| '>@(extra_deps)', |
| '>@(extra_deps_newlib32)', |
| '^(source_list_newlib32)', |
| - '<(DEPTH)/native_client/toolchain/<(TOOLCHAIN_OS)_x86/nacl_x86_newlib/nacl_x86_newlib.json', |
| + '<(DEPTH)/native_client/toolchain/<(TOOLCHAIN_OS)_x86/pnacl_newlib/pnacl_newlib.json', |
| '<(PRODUCT_DIR)/tls_edit<(EXECUTABLE_SUFFIX)', |
| ], |
| 'outputs': ['>(out_newlib32)'], |
| @@ -509,14 +509,14 @@ |
| '<@(common_args)', |
| '>@(extra_args)', |
| '--arch', 'x86-32', |
| - '--build', 'newlib_nexe_pnacl', |
| + '--build', 'newlib_nexe_clang', |
| '--name', '>(out_newlib32)', |
| '--objdir', '>(objdir_newlib32)', |
| '--include-dirs=>(tc_include_dir_newlib) ^(include_dirs) >(_include_dirs)', |
| - '--compile_flags=--target=i686-unknown-nacl ^(compile_flags) >(_compile_flags) -gline-tables-only ^(pnacl_compile_flags) >(_pnacl_compile_flags)', |
| + '--compile_flags=-m32 ^(compile_flags) >(_compile_flags) ^(pnacl_compile_flags) >(_pnacl_compile_flags) >(irt_flags_x86_32) ^(native_irt_compile_flags) ^(clang_irt_compile_flags)', |
| '--gomadir', '<(gomadir)', |
| '--defines=^(defines) >(_defines)', |
| - '--link_flags=--target=i686-unknown-nacl -arch x86-32 --pnacl-allow-translate --pnacl-allow-native >(irt_flags_x86_32) -B>(tc_lib_dir_irt32) -L>(tc_lib_dir_irt32) ^(pnacl_irt_link_flags) ^(link_flags) >(_link_flags) >(libcpp_irt_stdlibs)', |
| + '--link_flags=-m32 -B>(tc_lib_dir_irt32) -L>(tc_lib_dir_irt32) ^(link_flags) >(_link_flags) ^(native_irt_link_flags) >(libcpp_irt_stdlibs)', |
| '--source-list=^(source_list_newlib32)', |
| '--tls-edit=<(PRODUCT_DIR)/tls_edit<(EXECUTABLE_SUFFIX)', |
| '--irt-linker=<(DEPTH)/native_client/build/link_irt.py', |
| @@ -545,21 +545,21 @@ |
| '>@(extra_deps)', |
| '>@(extra_deps_newlib32)', |
| '^(source_list_newlib32)', |
| - '<(DEPTH)/native_client/toolchain/<(TOOLCHAIN_OS)_x86/nacl_x86_newlib/nacl_x86_newlib.json', |
| + '<(DEPTH)/native_client/toolchain/<(TOOLCHAIN_OS)_x86/pnacl_newlib/pnacl_newlib.json', |
| ], |
| 'outputs': ['>(out_newlib32)'], |
| 'action': [ |
| '<@(common_args)', |
| '>@(extra_args)', |
| '--arch', 'x86-32', |
| - '--build', 'newlib_nlib_pnacl', |
| + '--build', 'newlib_nlib_clang', |
| '--name', '>(out_newlib32)', |
| '--objdir', '>(objdir_newlib32)', |
| '--include-dirs=>(tc_include_dir_newlib) ^(include_dirs) >(_include_dirs)', |
| - '--compile_flags=--target=i686-unknown-nacl >(irt_flags_x86_32) ^(compile_flags) >(_compile_flags) -gline-tables-only ^(pnacl_compile_flags) >(_pnacl_compile_flags)', |
| + '--compile_flags=-m32 >(irt_flags_x86_32) ^(compile_flags) >(_compile_flags) ^(pnacl_compile_flags) >(_pnacl_compile_flags) ^(native_irt_compile_flags) ^(clang_irt_compile_flags)', |
| '--gomadir', '<(gomadir)', |
| '--defines=^(defines) >(_defines)', |
| - '--link_flags=--target=i686-unknown-nacl -B>(tc_lib_dir_irt32) ^(pnacl_irt_link_flags) ^(link_flags) >(_link_flags)', |
| + '--link_flags=-m32 -B>(tc_lib_dir_irt32) ^(link_flags) >(_link_flags) ^(native_irt_link_flags) >(libcpp_irt_stdlibs)', |
| '--source-list=^(source_list_newlib32)', |
| ], |
| }, |
| @@ -593,7 +593,7 @@ |
| '>@(extra_deps)', |
| '>@(extra_deps_newlib32_nonsfi)', |
| '^(source_list_newlib32_nonsfi)', |
| - '<(DEPTH)/native_client/toolchain/<(TOOLCHAIN_OS)_x86/nacl_x86_newlib/nacl_x86_newlib.json', |
| + '<(DEPTH)/native_client/toolchain/<(TOOLCHAIN_OS)_x86/pnacl_newlib/pnacl_newlib.json', |
| '>(tc_lib_dir_nonsfi_helper32)/libnacl_sys_private.a', |
| ], |
| 'outputs': ['>(out_newlib32_nonsfi)'], |
| @@ -651,7 +651,7 @@ |
| '>@(extra_deps)', |
| '>@(extra_deps_newlib32_nonsfi)', |
| '^(source_list_newlib32_nonsfi)', |
| - '<(DEPTH)/native_client/toolchain/<(TOOLCHAIN_OS)_x86/nacl_x86_newlib/nacl_x86_newlib.json', |
| + '<(DEPTH)/native_client/toolchain/<(TOOLCHAIN_OS)_x86/pnacl_newlib/pnacl_newlib.json', |
| ], |
| 'outputs': ['>(out_newlib32_nonsfi)'], |
| 'action': [ |
| @@ -833,10 +833,10 @@ |
| '--name', '>(out_newlib_arm)', |
| '--objdir', '>(objdir_newlib_arm)', |
| '--include-dirs=>(tc_include_dir_newlib) ^(include_dirs) >(_include_dirs)', |
| - '--compile_flags=-Wno-unused-local-typedefs -Wno-psabi ^(gcc_irt_compile_flags) ^(gcc_compile_flags) >(_gcc_compile_flags) ^(compile_flags) >(_compile_flags)', |
| + '--compile_flags=-Wno-unused-local-typedefs -Wno-psabi ^(native_irt_compile_flags) ^(gcc_compile_flags) >(_gcc_compile_flags) ^(compile_flags) >(_compile_flags)', |
| '--gomadir', '<(gomadir)', |
| '--defines=^(defines) >(_defines)', |
| - '--link_flags=-B>(tc_lib_dir_irt_arm) ^(gcc_irt_link_flags) ^(link_flags) >(_link_flags)', |
| + '--link_flags=-B>(tc_lib_dir_irt_arm) ^(native_irt_link_flags) ^(link_flags) >(_link_flags)', |
| '--source-list=^(source_list_newlib_arm)', |
| '--tls-edit=<(PRODUCT_DIR)/tls_edit<(EXECUTABLE_SUFFIX)', |
| '--irt-linker=<(DEPTH)/native_client/build/link_irt.py', |
| @@ -876,10 +876,10 @@ |
| '--name', '>(out_newlib_arm)', |
| '--objdir', '>(objdir_newlib_arm)', |
| '--include-dirs=>(tc_include_dir_newlib) ^(include_dirs) >(_include_dirs)', |
| - '--compile_flags=-Wno-unused-local-typedefs -Wno-psabi ^(gcc_irt_compile_flags) ^(gcc_compile_flags) >(_gcc_compile_flags) ^(compile_flags) >(_compile_flags)', |
| + '--compile_flags=-Wno-unused-local-typedefs -Wno-psabi ^(native_irt_compile_flags) ^(gcc_compile_flags) >(_gcc_compile_flags) ^(compile_flags) >(_compile_flags)', |
| '--gomadir', '<(gomadir)', |
| '--defines=^(defines) >(_defines)', |
| - '--link_flags=-B>(tc_lib_dir_irt_arm) ^(gcc_irt_link_flags) ^(link_flags) >(_link_flags)', |
| + '--link_flags=-B>(tc_lib_dir_irt_arm) ^(native_irt_link_flags) ^(link_flags) >(_link_flags)', |
| '--source-list=^(source_list_newlib_arm)', |
| ], |
| }, |
| @@ -1453,13 +1453,24 @@ |
| ], |
| # IRT compile/link flags to make the binary smaller. |
| # Omitted from non-IRT libraries to keep the libraries themselves small. |
| - 'gcc_irt_compile_flags': [ |
| + 'native_irt_compile_flags': [ |
| '-ffunction-sections', |
| '-fdata-sections', |
| ], |
| - 'gcc_irt_link_flags': [ |
| + 'native_irt_link_flags': [ |
| '-Wl,--gc-sections', |
| ], |
| + # The IRT must be built using LLVM's assembler on x86-64 to preserve sandbox |
|
Mark Seaborn
2015/03/25 08:37:00
Nit: wrap to 80 chars
Derek Schuff
2015/03/25 18:04:20
Done.
|
| + # base address hiding (a security hardening mechanism). |
| + # It's also used on x86-32 for consistency. |
| + # See https://code.google.com/p/nativeclient/issues/detail?id=1235 |
| + # TODO(dschuff): merge this with native_irt_compile_flags when we use |
| + # nacl-clang for the IRT on all arches. |
| + 'clang_irt_compile_flags': [ |
| + '-Os', |
| + '-integrated-as', |
| + '-fno-exceptions', |
| + ], |
| 'pnacl_irt_link_flags': [ |
| '-Wt,-ffunction-sections', |
| '-Wt,-fdata-sections', |