mirror of
https://github.com/autc04/Retro68.git
synced 2024-12-22 19:30:36 +00:00
zero-terminate relocation list
This commit is contained in:
parent
5059b87fe4
commit
57906f91c1
@ -170,6 +170,7 @@ void ElfToFlt(string input, string output)
|
|||||||
byte(out, 0x00);
|
byte(out, 0x00);
|
||||||
for(int reloc : relocs)
|
for(int reloc : relocs)
|
||||||
longword(out, reloc);
|
longword(out, reloc);
|
||||||
|
longword(out, -1); // not part of the FLT specification: terminate reloc list
|
||||||
}
|
}
|
||||||
|
|
||||||
string argvZero;
|
string argvZero;
|
||||||
|
@ -99,7 +99,7 @@ static Retro68RelocState relocState __attribute__ ((nocommon, section(".text")))
|
|||||||
} while(0)
|
} while(0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if 1
|
||||||
#define log(x) do { } while(0)
|
#define log(x) do { } while(0)
|
||||||
#else
|
#else
|
||||||
#define log(x) do { \
|
#define log(x) do { \
|
||||||
@ -230,17 +230,16 @@ void Retro68Relocate()
|
|||||||
|
|
||||||
|
|
||||||
long n = header->reloc_count;
|
long n = header->reloc_count;
|
||||||
long *relocs = (long*)( (char*)header + header->reloc_start );
|
|
||||||
|
|
||||||
long i;
|
|
||||||
uint32_t text_and_data_size = orig_edata - orig_stext;
|
uint32_t text_and_data_size = orig_edata - orig_stext;
|
||||||
uint32_t total_size = orig_ebss - orig_stext; // FIXME: not true for repeated reloc
|
uint32_t total_size = orig_ebss - orig_stext; // FIXME: not true for repeated reloc
|
||||||
long bss_displacement = 0;
|
|
||||||
|
|
||||||
|
|
||||||
assert(text_and_data_size == header->data_end - sizeof(*header));
|
assert(text_and_data_size == header->data_end - sizeof(*header));
|
||||||
assert((uint8_t*)relocs == base + text_and_data_size);
|
|
||||||
assert(total_size == header->bss_end - sizeof(*header));
|
assert(total_size == header->bss_end - sizeof(*header));
|
||||||
|
|
||||||
|
long bss_displacement = 0;
|
||||||
// Allocate BSS section (uninitialized/zero-initialized global data)
|
// Allocate BSS section (uninitialized/zero-initialized global data)
|
||||||
if(!rState->bssPtr)
|
if(!rState->bssPtr)
|
||||||
{
|
{
|
||||||
@ -252,11 +251,15 @@ void Retro68Relocate()
|
|||||||
bss_displacement = (uint8_t*)rState->bssPtr - &_sbss;
|
bss_displacement = (uint8_t*)rState->bssPtr - &_sbss;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long i;
|
||||||
// Process relocation records
|
// Process relocation records
|
||||||
for(i = 0; i < n; i++)
|
|
||||||
|
for(long *reloc = (long*)( base + text_and_data_size );
|
||||||
|
*reloc != -1;
|
||||||
|
++reloc)
|
||||||
{
|
{
|
||||||
//Debugger();
|
//Debugger();
|
||||||
uint8_t *addrPtr = base + relocs[i];
|
uint8_t *addrPtr = base + *reloc;
|
||||||
uint32_t addr;
|
uint32_t addr;
|
||||||
|
|
||||||
/*log(relocs + i);
|
/*log(relocs + i);
|
||||||
|
Loading…
Reference in New Issue
Block a user