arm64_head.S: Add explicit input section for __start

As __start must be placed at a precise location, a separate, explicit
input section is needed to guarantee this.

Why is this an issue ? NuttX uses --entry=__start which puts __start in
its correct location, but out-of-tree builds won't work, so it more robust
to use an explicit section for the startup code and enforce its placement
in the linker script.
This commit is contained in:
Ville Juven 2024-03-22 14:19:00 +02:00 committed by Xiang Xiao
parent 63a0a544be
commit 738bdb95b7
8 changed files with 9 additions and 1 deletions

View file

@ -89,6 +89,8 @@ label: .asciz msg; \
* This must be the very first address in the loaded image.
* It should be loaded at any 4K-aligned address.
*/
.section .start, "ax"
.globl __start;
__start:

View file

@ -33,6 +33,7 @@ SECTIONS
_start = .;
.text : {
_stext = .; /* Text section */
*(.start .start.*) /* Place __start here */
*(.text)
*(.text.cold)
*(.text.unlikely)

View file

@ -33,6 +33,7 @@ SECTIONS
_start = .;
.text : {
_stext = .; /* Text section */
*(.start .start.*) /* Place __start here */
*(.text)
*(.text.cold)
*(.text.unlikely)

View file

@ -33,6 +33,7 @@ SECTIONS
_start = .;
.text : {
_stext = .; /* Text section */
*(.start .start.*) /* Place __start here */
*(.text)
*(.text.cold)
*(.text.unlikely)

View file

@ -50,7 +50,7 @@ SECTIONS
.text :
{
_stext = ABSOLUTE(.); /* Text section */
*(.text.__start) /* Place __start here */
*(.start .start.*) /* Place __start here */
*(.text .text.*)
*(.text.cold)
*(.text.unlikely)

View file

@ -33,6 +33,7 @@ SECTIONS
_start = .;
.text : {
_stext = .; /* Text section */
*(.start .start.*) /* Place __start here */
*(.text)
*(.text.cold)
*(.text.unlikely)

View file

@ -43,6 +43,7 @@ SECTIONS
_start = .;
.text : {
_stext = .; /* Text section */
*(.start .start.*) /* Place __start here */
*(.text)
*(.text.cold)
*(.text.unlikely)

View file

@ -34,6 +34,7 @@ SECTIONS
_start = .;
.text : {
_stext = .; /* Text section */
*(.start .start.*) /* Place __start here */
*(.text)
*(.text.cold)
*(.text.unlikely)