Skip to content
This repository was archived by the owner on Apr 21, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
Google Inc.
Jim Simon <[email protected]>
The Fuchsia Authors
Hidenori Matsubayashi <[email protected]>
8 changes: 6 additions & 2 deletions build/config/sysroot.gni
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@ if (current_toolchain == default_toolchain && target_sysroot != "") {
} else if (is_linux && !is_chromeos) {
if (current_cpu == "mipsel") {
sysroot = rebase_path("//mipsel-sysroot/sysroot")
} else if (use_default_linux_sysroot && !is_fuchsia && current_cpu == "x64") {
sysroot = rebase_path("//build/linux/debian_sid_amd64-sysroot")
} else if (use_default_linux_sysroot && !is_fuchsia) {
if (current_cpu == "x64") {
sysroot = rebase_path("//build/linux/debian_sid_amd64-sysroot")
} else {
sysroot = rebase_path("//build/linux/debian_sid_arm64-sysroot")
}
assert(
exec_script("//build/dir_exists.py", [ sysroot ], "string") == "True",
"Missing sysroot ($sysroot). To fix, run: build/linux/sysroot_scripts/install-sysroot.py --arch=$current_cpu")
Expand Down
11 changes: 9 additions & 2 deletions build/toolchain/gcc_toolchain.gni
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ analyzer_wrapper =
# Location of the strip executable. When specified, strip will be run on
# all shared libraries and executables as they are built. The pre-stripped
# artifacts will be put in lib.stripped/ and exe.stripped/.
# - llvm_objcopy
# Location of the llvm-objcopy executable. Used as strip instead of strip
# when specified.
template("gcc_toolchain") {
toolchain(target_name) {
assert(defined(invoker.cc), "gcc_toolchain() must specify a \"cc\" value")
Expand Down Expand Up @@ -169,7 +172,7 @@ template("gcc_toolchain") {
tocfile = sofile + ".TOC"
temporary_tocname = sofile + ".tmp"
link_command = "$ld -shared {{ldflags}} $coverage_flags -o $sofile -Wl,--build-id=sha1 -Wl,-soname=$soname @$rspfile"
toc_command = "{ $readelf -d $sofile | grep SONAME ; $nm -gD -f p $sofile | cut -f1-2 -d' '; } > $temporary_tocname"
toc_command = "{ $readelf -d $sofile | grep SONAME ; $nm -gD -f posix $sofile | cut -f1-2 -d' '; } > $temporary_tocname"
replace_command = "if ! cmp -s $temporary_tocname $tocfile; then mv $temporary_tocname $tocfile; fi"

command = "$link_command && $toc_command && $replace_command"
Expand Down Expand Up @@ -214,7 +217,7 @@ template("gcc_toolchain") {
rspfile = "$outfile.rsp"
unstripped_outfile = outfile

if (defined(invoker.strip)) {
if (defined(invoker.strip) || defined(invoker.llvm_objcopy)) {
unstripped_outfile = "{{root_out_dir}}/exe.unstripped/$exename"
}

Expand All @@ -224,6 +227,10 @@ template("gcc_toolchain") {
strip_command =
"${strip} --strip-unneeded -o $outfile $unstripped_outfile"
command += " && " + strip_command
} else if (defined(invoker.llvm_objcopy)) {
strip = invoker.llvm_objcopy
strip_command = "${strip} --strip-all $unstripped_outfile $outfile"
command += " && " + strip_command
}
if (defined(invoker.postlink)) {
command += " && " + invoker.postlink
Expand Down
6 changes: 3 additions & 3 deletions build/toolchain/linux/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ gcc_toolchain("clang_arm64") {
cxx = "${compiler_prefix}$prefix/clang++"

readelf = "readelf"
nm = "nm"
ar = "ar"
nm = "${prefix}/llvm-nm"
ar = "${prefix}/llvm-ar"
ld = cxx
strip = "strip"
llvm_objcopy = "${prefix}/llvm-objcopy"

toolchain_cpu = "arm64"
toolchain_os = "linux"
Expand Down