diff options
| author | Dale Johannesen <dalej@apple.com> | 2008-01-10 02:03:30 +0000 |
|---|---|---|
| committer | Dale Johannesen <dalej@apple.com> | 2008-01-10 02:03:30 +0000 |
| commit | 7ecb3b79c7f3cadda88f743bf190096fcfca716b (patch) | |
| tree | de34c97a8c7fd3894c847b61979f1533545c681e /llvm/lib/CodeGen/DwarfWriter.cpp | |
| parent | 2cbf2f39ee179276c3534a3cb31d15fa6005fcf0 (diff) | |
| download | bcm5719-llvm-7ecb3b79c7f3cadda88f743bf190096fcfca716b.tar.gz bcm5719-llvm-7ecb3b79c7f3cadda88f743bf190096fcfca716b.zip | |
Emit unused EH frames for weak definitions on Darwin,
because assembler/linker can't cope with weak absolutes.
PR 1880.
llvm-svn: 45811
Diffstat (limited to 'llvm/lib/CodeGen/DwarfWriter.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/DwarfWriter.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/DwarfWriter.cpp b/llvm/lib/CodeGen/DwarfWriter.cpp index c1091e9e7de..1f7618a533a 100644 --- a/llvm/lib/CodeGen/DwarfWriter.cpp +++ b/llvm/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); |

