Compare commits
No commits in common. "d9b8a98da2b9d5eca55bed4b9f6d999c86ecab6c" and "26cc6eb96a90fb86352e0cc06c1e7ac9025ad109" have entirely different histories.
d9b8a98da2
...
26cc6eb96a
2 changed files with 11 additions and 11 deletions
0
link816.cpp
Normal file
0
link816.cpp
Normal file
|
|
@ -431,7 +431,6 @@ struct Imm24Site {
|
||||||
static std::vector<Imm24Site> gImm24Sites;
|
static std::vector<Imm24Site> gImm24Sites;
|
||||||
static uint32_t gTextBaseForSites = 0;
|
static uint32_t gTextBaseForSites = 0;
|
||||||
static bool gRecordSites = false;
|
static bool gRecordSites = false;
|
||||||
static unsigned long gBank0DataSites = 0;
|
|
||||||
|
|
||||||
// --report-self-mod: audit diagnostic. Reports every intra-.text-section
|
// --report-self-mod: audit diagnostic. Reports every intra-.text-section
|
||||||
// IMM16 reference made with a STORE opcode (absolute, DBR-relative) into the
|
// IMM16 reference made with a STORE opcode (absolute, DBR-relative) into the
|
||||||
|
|
@ -806,14 +805,17 @@ static void applyTextReloc(std::vector<uint8_t> &buf, uint32_t off,
|
||||||
// per-seg list for seg 1, since rodata is in seg 1's bank by
|
// per-seg list for seg 1, since rodata is in seg 1's bank by
|
||||||
// design).
|
// design).
|
||||||
if (targetSeg == 0) {
|
if (targetSeg == 0) {
|
||||||
// BANK-0 DATA/BSS target (inside SEG1's payload) referenced from an overflow segment: the
|
// BANK-0 DATA/BSS target (inside SEG1's payload) referenced with a LONG form from an
|
||||||
// GS/OS Loader honors at most PAGE alignment (it ignores OMF ALIGN=$10000), so seg1 loads
|
// overflow segment: the baked bank byte would be the LINK-TIME bank (0), but the Loader
|
||||||
// at an arbitrary in-bank offset and every baked data operand from another segment misses
|
// places seg1 in an arbitrary bank - every such read/write silently hits the wrong bank
|
||||||
// by that offset (measured live on the RetroNet IIgs client: functions packed into seg1
|
// (measured live on the RetroNet IIgs client: cross-TU constant-index accesses compile to
|
||||||
// worked, everything else read/wrote unowned memory - MAME memory-tap proven). Emit
|
// LDA long and returned garbage while DBR-relative abs16 to the same symbols worked).
|
||||||
// cINTERSEG records against seg 1 so the Loader writes the true placed address: 3 bytes
|
// Emit a 3-byte cINTERSEG against seg 1 so the Loader writes the true 24-bit address.
|
||||||
// for IMM24/DATA32, 2 for IMM16 (bank comes from DBR - BANKSIZE=$10000 keeps seg1 within
|
// ...and the SAME hole exists for 16-bit forms: seg1 is only PAGE-aligned by the real
|
||||||
// one bank), 2+shift16 for BANK16.
|
// GS/OS Loader (it does not honor ALIGN=$10000), so abs16 operands and bank-byte
|
||||||
|
// materializations referencing seg1 data are wrong by seg1's placement offset unless the
|
||||||
|
// Loader patches them. Emit 2-byte cINTERSEG records for those too; BANKSIZE=$10000
|
||||||
|
// guarantees seg1 never straddles a bank, so offset16+DBR stays coherent.
|
||||||
if (gRecordSites && patchSeg >= 1 && !segments.empty() &&
|
if (gRecordSites && patchSeg >= 1 && !segments.empty() &&
|
||||||
(rtype == R_W65816_IMM24 || rtype == R_W65816_DATA32 ||
|
(rtype == R_W65816_IMM24 || rtype == R_W65816_DATA32 ||
|
||||||
rtype == R_W65816_IMM16 || rtype == R_W65816_BANK16) &&
|
rtype == R_W65816_IMM16 || rtype == R_W65816_BANK16) &&
|
||||||
|
|
@ -829,7 +831,6 @@ static void applyTextReloc(std::vector<uint8_t> &buf, uint32_t off,
|
||||||
s.byteCnt = cnt;
|
s.byteCnt = cnt;
|
||||||
s.bitShift = (rtype == R_W65816_BANK16) ? 16 : 0;
|
s.bitShift = (rtype == R_W65816_BANK16) ? 16 : 0;
|
||||||
gInterImm24Sites.push_back(s);
|
gInterImm24Sites.push_back(s);
|
||||||
gBank0DataSites++;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
applyReloc(buf, off, patchAddr, target, rtype, symName);
|
applyReloc(buf, off, patchAddr, target, rtype, symName);
|
||||||
|
|
@ -2603,7 +2604,6 @@ int main(int argc, char **argv) {
|
||||||
linker.writeMultiSegment(outPath, linker.manifestPath, "__start");
|
linker.writeMultiSegment(outPath, linker.manifestPath, "__start");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::fprintf(stderr, "link816: %lu bank0-data cINTERSEG sites\n", gBank0DataSites);
|
|
||||||
std::fprintf(stderr,
|
std::fprintf(stderr,
|
||||||
"linked: text=[0x%04x+%u] rodata=[0x%04x+%u] bss=[0x%04x+%u] "
|
"linked: text=[0x%04x+%u] rodata=[0x%04x+%u] bss=[0x%04x+%u] "
|
||||||
"-> %s (%zu bytes)",
|
"-> %s (%zu bytes)",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue