2017-05-12 20:50:37 +03:00
|
|
|
# Copyright 2017 The Chromium Authors. All rights reserved.
|
|
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
|
|
# found in the LICENSE file.
|
|
|
|
|
2017-05-19 22:55:15 +03:00
|
|
|
import("//build/config/fuchsia/config.gni")
|
2019-10-05 01:47:01 +03:00
|
|
|
import("//build/config/fuchsia/generate_runner_scripts.gni")
|
2017-05-12 20:50:37 +03:00
|
|
|
import("//build/config/sysroot.gni")
|
|
|
|
|
|
|
|
assert(is_fuchsia)
|
2018-04-12 22:00:48 +03:00
|
|
|
assert(!is_posix)
|
2017-05-12 20:50:37 +03:00
|
|
|
|
|
|
|
config("compiler") {
|
2019-02-06 18:30:41 +03:00
|
|
|
sdk_version_file = "${fuchsia_sdk}/.hash"
|
2017-08-01 20:20:44 +03:00
|
|
|
sdk_version = read_file(sdk_version_file, "trim string")
|
2017-06-16 20:24:27 +03:00
|
|
|
defines = [
|
2017-08-01 20:20:44 +03:00
|
|
|
# To force full builds after SDK updates in case of ABI changes.
|
|
|
|
"FUCHSIA_SDK_VERSION=$sdk_version",
|
2017-06-16 20:24:27 +03:00
|
|
|
]
|
2017-05-12 20:50:37 +03:00
|
|
|
cflags = []
|
|
|
|
ldflags = []
|
|
|
|
if (current_cpu == "arm64") {
|
|
|
|
cflags += [ "--target=aarch64-fuchsia" ]
|
|
|
|
ldflags += [ "--target=aarch64-fuchsia" ]
|
|
|
|
} else if (current_cpu == "x64") {
|
2017-10-09 22:28:24 +03:00
|
|
|
cflags += [ "--target=x86_64-fuchsia" ]
|
2017-05-12 20:50:37 +03:00
|
|
|
ldflags += [ "--target=x86_64-fuchsia" ]
|
|
|
|
} else {
|
|
|
|
assert(false, "Unsupported architecture")
|
|
|
|
}
|
|
|
|
asmflags = cflags
|
|
|
|
|
2017-08-09 21:12:04 +03:00
|
|
|
ldflags += [
|
2017-06-15 21:25:19 +03:00
|
|
|
# The stack defaults to 256k on Fuchsia (see
|
2017-09-19 00:25:04 +03:00
|
|
|
# https://fuchsia.googlesource.com/zircon/+/master/system/private/zircon/stack.h#9),
|
2017-06-15 21:25:19 +03:00
|
|
|
# but on other platforms it's much higher, so a variety of code assumes more
|
|
|
|
# will be available. Raise to 8M which matches e.g. macOS.
|
2017-06-14 23:47:42 +03:00
|
|
|
"-Wl,-z,stack-size=0x800000",
|
|
|
|
|
2017-09-19 00:25:04 +03:00
|
|
|
# We always want fdio or else e.g. stdio wouldn't be initialized if fdio
|
2017-08-16 01:53:38 +03:00
|
|
|
# happens to not be directly referenced. The common POSIX-y compiler setup
|
2017-09-19 00:25:04 +03:00
|
|
|
# uses -Wl,--as-needed which drops it if it's simply "-lfdio" from a libs
|
|
|
|
# setting. Disable --as-needed, add fdio, and then set back to --as-needed.
|
2017-08-16 01:53:38 +03:00
|
|
|
# https://crbug.com/731217.
|
|
|
|
"-Wl,--no-as-needed",
|
2017-09-19 00:25:04 +03:00
|
|
|
"-lfdio",
|
2017-08-16 01:53:38 +03:00
|
|
|
"-Wl,--as-needed",
|
2017-05-12 20:50:37 +03:00
|
|
|
]
|
2017-08-16 01:53:38 +03:00
|
|
|
|
2018-05-11 21:06:40 +03:00
|
|
|
# Add SDK lib dir for -lfdio above.
|
2019-02-06 18:30:41 +03:00
|
|
|
lib_dirs = [ "${fuchsia_sdk}/arch/${current_cpu}/lib" ]
|
2018-05-09 13:54:16 +03:00
|
|
|
|
2019-11-12 07:35:59 +03:00
|
|
|
# TODO(crbug.com/821951): Clang enables SafeStack by default when targeting
|
|
|
|
# Fuchsia, but it breaks some tests, notably in V8.
|
|
|
|
# Force the toolchain to use shadow-call-stack instead, until that is default.
|
|
|
|
cflags += [
|
|
|
|
"-fno-sanitize=safe-stack",
|
|
|
|
"-fsanitize=shadow-call-stack",
|
|
|
|
]
|
|
|
|
|
2017-09-19 00:25:04 +03:00
|
|
|
libs = [ "zircon" ]
|
2017-05-12 20:50:37 +03:00
|
|
|
}
|
2018-04-04 23:49:21 +03:00
|
|
|
|
2018-11-01 03:27:37 +03:00
|
|
|
# Settings for executables.
|
|
|
|
config("executable_config") {
|
|
|
|
ldflags = [ "-pie" ]
|
|
|
|
}
|