mirror of
https://github.com/autc04/Retro68.git
synced 2025-02-20 17:29:17 +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_7t)
|
||||||
*(.glue_7)
|
*(.glue_7)
|
||||||
*(.jcr)
|
*(.jcr)
|
||||||
|
. = ALIGN (4) ;
|
||||||
@SYMBOL_PREFIX@__init_section = . ;
|
@SYMBOL_PREFIX@__init_section = . ;
|
||||||
KEEP (*(.init))
|
KEEP (*(.init))
|
||||||
@SYMBOL_PREFIX@__init_section_end = . ;
|
@SYMBOL_PREFIX@__init_section_end = . ;
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#include <Processes.h>
|
#include <Processes.h>
|
||||||
#include <Sound.h>
|
#include <Sound.h>
|
||||||
#include <Memory.h>
|
#include <Memory.h>
|
||||||
@ -60,8 +62,17 @@ void _start()
|
|||||||
|
|
||||||
for(i = 0; i < n; i++)
|
for(i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
long *addr = (long*)(relocs[i] + displacement);
|
uint8_t *addrPtr = (uint8_t*)(relocs[i] + displacement);
|
||||||
*addr += (*addr >= data_end ? bss_displacement : 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…
x
Reference in New Issue
Block a user