Fix FLOATING in linker scripts conflicting with section constraints (#2148)

This commit is contained in:
Rangi authored and GitHub committed 2026-09-26 07:54:48 -04:00
1 parent 6a08e809b5
commit 03c71ced93
7 files changed
+90 -10

No files matched your search

+9
View File
@@ -0,0 +1,9 @@
DEF address EQU $100
SECTION "code", ROM0[address]
Start::
jp Start
assert STARTOF("code") == address
assert Start == address
+3
View File
@@ -0,0 +1,3 @@
ROM0
FLOATING
"code"
View File
Whitespace-only changes.
@@ -0,0 +1,11 @@
SECTION "fixed", ROM0[$1234]
SECTION "aligned", ROMX, ALIGN[8, 42]
SECTION "less aligned", ROMX, ALIGN[4, 1]
SECTION "more aligned", ROMX, ALIGN[8, 1]
SECTION "address compatible", ROMX[$4463]
SECTION "align compatible", ROMX, ALIGN[8, 99]
@@ -0,0 +1,21 @@
ROM0
FLOATING
ALIGN 8, 42
"fixed"
ROMX 1
FLOATING
ALIGN 8, 23
"aligned"
ROMX 2
FLOATING
ALIGN 8, 2
"less aligned"
ROMX 3
FLOATING
ALIGN 4, 2
"more aligned"
ROMX 4
FLOATING
ALIGN 8, 99
"address compatible"
"align compatible"
@@ -0,0 +1,9 @@
error: The linker script aligns floating section "fixed" to ALIGN[8, 42], but it was already at address $1234 which has ALIGN[8, 52]
at linkerscript-floating-conflict.link(4)
error: The linker script aligns floating section "aligned" to ALIGN[8, 23], but it already has requested ALIGN[8, 42]
at linkerscript-floating-conflict.link(8)
error: The linker script aligns floating section "less aligned" to ALIGN[8, 2], but it already has requested ALIGN[4, 1]
at linkerscript-floating-conflict.link(12)
error: The linker script aligns floating section "more aligned" to ALIGN[4, 2], but it already has requested ALIGN[8, 1]
at linkerscript-floating-conflict.link(16)
Linking failed with 4 errors