diff --git a/src/link/layout.cpp b/src/link/layout.cpp index 342e50b0..4ca65cc0 100644 --- a/src/link/layout.cpp +++ b/src/link/layout.cpp @@ -126,7 +126,7 @@ void layout_AlignTo(uint32_t alignment, uint32_t alignOfs) { if (isPcFloating) { if (alignment >= 16) { - layout_SetAddr(floatingAlignOffset); + layout_SetAddr(alignOfs); } else { uint32_t alignSize = 1u << alignment; uint32_t alignMask = alignSize - 1; diff --git a/test/link/floating-align16-script.asm b/test/link/floating-align16-script.asm new file mode 100644 index 00000000..e973990d --- /dev/null +++ b/test/link/floating-align16-script.asm @@ -0,0 +1,3 @@ +SECTION "test", ROM0 + assert @ == $80 ; Set by the linker script. +Label:: db 42 ; Make the section non-empty. diff --git a/test/link/floating-align16-script.link b/test/link/floating-align16-script.link new file mode 100644 index 00000000..29243010 --- /dev/null +++ b/test/link/floating-align16-script.link @@ -0,0 +1,4 @@ +ROM0 + FLOATING + ALIGN 16, $80 + "test" diff --git a/test/link/floating-align16-script.out b/test/link/floating-align16-script.out new file mode 100644 index 00000000..e69de29b