2016-07-01 18:09:28 +00:00
|
|
|
# Copyright (c) 2013 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.
|
|
|
|
|
|
|
|
import("//build/config/sysroot.gni")
|
|
|
|
|
|
|
|
config("sdk") {
|
2019-10-17 16:51:32 +00:00
|
|
|
ldflags = []
|
2019-11-18 16:58:53 +00:00
|
|
|
cflags = []
|
2019-09-05 17:16:43 +00:00
|
|
|
|
2020-02-24 21:04:18 +00:00
|
|
|
if (is_clang) {
|
2019-10-17 16:51:32 +00:00
|
|
|
# Don't allow visible symbols from libc++ to be re-exported.
|
2020-02-24 21:04:18 +00:00
|
|
|
ldflags += [ "-Wl,--exclude-libs=libc++.a" ]
|
2019-09-05 17:16:43 +00:00
|
|
|
}
|
2019-09-05 15:05:53 +00:00
|
|
|
|
2023-02-14 19:25:30 +00:00
|
|
|
# Explicitly use static linking for libstdc++ and libgcc to minimize
|
|
|
|
# dependencies.
|
2023-05-22 23:38:58 +00:00
|
|
|
if (!use_flutter_cxx) {
|
|
|
|
ldflags += [
|
|
|
|
"-static-libgcc",
|
|
|
|
"-static-libstdc++",
|
|
|
|
]
|
|
|
|
}
|
2023-02-14 19:25:30 +00:00
|
|
|
|
2016-07-01 18:09:28 +00:00
|
|
|
if (sysroot != "") {
|
2019-11-18 16:58:53 +00:00
|
|
|
cflags += [ "--sysroot=" + sysroot ]
|
2019-09-05 15:05:53 +00:00
|
|
|
ldflags += [ "--sysroot=" + sysroot ]
|
2016-07-01 18:09:28 +00:00
|
|
|
|
|
|
|
# Need to get some linker flags out of the sysroot.
|
|
|
|
ldflags += [ exec_script("sysroot_ld_path.py",
|
|
|
|
[
|
|
|
|
rebase_path("//build/linux/sysroot_ld_path.sh",
|
|
|
|
root_build_dir),
|
|
|
|
sysroot,
|
|
|
|
],
|
|
|
|
"value") ]
|
2016-11-07 21:09:45 +00:00
|
|
|
|
2023-01-19 10:36:51 +00:00
|
|
|
if (dart_sysroot == "alpine") {
|
|
|
|
# When using the alpine sysroot, prefers lld as linker.
|
|
|
|
if (is_clang) {
|
|
|
|
ldflags += [ "-fuse-ld=lld" ]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-25 15:05:22 +00:00
|
|
|
# When using the pulled Debian sysroot with gcc, we have to specify these
|
2023-01-23 08:56:14 +00:00
|
|
|
# explicitly.
|
2023-01-19 10:36:51 +00:00
|
|
|
if (dart_sysroot == "debian" && !is_clang) {
|
2016-11-07 21:09:45 +00:00
|
|
|
cflags += [
|
2018-10-25 15:05:22 +00:00
|
|
|
"-I=/usr/include/c++/4.8",
|
|
|
|
"-I=/usr/include/c++/4.8/i486-linux-gnu",
|
2016-11-07 21:09:45 +00:00
|
|
|
]
|
|
|
|
}
|
2016-07-01 18:09:28 +00:00
|
|
|
}
|
2022-06-08 19:55:22 +00:00
|
|
|
|
|
|
|
# Enable Large File Support extension (LFS)
|
|
|
|
cflags += [
|
|
|
|
"-D_FILE_OFFSET_BITS=64",
|
|
|
|
"-D_LARGEFILE_SOURCE",
|
|
|
|
"-D_LARGEFILE64_SOURCE",
|
|
|
|
]
|
2016-07-01 18:09:28 +00:00
|
|
|
}
|
2018-06-11 23:27:45 +00:00
|
|
|
|
|
|
|
config("executable_config") {
|
2019-11-18 16:58:53 +00:00
|
|
|
# GDB cannot find the executable's mapping in QEMU when PIE is enabled.
|
|
|
|
if (is_qemu) {
|
|
|
|
cflags = [ "-fno-pie" ]
|
|
|
|
ldflags = [ "-no-pie" ]
|
|
|
|
} else if (current_cpu != "x86") {
|
2018-06-11 23:27:45 +00:00
|
|
|
cflags = [ "-fPIE" ]
|
|
|
|
ldflags = [ "-pie" ]
|
|
|
|
}
|
|
|
|
}
|