aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/DwarfWriter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/DwarfWriter.cpp')
-rw-r--r--lib/CodeGen/DwarfWriter.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/lib/CodeGen/DwarfWriter.cpp b/lib/CodeGen/DwarfWriter.cpp
index c1091e9e7d..1f7618a533 100644
--- a/lib/CodeGen/DwarfWriter.cpp
+++ b/lib/CodeGen/DwarfWriter.cpp
@@ -2877,18 +2877,25 @@ private:
O << GlobalEHDirective << EHFrameInfo.FnName << "\n";
}
- // If there are no calls then you can't unwind.
- if (!EHFrameInfo.hasCalls) {
+ // If corresponding function is weak definition, this should be too.
+ if ((EHFrameInfo.linkage == Function::WeakLinkage ||
+ EHFrameInfo.linkage == Function::LinkOnceLinkage) &&
+ TAI->getWeakDefDirective())
+ O << TAI->getWeakDefDirective() << EHFrameInfo.FnName << "\n";
+
+ // If there are no calls then you can't unwind. This may mean we can
+ // omit the EH Frame, but some environments do not handle weak absolute
+ // symbols.
+ if (!EHFrameInfo.hasCalls &&
+ ((EHFrameInfo.linkage != Function::WeakLinkage &&
+ EHFrameInfo.linkage != Function::LinkOnceLinkage) ||
+ !TAI->getWeakDefDirective() ||
+ TAI->getSupportsWeakOmittedEHFrame()))
+ {
O << EHFrameInfo.FnName << " = 0\n";
} else {
O << EHFrameInfo.FnName << ":\n";
- // If corresponding function is weak definition, this should be too.
- if ((EHFrameInfo.linkage == Function::WeakLinkage ||
- EHFrameInfo.linkage == Function::LinkOnceLinkage) &&
- TAI->getWeakDefDirective())
- O << TAI->getWeakDefDirective() << EHFrameInfo.FnName << "\n";
-
// EH frame header.
EmitDifference("eh_frame_end", EHFrameInfo.Number,
"eh_frame_begin", EHFrameInfo.Number, true);