From 36dad4380e028951f84196b7b2f2682ff623aa8a Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Sun, 18 Feb 2024 22:23:45 +0100 Subject: [PATCH] Honor alignment offset for `ALIGN[16, N]` The *one* place where it was missed... --- src/asm/section.cpp | 2 +- test/link/align16.asm | 3 +++ test/link/align16.link | 4 ++++ test/link/align16.out | 0 test/link/align16.out.bin | Bin 0 -> 6 bytes 5 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 test/link/align16.asm create mode 100644 test/link/align16.link create mode 100644 test/link/align16.out create mode 100644 test/link/align16.out.bin diff --git a/src/asm/section.cpp b/src/asm/section.cpp index 1d9428ee..29a199d5 100644 --- a/src/asm/section.cpp +++ b/src/asm/section.cpp @@ -355,7 +355,7 @@ static struct Section *getSection(char const *name, enum SectionType type, uint3 } else if (alignment == 16) { // Treat an alignment of 16 as being fixed at address 0 alignment = 0; - org = 0; + org = alignOffset; // The address is known to be valid, since the alignment is } } diff --git a/test/link/align16.asm b/test/link/align16.asm new file mode 100644 index 00000000..65cf1b16 --- /dev/null +++ b/test/link/align16.asm @@ -0,0 +1,3 @@ +SECTION "test", ROM0, ALIGN[16, 3] + align 16, 3 + db 1, 2, 3 diff --git a/test/link/align16.link b/test/link/align16.link new file mode 100644 index 00000000..2d030c83 --- /dev/null +++ b/test/link/align16.link @@ -0,0 +1,4 @@ +ROM0 + org 3 + align 16,3 + "test" diff --git a/test/link/align16.out b/test/link/align16.out new file mode 100644 index 00000000..e69de29b diff --git a/test/link/align16.out.bin b/test/link/align16.out.bin new file mode 100644 index 0000000000000000000000000000000000000000..43ac43a55b18f8be85a39c279e44d3b4734825d3 GIT binary patch literal 6 NcmZQzU|?io1^@sM00#g7 literal 0 HcmV?d00001