[lld] [lld-macho] Include branch extension thunks in linker map (PR #120496)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 19 13:52:18 PST 2024
================
@@ -8,14 +8,45 @@
## (4) early calls to a dylib stub use a thunk, and later calls the stub
## directly
## (5) Thunks are created for all sections in the text segment with branches.
+## (6) Thunks are in the linker map file.
## Notes:
## 0x4000000 = 64 Mi = half the magnitude of the forward-branch range
# RUN: rm -rf %t; mkdir %t
# RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin %s -o %t/input.o
-# RUN: %lld -arch arm64 -dead_strip -lSystem -U _extern_sym -o %t/thunk %t/input.o
+# RUN: %lld -arch arm64 -dead_strip -lSystem -U _extern_sym -map %t/thunk.map -o %t/thunk %t/input.o
# RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t/thunk | FileCheck %s
+## Check that the thunks appear in the map file and that everything is sorted by address
+# Because of the `.space` instructions, there will end up being a lot of dead symbols in the linker map
+# so generate a version of the linker map without dead symbols.
+# RUN: awk '/# Dead Stripped Symbols:/ {exit} {print}' %t/thunk.map > %t/thunk_no_dead_syms.map
----------------
alx32 wrote:
The issue is that because the `.space. commands, linker map ends up being 2.7GB in size - with apparently each character added via `.space` being interpreted as a dead symbol (this might be another unrelated issue).
So the issue is that if the test were to break, then it would take a very very long time to complete (I didn't wait to fully time it) - trying to match the regex against the 2.7GB file.
This is just an optimization to have the test complete in a practical amount of time - even in case of failure.
https://github.com/llvm/llvm-project/pull/120496
More information about the llvm-commits
mailing list