65816-llvm-mos/demos/heavyRelocs.c
2026-05-18 14:43:35 -05:00

38 lines
1.4 KiB
C

// heavyRelocs.c - stress test for ExpressLoad cRELOC handling.
#include "iigs/toolbox.h"
// Code padding via large initialized data (NOT const so it lands in
// .data and survives -O2 dead-strip).
volatile unsigned char gBigData[20000] = { [0 ... 19999] = 0xAA };
static unsigned char gA[16], gB[16], gC[16], gD[16];
static unsigned char gE[16], gF[16], gG[16], gH[16];
static unsigned char gI[16], gJ[16], gK[16], gL[16];
static unsigned char gM[16], gN[16], gO[16], gP[16];
static unsigned char gQ[16], gR[16], gS[16], gT[16];
static unsigned char gU[16], gV[16], gW[16], gX[16];
static unsigned char gY[16], gZ[16];
static unsigned char *gPtrs[100] = {
gA, gB, gC, gD, gE, gF, gG, gH, gI, gJ,
gK, gL, gM, gN, gO, gP, gQ, gR, gS, gT,
gU, gV, gW, gX, gY, gZ, gA, gB, gC, gD,
gE, gF, gG, gH, gI, gJ, gK, gL, gM, gN,
gO, gP, gQ, gR, gS, gT, gU, gV, gW, gX,
gY, gZ, gA, gB, gC, gD, gE, gF, gG, gH,
gI, gJ, gK, gL, gM, gN, gO, gP, gQ, gR,
gS, gT, gU, gV, gW, gX, gY, gZ, gA, gB,
gC, gD, gE, gF, gG, gH, gI, gJ, gK, gL,
gM, gN, gO, gP, gQ, gR, gS, gT, gU, gV,
};
int main(void) {
for (unsigned short i = 0; i < 100; i++) {
gPtrs[i][0] = (unsigned char)i;
}
gA[0] = gBigData[0] + gBigData[19999];
*(volatile unsigned char *)0x70 = 0x99;
// Brief linger for snapshot capture.
for (volatile unsigned long s = 0; s < 600000UL; s++) { }
return 0;
}