aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/DwarfWriter.cpp
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2008-01-10 02:03:30 +0000
committerDale Johannesen <dalej@apple.com>2008-01-10 02:03:30 +0000
commit038129dd58acbb2cd6e80bee05649903897df967 (patch)
tree66443ca4484e5f02b8e33323cfe31c7f0ce6fa69 /lib/CodeGen/DwarfWriter.cpp
parentddd060ffcfd56ef91eb28ce76a2b0576dfe51129 (diff)
Emit unused EH frames for weak definitions on Darwin,
because assembler/linker can't cope with weak absolutes. PR 1880. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45811 91177308-0d34-0410-b5e6-96231b3b80d8
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);