Merge branch 'main'
This commit is contained in:
commit
d9b8a98da2
2 changed files with 14 additions and 0 deletions
|
|
@ -549,9 +549,16 @@ static uint32_t relocWidth(uint8_t rtype) {
|
|||
}
|
||||
|
||||
|
||||
unsigned long gDbgBareCalls = 0;
|
||||
unsigned long gDbgTextCalls = 0;
|
||||
static void applyReloc(std::vector<uint8_t> &buf, uint32_t off,
|
||||
uint32_t patchAddr, uint32_t target,
|
||||
uint8_t rtype, const std::string &symName) {
|
||||
extern unsigned long gDbgBareCalls;
|
||||
gDbgBareCalls++;
|
||||
if (symName.find("gRnInPack") != std::string::npos) {
|
||||
std::fprintf(stderr, "TRACE-BARE %s rtype=%u target=0x%X off=0x%X\n", symName.c_str(), rtype, target, off);
|
||||
}
|
||||
int64_t pcrelDisp;
|
||||
switch (rtype) {
|
||||
case R_W65816_IMM8:
|
||||
|
|
@ -767,6 +774,12 @@ static void applyTextReloc(std::vector<uint8_t> &buf, uint32_t off,
|
|||
}
|
||||
const TextSeg &pseg = segments[patchSeg - 1];
|
||||
uint32_t targetSeg = findSegContaining(target, segments);
|
||||
gDbgTextCalls++;
|
||||
// TEMP TRACE (RetroNet hunt): decisions for the mirror-pack refs.
|
||||
if (symName.find("gRnInPack") != std::string::npos) {
|
||||
std::fprintf(stderr, "TRACE %s rtype=%u patchSeg=%u targetSeg=%u target=0x%X rec=%d\n",
|
||||
symName.c_str(), rtype, patchSeg, targetSeg, target, (int)gRecordSites);
|
||||
}
|
||||
// Cross-segment FUNCTION POINTER (IMM16 &func to a function in seg2+):
|
||||
// clang forms the pointer as func's 16-bit offset + the $00BE seg1 bank,
|
||||
// which is wrong for a function in another bank. Redirect the IMM16 to
|
||||
|
|
@ -2598,6 +2611,7 @@ int main(int argc, char **argv) {
|
|||
L.bssBase, L.bssSize,
|
||||
outPath.c_str(), image.size());
|
||||
if (L.segments.size() > 1) {
|
||||
std::fprintf(stderr, " [dbg: textReloc=%lu bare=%lu]", gDbgTextCalls, gDbgBareCalls);
|
||||
std::fprintf(stderr, " + %zu extra segments",
|
||||
L.segments.size() - 1);
|
||||
for (size_t k = 1; k < L.segments.size(); ++k) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue