OLD | NEW |
1 # Copyright (c) 2014 The Native Client Authors. All rights reserved. | 1 # Copyright (c) 2014 The Native Client Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
| 5 import("//build/config/nacl/config.gni") |
| 6 |
5 # Native Client Definitions | 7 # Native Client Definitions |
6 config("nacl_defines") { | 8 config("nacl_defines") { |
7 defines = [ | 9 defines = [ |
8 "_DEFAULT_SOURCE=1", | 10 "_DEFAULT_SOURCE=1", |
9 "_BSD_SOURCE=1", | 11 "_BSD_SOURCE=1", |
10 "_POSIX_C_SOURCE=199506", | 12 "_POSIX_C_SOURCE=199506", |
11 "_XOPEN_SOURCE=600", | 13 "_XOPEN_SOURCE=600", |
12 "_GNU_SOURCE=1", | 14 "_GNU_SOURCE=1", |
13 "__STDC_LIMIT_MACROS=1", | 15 "__STDC_LIMIT_MACROS=1", |
14 ] | 16 ] |
(...skipping 10 matching lines...) Expand all Loading... |
25 # This allows configs to be modified for everything in the NaCl build, even when | 27 # This allows configs to be modified for everything in the NaCl build, even when |
26 # the NaCl build is composed into the Chrome build. (GN has no functionality to | 28 # the NaCl build is composed into the Chrome build. (GN has no functionality to |
27 # add flags to everythin in //native_client, having a base target works around | 29 # add flags to everythin in //native_client, having a base target works around |
28 # that limitation.) | 30 # that limitation.) |
29 source_set("nacl_base") { | 31 source_set("nacl_base") { |
30 public_configs = [ ":nacl_defines" ] | 32 public_configs = [ ":nacl_defines" ] |
31 if (current_os == "nacl") { | 33 if (current_os == "nacl") { |
32 public_configs += [ ":nexe_defines" ] | 34 public_configs += [ ":nexe_defines" ] |
33 } | 35 } |
34 } | 36 } |
| 37 |
| 38 config("compiler") { |
| 39 cflags = [] |
| 40 |
| 41 if (is_clang && current_cpu != "pnacl") { |
| 42 # -no-integrated-as is the default in nacl-clang for historical |
| 43 # compatibility with inline assembly code and so forth. But there |
| 44 # are no such cases in Chromium code, and -integrated-as is nicer in |
| 45 # general. Moreover, the IRT must be built using LLVM's assembler |
| 46 # on x86-64 to preserve sandbox base address hiding. Use it |
| 47 # everywhere for consistency (and possibly quicker builds). |
| 48 cflags += [ "-integrated-as" ] |
| 49 } |
| 50 |
| 51 asmflags = cflags |
| 52 } |
| 53 |
| 54 config("compiler_codegen") { |
| 55 cflags = [] |
| 56 |
| 57 if (is_nacl_irt) { |
| 58 cflags += [ |
| 59 # A debugger should be able to unwind IRT call frames. This is |
| 60 # the default behavior on x86-64 and when compiling C++ with |
| 61 # exceptions enabled; the change is for the benefit of x86-32 C. |
| 62 # The frame pointer is unnecessary when unwind tables are used. |
| 63 "-fasynchronous-unwind-tables", |
| 64 "-fomit-frame-pointer", |
| 65 ] |
| 66 |
| 67 if (current_cpu == "x86") { |
| 68 # The x86-32 IRT needs to be callable with an under-aligned |
| 69 # stack; so we disable SSE instructions, which can fault on |
| 70 # misaligned addresses. See |
| 71 # https://code.google.com/p/nativeclient/issues/detail?id=3935 |
| 72 cflags += [ |
| 73 "-mstackrealign", |
| 74 "-mno-sse", |
| 75 ] |
| 76 } |
| 77 } |
| 78 |
| 79 asmflags = cflags |
| 80 } |
| 81 |
| 82 config("irt_optimize") { |
| 83 cflags = [ |
| 84 # Optimize for space, keep the IRT nexe small. |
| 85 "-Os", |
| 86 |
| 87 # These are omitted from non-IRT libraries to keep the libraries |
| 88 # themselves small. |
| 89 "-ffunction-sections", |
| 90 "-fdata-sections", |
| 91 ] |
| 92 |
| 93 ldflags = [ "-Wl,--gc-sections" ] |
| 94 } |
OLD | NEW |