diff --git a/AUTHORS b/AUTHORS index 18ebdb0b17..af2c77c76a 100644 --- a/AUTHORS +++ b/AUTHORS @@ -6,3 +6,4 @@ Google Inc. Jim Simon The Fuchsia Authors +Hidenori Matsubayashi diff --git a/build/config/sysroot.gni b/build/config/sysroot.gni index fb0f3c3064..4f32e8f63b 100644 --- a/build/config/sysroot.gni +++ b/build/config/sysroot.gni @@ -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") diff --git a/build/toolchain/gcc_toolchain.gni b/build/toolchain/gcc_toolchain.gni index 19b0ee6eb8..03cb896ac2 100644 --- a/build/toolchain/gcc_toolchain.gni +++ b/build/toolchain/gcc_toolchain.gni @@ -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") @@ -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" @@ -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" } @@ -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 diff --git a/build/toolchain/linux/BUILD.gn b/build/toolchain/linux/BUILD.gn index 32245f0f6e..ee23fe7d8a 100644 --- a/build/toolchain/linux/BUILD.gn +++ b/build/toolchain/linux/BUILD.gn @@ -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"