+ if (objFile->getArch() == ::Loader::Power)
+ argsInit<uint32_t>(PageBytes);
+ else
+ argsInit<uint64_t>(PageBytes);
+
+ // Fix up entry point and symbol table for 64-bit ELF ABI v1
+ if (objFile->getOpSys() != ::Loader::LinuxPower64ABIv1)
+ return;
+
+ // Fix entry point address and the base TOC pointer by looking the
+ // the function descriptor in the .opd section
+ Addr entryPoint, tocBase;
+ ByteOrder byteOrder = objFile->getByteOrder();
+ ThreadContext *tc = system->threads[contextIds[0]];
+
+ // The first doubleword of the descriptor contains the address of the
+ // entry point of the function
+ initVirtMem->readBlob(getStartPC(), &entryPoint, sizeof(Addr));
+
+ // Update the PC state
+ auto pc = tc->pcState();
+ pc.byteOrder(byteOrder);
+ pc.set(gtoh(entryPoint, byteOrder));
+ tc->pcState(pc);
+
+ // The second doubleword of the descriptor contains the TOC base
+ // address for the function
+ initVirtMem->readBlob(getStartPC() + 8, &tocBase, sizeof(Addr));
+ tc->setIntReg(TOCPointerReg, gtoh(tocBase, byteOrder));
+
+ // Fix symbol table entries as they would otherwise point to the
+ // function descriptor rather than the actual entry point address
+ auto *symbolTable = new ::Loader::SymbolTable;
+
+ for (auto sym : ::Loader::debugSymbolTable) {
+ Addr entry;
+ ::Loader::Symbol symbol = sym;
+
+ // Try to read entry point from function descriptor
+ if (initVirtMem->tryReadBlob(sym.address, &entry, sizeof(Addr)))
+ symbol.address = gtoh(entry, byteOrder);
+
+ symbolTable->insert(symbol);
+ }
+
+ // Replace the current debug symbol table
+ ::Loader::debugSymbolTable.clear();
+ ::Loader::debugSymbolTable.insert(*symbolTable);
+ delete symbolTable;