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("config.gni") | |
Dirk Pranke
2015/10/09 19:25:53
imports should always be src-relative paths, i.e.,
Roland McGrath
2015/10/09 20:35:26
Done.
| |
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 configs = [] | |
40 cflags = [] | |
41 | |
42 if (is_clang) { | |
43 # -no-integrated-as is the default in nacl-clang for historical | |
44 # compatibility with inline assembly code and so forth. But there | |
45 # are no such cases in Chromium code, and -integrated-as is nicer in | |
46 # general. Moreover, the IRT must be built using LLVM's assembler | |
47 # on x86-64 to preserve sandbox base address hiding. Use it | |
48 # everywhere for consistency (and possibly quicker builds). | |
49 cflags += [ "-integrated-as" ] | |
50 } | |
51 | |
52 asmflags = cflags | |
53 } | |
54 | |
55 config("compiler_codegen") { | |
56 cflags = [] | |
57 | |
58 if (is_nacl_irt) { | |
59 cflags += [ | |
60 # A debugger should be able to unwind IRT call frames. This is | |
61 # the default behavior on x86-64 and when compiling C++ with | |
62 # exceptions enabled; the change is for the benefit of x86-32 C. | |
63 # The frame pointer is unnecessary when unwind tables are used. | |
64 "-fasynchronous-unwind-tables", | |
65 "-fomit-frame-pointer", | |
66 ] | |
67 | |
68 if (current_cpu == "x86") { | |
69 # The x86-32 IRT needs to be callable with an under-aligned | |
70 # stack; so we disable SSE instructions, which can fault on | |
71 # misaligned addresses. See | |
72 # https://code.google.com/p/nativeclient/issues/detail?id=3935 | |
73 cflags += [ | |
74 "-mstackrealign", | |
75 "-mno-sse", | |
76 ] | |
77 } | |
78 } | |
79 | |
80 asmflags = cflags | |
81 } | |
82 | |
83 config("irt_optimize") { | |
84 cflags = [ | |
85 # Optimize for space, keep the IRT nexe small. | |
86 "-Os", | |
87 | |
88 # These are omitted from non-IRT libraries to keep the libraries | |
89 # themselves small. | |
90 "-ffunction-sections", | |
91 "-fdata-sections", | |
92 ] | |
93 | |
94 ldflags = [ "-Wl,--gc-sections" ] | |
95 } | |
OLD | NEW |