Skip to content

Commit

Permalink
Merge .text_init into .text on RISC-V (esp-rs#1038)
Browse files Browse the repository at this point in the history
* Merge `.text_init` into `.text`

* Only merge `init.*` into `.text` for RISC-V
  • Loading branch information
bjoernQ authored and Volkalex28 committed Feb 6, 2024
1 parent 47593c4 commit 1927d23
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 46 deletions.
13 changes: 1 addition & 12 deletions esp-hal-common/ld/esp32c2/esp32c2.x
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,6 @@ SECTIONS {
. = ABSOLUTE(_stext);
} > ROTEXT
}
INSERT BEFORE .text_init;

SECTIONS {
/* These symbols/functions need to be near eachother, group them together at the start of text */
.text_init _stext : ALIGN(4)
{
KEEP(*(.init));
KEEP(*(.init.rust));
KEEP(*(.text.abort));
} > ROTEXT
}
INSERT BEFORE .text;

SECTIONS {
Expand All @@ -75,7 +64,7 @@ SECTIONS {
/* Start at the same alignement constraint than .text */
. = ALIGN(4);
/* Create an empty gap as big as .text section */
. = . + SIZEOF(.text) + SIZEOF(.text_init);
. = . + SIZEOF(.text);
/* Prepare the alignement of the section above. Few bytes (0x20) must be
* added for the mapping header. */
. = ALIGN(0x10000) + 0x20;
Expand Down
13 changes: 1 addition & 12 deletions esp-hal-common/ld/esp32c3/esp32c3.x
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,6 @@ SECTIONS {
. = ABSOLUTE(_stext);
} > ROTEXT
}
INSERT BEFORE .text_init;

SECTIONS {
/* These symbols/functions need to be near eachother, group them together at the start of text */
.text_init _stext : ALIGN(4)
{
KEEP(*(.init));
KEEP(*(.init.rust));
KEEP(*(.text.abort));
} > ROTEXT
}
INSERT BEFORE .text;

SECTIONS {
Expand All @@ -75,7 +64,7 @@ SECTIONS {
/* Start at the same alignement constraint than .text */
. = ALIGN(4);
/* Create an empty gap as big as .text section */
. = . + SIZEOF(.text) + SIZEOF(.text_init);
. = . + SIZEOF(.text);
/* Prepare the alignement of the section above. Few bytes (0x20) must be
* added for the mapping header. */
. = ALIGN(0x10000) + 0x20;
Expand Down
11 changes: 0 additions & 11 deletions esp-hal-common/ld/esp32c6/esp32c6.x
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,6 @@ PROVIDE(interrupt0 = DefaultHandler);
/* Must be called __global_pointer$ for linker relaxations to work. */
PROVIDE(__global_pointer$ = _data_start + 0x800);

SECTIONS {
/* These symbols/functions need to be near eachother, group them together at the start of text */
.text_init _stext : ALIGN(4)
{
KEEP(*(.init));
KEEP(*(.init.rust));
KEEP(*(.text.abort));
} > ROTEXT
}
INSERT BEFORE .text;

SECTIONS {
.trap : ALIGN(4)
{
Expand Down
11 changes: 0 additions & 11 deletions esp-hal-common/ld/esp32h2/esp32h2.x
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,6 @@ PROVIDE(_start_trap = default_start_trap);
/* Must be called __global_pointer$ for linker relaxations to work. */
PROVIDE(__global_pointer$ = _data_start + 0x800);

SECTIONS {
/* These symbols/functions need to be near eachother, group them together at the start of text */
.text_init _stext : ALIGN(4)
{
KEEP(*(.init));
KEEP(*(.init.rust));
KEEP(*(.text.abort));
} > ROTEXT
}
INSERT BEFORE .text;

SECTIONS {
.trap : ALIGN(4)
{
Expand Down
5 changes: 5 additions & 0 deletions esp-hal-common/ld/sections/text.x
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ SECTIONS {

.text : ALIGN(4)
{
#IF riscv
KEEP(*(.init));
KEEP(*(.init.rust));
KEEP(*(.text.abort));
#ENDIF
*(.literal .text .literal.* .text.*)
} > ROTEXT

Expand Down

0 comments on commit 1927d23

Please sign in to comment.