[lld] 5bd38a2 - [ELF] Fix split-stack caller with hidden non-split-stack callee
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 19 12:25:08 PST 2022
Author: Fangrui Song
Date: 2022-01-19T12:25:01-08:00
New Revision: 5bd38a2826b1360ff41c293bcc6cdec8b596810b
URL: https://github.com/llvm/llvm-project/commit/5bd38a2826b1360ff41c293bcc6cdec8b596810b
DIFF: https://github.com/llvm/llvm-project/commit/5bd38a2826b1360ff41c293bcc6cdec8b596810b.diff
LOG: [ELF] Fix split-stack caller with hidden non-split-stack callee
Fix a regression after aabe901d57d6df4cd2786163359a7b2a7aae8c32 (`[ELF] Remove
one redundant computeBinding`): isLocal() does not indicate that the symbol is
originally local. For simplicity, just drop this optimization.
Added:
Modified:
lld/ELF/InputSection.cpp
lld/test/ELF/Inputs/x86-64-split-stack-main.s
lld/test/ELF/x86-64-split-stack-prologue-adjust-success.s
Removed:
################################################################################
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp
index fc8b3b19f1042..62db24fe099e4 100644
--- a/lld/ELF/InputSection.cpp
+++ b/lld/ELF/InputSection.cpp
@@ -1181,11 +1181,6 @@ void InputSectionBase::adjustSplitStackFunctionPrologues(uint8_t *buf,
std::vector<Relocation *> morestackCalls;
for (Relocation &rel : relocations) {
- // Local symbols can't possibly be cross-calls, and should have been
- // resolved long before this line.
- if (rel.sym->isLocal())
- continue;
-
// Ignore calls into the split-stack api.
if (rel.sym->getName().startswith("__morestack")) {
if (rel.sym->getName().equals("__morestack"))
diff --git a/lld/test/ELF/Inputs/x86-64-split-stack-main.s b/lld/test/ELF/Inputs/x86-64-split-stack-main.s
index 3be9facf51e9b..22874c21e519c 100644
--- a/lld/test/ELF/Inputs/x86-64-split-stack-main.s
+++ b/lld/test/ELF/Inputs/x86-64-split-stack-main.s
@@ -6,6 +6,13 @@ non_split:
retq
.size non_split,. - non_split
+ .global non_split_hidden
+ .hidden non_split_hidden
+ .type non_split_hidden, at function
+non_split_hidden:
+ retq
+ .size non_split_hidden,. - non_split_hidden
+
.global non_function_text_symbol
non_function_text_symbol:
.byte 0x01
diff --git a/lld/test/ELF/x86-64-split-stack-prologue-adjust-success.s b/lld/test/ELF/x86-64-split-stack-prologue-adjust-success.s
index 1fce4fdf6b57c..6205793197cb1 100644
--- a/lld/test/ELF/x86-64-split-stack-prologue-adjust-success.s
+++ b/lld/test/ELF/x86-64-split-stack-prologue-adjust-success.s
@@ -111,5 +111,13 @@ prologue2 non_split r10 0x100
prologue2 non_split r11 0x200
+# CHECK: <prologue2_calls_non_split_hiddenr11>:
+# CHECK-NEXT: lea{{.*}} -16896(%rsp),{{.*}}%r11
+# CHECK: cmp{{.*}}%fs:{{[^,]*}},{{.*}}%r11
+# CHECK: jae{{.*$}}
+# CHECK-NEXT: callq{{.*}}<__morestack_non_split>
+
+prologue2 non_split_hidden r11 0x200
+
.section .note.GNU-stack,"", at progbits
.section .note.GNU-split-stack,"", at progbits
More information about the llvm-commits
mailing list