OLD | NEW |
(Empty) | |
| 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 |
| 3 # found in the LICENSE file. |
| 4 |
| 5 import("//build/config/nacl/config.gni") |
| 6 |
| 7 # Native Client Definitions |
| 8 config("nacl_defines") { |
| 9 defines = [ |
| 10 "_DEFAULT_SOURCE=1", |
| 11 "_BSD_SOURCE=1", |
| 12 "_POSIX_C_SOURCE=199506", |
| 13 "_XOPEN_SOURCE=600", |
| 14 "_GNU_SOURCE=1", |
| 15 "__STDC_LIMIT_MACROS=1", |
| 16 ] |
| 17 } |
| 18 |
| 19 config("nexe_defines") { |
| 20 defines = [ |
| 21 "DYNAMIC_ANNOTATIONS_ENABLED=1", |
| 22 "DYNAMIC_ANNOTATIONS_PREFIX=NACL_", |
| 23 ] |
| 24 } |
| 25 |
| 26 # The base target that all targets in the NaCl build should depend on. |
| 27 # This allows configs to be modified for everything in the NaCl build, even when |
| 28 # the NaCl build is composed into the Chrome build. (GN has no functionality to |
| 29 # add flags to everythin in //native_client, having a base target works around |
| 30 # that limitation.) |
| 31 source_set("nacl_base") { |
| 32 public_configs = [ ":nacl_defines" ] |
| 33 if (current_os == "nacl") { |
| 34 public_configs += [ ":nexe_defines" ] |
| 35 } |
| 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 |