mirror of
https://github.com/autc04/Retro68.git
synced 2024-11-26 06:49:33 +00:00
deal with odd-address errors:
handle non-aligned relocations make sure .init/.fini sections are aligned
This commit is contained in:
parent
69ecf7f5e0
commit
012f491d4e
@ -24,6 +24,7 @@ SECTIONS {
|
||||
*(.glue_7t)
|
||||
*(.glue_7)
|
||||
*(.jcr)
|
||||
. = ALIGN (4) ;
|
||||
@SYMBOL_PREFIX@__init_section = . ;
|
||||
KEEP (*(.init))
|
||||
@SYMBOL_PREFIX@__init_section_end = . ;
|
||||
|
@ -1,3 +1,5 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include <Processes.h>
|
||||
#include <Sound.h>
|
||||
#include <Memory.h>
|
||||
@ -60,8 +62,17 @@ void _start()
|
||||
|
||||
for(i = 0; i < n; i++)
|
||||
{
|
||||
long *addr = (long*)(relocs[i] + displacement);
|
||||
*addr += (*addr >= data_end ? bss_displacement : displacement);
|
||||
uint8_t *addrPtr = (uint8_t*)(relocs[i] + displacement);
|
||||
long addr;
|
||||
|
||||
addr = (addrPtr[0] << 24) | (addrPtr[1] << 16) | (addrPtr[2] << 8) | addrPtr[3];
|
||||
|
||||
addr += addr >= data_end ? bss_displacement : displacement;
|
||||
|
||||
addrPtr[0] = addr >> 24;
|
||||
addrPtr[1] = addr >> 16;
|
||||
addrPtr[2] = addr >> 8;
|
||||
addrPtr[3] = addr;
|
||||
}
|
||||
|
||||
/* {
|
||||
|
Loading…
Reference in New Issue
Block a user