mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 10:49:00 +00:00
[vm/build] Workaround for ld 2.19 crash on ARM
When producing ARM builds instruct llvm-objcopy to 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. Closes https://github.com/dart-lang/sdk/issues/41644. Change-Id: I0ceebb63105591f132f3764180ae041366cbcade Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175723 Reviewed-by: Alexander Markov <alexmarkov@google.com> Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
This commit is contained in:
parent
e8b0f38ccd
commit
e961aa565e
2 changed files with 18 additions and 1 deletions
|
@ -204,7 +204,13 @@ template("gcc_toolchain") {
|
||||||
command += " && " + strip_command
|
command += " && " + strip_command
|
||||||
} else if (defined(invoker.llvm_objcopy)) {
|
} else if (defined(invoker.llvm_objcopy)) {
|
||||||
strip = 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
|
command += " && " + strip_command
|
||||||
}
|
}
|
||||||
if (defined(invoker.postlink)) {
|
if (defined(invoker.postlink)) {
|
||||||
|
|
|
@ -52,6 +52,17 @@ gcc_toolchain("clang_arm") {
|
||||||
ld = cxx
|
ld = cxx
|
||||||
llvm_objcopy = "${prefix}/llvm-objcopy"
|
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_cpu = "arm"
|
||||||
toolchain_os = "linux"
|
toolchain_os = "linux"
|
||||||
is_clang = true
|
is_clang = true
|
||||||
|
|
Loading…
Reference in a new issue