Skip to content

Commit

Permalink
arm64_head.S: Add explicit input section for __start
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pussuw committed Mar 25, 2024
1 parent c5b86b5 commit c06059b
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions arch/arm64/src/common/arm64_head.S
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
1 change: 1 addition & 0 deletions boards/arm64/a64/pinephone/scripts/dramboot.ld
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ SECTIONS
_start = .;
.text : {
_stext = .; /* Text section */
*(.start .start.*) /* Place __start here */
*(.text)
*(.text.cold)
*(.text.unlikely)
Expand Down
1 change: 1 addition & 0 deletions boards/arm64/fvp-v8r/fvp-armv8r/scripts/dramboot.ld
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ SECTIONS
_start = .;
.text : {
_stext = .; /* Text section */
*(.start .start.*) /* Place __start here */
*(.text)
*(.text.cold)
*(.text.unlikely)
Expand Down
1 change: 1 addition & 0 deletions boards/arm64/imx8/imx8qm-mek/scripts/dramboot.ld
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ SECTIONS
_start = .;
.text : {
_stext = .; /* Text section */
*(.start .start.*) /* Place __start here */
*(.text)
*(.text.cold)
*(.text.unlikely)
Expand Down
2 changes: 1 addition & 1 deletion boards/arm64/imx9/imx93-evk/scripts/dramboot.ld
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions boards/arm64/qemu/qemu-armv8a/scripts/dramboot.ld
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ SECTIONS
_start = .;
.text : {
_stext = .; /* Text section */
*(.start .start.*) /* Place __start here */
*(.text)
*(.text.cold)
*(.text.unlikely)
Expand Down
1 change: 1 addition & 0 deletions boards/arm64/rk3399/nanopi_m4/scripts/dramboot.ld
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ SECTIONS
_start = .;
.text : {
_stext = .; /* Text section */
*(.start .start.*) /* Place __start here */
*(.text)
*(.text.cold)
*(.text.unlikely)
Expand Down
1 change: 1 addition & 0 deletions boards/arm64/rk3399/pinephonepro/scripts/dramboot.ld
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ SECTIONS
_start = .;
.text : {
_stext = .; /* Text section */
*(.start .start.*) /* Place __start here */
*(.text)
*(.text.cold)
*(.text.unlikely)
Expand Down

0 comments on commit c06059b

Please sign in to comment.