[stage2] Fix the ordering of rules in linker script

This commit is contained in:
TuxSH 2018-05-07 10:53:41 +02:00
parent 700f92162d
commit 7695b5bdbd
2 changed files with 22 additions and 17 deletions

View file

@ -15,13 +15,32 @@ SECTIONS
PROVIDE(__start__ = 0xFFF00000); PROVIDE(__start__ = 0xFFF00000);
. = __start__; . = __start__;
. = ALIGN(32); . = ALIGN(32);
.text :
.crt0 :
{ {
. = ALIGN(32); . = ALIGN(32);
/* .init */
KEEP( *(.text.start) ) KEEP( *(.text.start) )
KEEP( *(.init) ) KEEP( *(.init) )
. = ALIGN(4); . = ALIGN(4);
} >main
.chainloader :
{
. = ALIGN(32);
PROVIDE (__chainloader_start = .);
KEEP(*(.chainloader.text.start))
build/chainloader.o(.text*)
build/chainloader.o(.rodata*)
build/chainloader.o(.data*)
. = ALIGN(8);
build/chainloader.o(.bss* COMMON)
. = ALIGN(8);
PROVIDE (__chainloader_end = .);
} >low_iram AT>main
.text :
{
. = ALIGN(4);
/* .text */ /* .text */
*(.text) *(.text)
@ -102,20 +121,6 @@ SECTIONS
. = ALIGN(4); . = ALIGN(4);
} >main } >main
.chainloader :
{
. = ALIGN(32);
PROVIDE (__chainloader_start = .);
KEEP(*(.chainloader.text.start))
build/chainloader.o(.text*)
build/chainloader.o(.rodata*)
build/chainloader.o(.data*)
. = ALIGN(8);
build/chainloader.o(.bss*)
. = ALIGN(32);
PROVIDE (__chainloader_end = .);
} >low_iram AT>main
.bss : .bss :
{ {
__bss_start__ = ALIGN(32); __bss_start__ = ALIGN(32);

View file

@ -1,6 +1,6 @@
#include "chainloader.h" #include "chainloader.h"
uint8_t g_payload_arg_data[PAYLOAD_ARG_DATA_MAX_SIZE] = {1}; uint8_t __attribute__((used)) g_payload_arg_data[PAYLOAD_ARG_DATA_MAX_SIZE] = {0};
#pragma GCC optimize (3) #pragma GCC optimize (3)
void relocate_and_chainload_main(uintptr_t load_address, uintptr_t src_address, size_t size, int argc) { void relocate_and_chainload_main(uintptr_t load_address, uintptr_t src_address, size_t size, int argc) {