- FnSym.Value = FnStartOff;
-
- // Locals should go on the symbol list front
- if (!F->hasPrivateLinkage()) {
- if (FnSym.getBind() == ELFSym::STB_LOCAL)
- EW.SymbolList.push_front(FnSym);
- else
- EW.SymbolList.push_back(FnSym);
+ FnSym->Value = FnStartOff;
+
+ if (!F->hasPrivateLinkage())
+ EW.SymbolList.push_back(FnSym);
+
+ // Patch up Jump Table Section relocations to use the real MBBs offsets
+ // now that the MBB label offsets inside the function are known.
+ if (!MF.getJumpTableInfo()->isEmpty()) {
+ ELFSection &JTSection = EW.getJumpTableSection();
+ for (std::vector<MachineRelocation>::iterator MRI = JTRelocations.begin(),
+ MRE = JTRelocations.end(); MRI != MRE; ++MRI) {
+ MachineRelocation &MR = *MRI;
+ unsigned MBBOffset = getMachineBasicBlockAddress(MR.getBasicBlock());
+ MR.setResultPointer((void*)MBBOffset);
+ MR.setConstantVal(ES->SectionIdx);
+ JTSection.addRelocation(MR);
+ }