diff --git a/build/toolchain/gcc_toolchain.gni b/build/toolchain/gcc_toolchain.gni index 0d749661bda..96a32d472fa 100644 --- a/build/toolchain/gcc_toolchain.gni +++ b/build/toolchain/gcc_toolchain.gni @@ -204,7 +204,13 @@ template("gcc_toolchain") { command += " && " + strip_command } else if (defined(invoker.llvm_objcopy)) { strip = invoker.llvm_objcopy - strip_command = "${strip} --strip-all $outfile $stripped_outfile" + if (defined(invoker.llvm_objcopy_extra_args)) { + extra_args = invoker.llvm_objcopy_extra_args + } else { + extra_args = "" + } + strip_command = + "${strip} --strip-all ${extra_args} $outfile $stripped_outfile" command += " && " + strip_command } if (defined(invoker.postlink)) { diff --git a/build/toolchain/linux/BUILD.gn b/build/toolchain/linux/BUILD.gn index 46927848071..71038ed2b2c 100644 --- a/build/toolchain/linux/BUILD.gn +++ b/build/toolchain/linux/BUILD.gn @@ -52,6 +52,17 @@ gcc_toolchain("clang_arm") { ld = cxx llvm_objcopy = "${prefix}/llvm-objcopy" + # When producing ARM builds we drop .ARM.exidx/extab sections. These sections + # don't contain any useful information (we don't use exceptions or + # unwind C++ frames and most of the dart binary is in fact not covered by + # them), however they have been seen to break dynamic linker in older glibc + # versions (pre 2.23) because .ARM.exidx ends up being positioned between + # .rel.dyn and .rel.plt sections while older versions of dynamic linker + # expect these two sections to appear one after another in the ELF file. + # See https://github.com/dart-lang/sdk/issues/41644. + llvm_objcopy_extra_args = + "--remove-section .ARM.exidx --remove-section .ARM.extab" + toolchain_cpu = "arm" toolchain_os = "linux" is_clang = true