[llvm-dev] [Sparc] Undefined temporary symbol

Chris.Dewhurst via llvm-dev llvm-dev at lists.llvm.org
Wed Apr 27 15:49:09 PDT 2016


Hi,

I'm trying to work out what to do to eliminate an "Undefined temporary symbol", which has appeared after I had thought I'd cleared up the last problems trying to implement __builtin_setjmp.

I know that the symbol it's referring to is "sinkMBB" in the two BuildMI instructions in the code fragment below, as the problem goes away if I remove these lines temporarily (although the algorithm doesn't work then).

What must I do to eliminate the Undefined Temporary Symbol error, later in the compilation process (raised at ElfObjectWriter.cpp:803)?

Chris Dewhurst, Lero, University of Limerick

+   const BasicBlock *BB = MBB->getBasicBlock();
+   MachineFunction::iterator It = ++MBB->getIterator();
+   MachineBasicBlock *thisMBB = MBB;
+   const BasicBlock* mainBB = BasicBlock::Create(BB->getContext(), "setjmp.main");
+   MachineBasicBlock *mainMBB = MF->CreateMachineBasicBlock(mainBB);
+   mainMBB->setHasAddressTaken();
+   const BasicBlock* sinkBB = BasicBlock::Create(BB->getContext(), "setjmp.sink");
+   MachineBasicBlock *sinkMBB = MF->CreateMachineBasicBlock(sinkBB);
+   sinkMBB->setHasAddressTaken();
+
+   MF->insert(It, mainMBB);
+   MF->insert(It, sinkMBB);
+
+   // Transfer the remainder of BB and its successor edges to sinkMBB.
+   sinkMBB->splice(sinkMBB->begin(), MBB,
+                   std::next(MachineBasicBlock::iterator(MI)),
+                   MBB->end());
+   sinkMBB->transferSuccessorsAndUpdatePHIs(MBB);
+
+   MachineInstrBuilder MIB;
+
+   unsigned LabelReg = MRI.createVirtualRegister(&SP::IntRegsRegClass);
+   unsigned BufReg = MI->getOperand(1).getReg();
+
+   MIB = BuildMI(*thisMBB, MI, DL, TII->get(SP::SETHIi))
+             .addReg(LabelReg, RegState::Define)
+             .addMBB(sinkMBB, SparcMCExpr::VK_Sparc_HI);
+   MIB.setMemRefs(MMOBegin, MMOEnd);
+
+   MIB = BuildMI(*thisMBB, MI, DL, TII->get(SP::ADDri))
+             .addReg(LabelReg)
+             .addReg(LabelReg)
+             .addMBB(sinkMBB, SparcMCExpr::VK_Sparc_LO);
+   MIB.setMemRefs(MMOBegin, MMOEnd);
+
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160427/fa5f6c4f/attachment.html>


More information about the llvm-dev mailing list