summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorSterling Augustine <saugustine@google.com>2018-11-26 23:26:31 +0000
committerSterling Augustine <saugustine@google.com>2018-11-26 23:26:31 +0000
commit9cc1ffadc5ad06ab846a7da95a1afb874b9f3d98 (patch)
tree63b16c82349b18b40c15d2006d495f604e4fc5b0 /llvm/lib/Target
parente83e93f403c1df0cc80d43c16cdc71d8084d1718 (diff)
downloadbcm5719-llvm-9cc1ffadc5ad06ab846a7da95a1afb874b9f3d98.tar.gz
bcm5719-llvm-9cc1ffadc5ad06ab846a7da95a1afb874b9f3d98.zip
Notify the linker when a TU compiled with split-stack has a function without a prologue.
More context here: https://go-review.googlesource.com/c/go/+/148819/ llvm-svn: 347614
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/ARM/ARMFrameLowering.cpp10
-rw-r--r--llvm/lib/Target/X86/X86FrameLowering.cpp10
2 files changed, 16 insertions, 4 deletions
diff --git a/llvm/lib/Target/ARM/ARMFrameLowering.cpp b/llvm/lib/Target/ARM/ARMFrameLowering.cpp
index 3e057e953d8..d1e4bce1e0c 100644
--- a/llvm/lib/Target/ARM/ARMFrameLowering.cpp
+++ b/llvm/lib/Target/ARM/ARMFrameLowering.cpp
@@ -2157,9 +2157,15 @@ void ARMFrameLowering::adjustForSegmentedStacks(
// Do not generate a prologue for leaf functions with a stack of size zero.
// For non-leaf functions we have to allow for the possibility that the
- // call is to a non-split function, as in PR37807.
- if (StackSize == 0 && !MFI.hasTailCall())
+ // callis to a non-split function, as in PR37807. This function could also
+ // take the address of a non-split function. When the linker tries to adjust
+ // its non-existent prologue, it would fail with an error. Mark the object
+ // file so that such failures are not errors. See this Go language bug-report
+ // https://go-review.googlesource.com/c/go/+/148819/
+ if (StackSize == 0 && !MFI.hasTailCall()) {
+ MF.getMMI().setHasNosplitStack(true);
return;
+ }
// Use R4 and R5 as scratch registers.
// We save R4 and R5 before use and restore them before leaving the function.
diff --git a/llvm/lib/Target/X86/X86FrameLowering.cpp b/llvm/lib/Target/X86/X86FrameLowering.cpp
index e40b0f81e33..d722c75c4f0 100644
--- a/llvm/lib/Target/X86/X86FrameLowering.cpp
+++ b/llvm/lib/Target/X86/X86FrameLowering.cpp
@@ -2270,9 +2270,15 @@ void X86FrameLowering::adjustForSegmentedStacks(
// Do not generate a prologue for leaf functions with a stack of size zero.
// For non-leaf functions we have to allow for the possibility that the
- // call is to a non-split function, as in PR37807.
- if (StackSize == 0 && !MFI.hasTailCall())
+ // callis to a non-split function, as in PR37807. This function could also
+ // take the address of a non-split function. When the linker tries to adjust
+ // its non-existent prologue, it would fail with an error. Mark the object
+ // file so that such failures are not errors. See this Go language bug-report
+ // https://go-review.googlesource.com/c/go/+/148819/
+ if (StackSize == 0 && !MFI.hasTailCall()) {
+ MF.getMMI().setHasNosplitStack(true);
return;
+ }
MachineBasicBlock *allocMBB = MF.CreateMachineBasicBlock();
MachineBasicBlock *checkMBB = MF.CreateMachineBasicBlock();
OpenPOWER on IntegriCloud