[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);
. = __start__;
. = ALIGN(32);
.text :
.crt0 :
{
. = ALIGN(32);
/* .init */
KEEP( *(.text.start) )
KEEP( *(.init) )
. = 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)
@ -102,20 +121,6 @@ SECTIONS
. = 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*)
. = ALIGN(32);
PROVIDE (__chainloader_end = .);
} >low_iram AT>main
.bss :
{
__bss_start__ = ALIGN(32);

View File

@ -1,6 +1,6 @@
#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)
void relocate_and_chainload_main(uintptr_t load_address, uintptr_t src_address, size_t size, int argc) {