summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-03-15 20:39:00 +0000
committerChris Lattner <sabre@nondot.org>2010-03-15 20:39:00 +0000
commit561334a81fc14a15388e94d05aea3c6232620374 (patch)
treebf74c8b5b057cc4cd0685a025cec1c35c520c876 /llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
parentc116a8707a0cd1e2acb65a8368961305acf7c290 (diff)
downloadbcm5719-llvm-561334a81fc14a15388e94d05aea3c6232620374.tar.gz
bcm5719-llvm-561334a81fc14a15388e94d05aea3c6232620374.zip
Implement support for the case when a reference to a addr-of-bb
label is generated, but then the block is deleted. Since the value is undefined, we just emit the label right after the entry label of the function. It might matter that the label is in the same section as the function was afterall. llvm-svn: 98579
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 63b05365d1c..fe78b23debd 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -307,6 +307,16 @@ void AsmPrinter::EmitFunctionHeader() {
// do their wild and crazy things as required.
EmitFunctionEntryLabel();
+ // If the function had address-taken blocks that got deleted, then we have
+ // references to the dangling symbols. Emit them at the start of the function
+ // so that we don't get references to undefined symbols.
+ std::vector<MCSymbol*> DeadBlockSyms;
+ MMI->takeDeletedSymbolsForFunction(F, DeadBlockSyms);
+ for (unsigned i = 0, e = DeadBlockSyms.size(); i != e; ++i) {
+ OutStreamer.AddComment("Address taken block that was later removed");
+ OutStreamer.EmitLabel(DeadBlockSyms[i]);
+ }
+
// Add some workaround for linkonce linkage on Cygwin\MinGW.
if (MAI->getLinkOnceDirective() != 0 &&
(F->hasLinkOnceLinkage() || F->hasWeakLinkage()))
OpenPOWER on IntegriCloud