mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Fix section merge alignment error message (#919)
Co-authored-by: Eldred Habert <eldredhabert0@gmail.com>
This commit is contained in:
@@ -160,9 +160,9 @@ static unsigned int mergeSectUnion(struct Section *sect, enum SectionType type,
|
|||||||
/* Check if alignment offsets are compatible */
|
/* Check if alignment offsets are compatible */
|
||||||
} else if ((alignOffset & mask(sect->align))
|
} else if ((alignOffset & mask(sect->align))
|
||||||
!= (sect->alignOfs & mask(alignment))) {
|
!= (sect->alignOfs & mask(alignment))) {
|
||||||
fail("Section already declared with incompatible %" PRIu8
|
fail("Section already declared with incompatible %u"
|
||||||
"-byte alignment (offset %" PRIu16 ")\n",
|
"-byte alignment (offset %" PRIu16 ")\n",
|
||||||
sect->align, sect->alignOfs);
|
1u << sect->align, sect->alignOfs);
|
||||||
} else if (alignment > sect->align) {
|
} else if (alignment > sect->align) {
|
||||||
// If the section is not fixed, its alignment is the largest of both
|
// If the section is not fixed, its alignment is the largest of both
|
||||||
sect->align = alignment;
|
sect->align = alignment;
|
||||||
@@ -213,9 +213,9 @@ static unsigned int mergeFragments(struct Section *sect, enum SectionType type,
|
|||||||
PRIx32 "\n", sect->org);
|
PRIx32 "\n", sect->org);
|
||||||
/* Check if alignment offsets are compatible */
|
/* Check if alignment offsets are compatible */
|
||||||
} else if ((curOfs & mask(sect->align)) != (sect->alignOfs & mask(alignment))) {
|
} else if ((curOfs & mask(sect->align)) != (sect->alignOfs & mask(alignment))) {
|
||||||
fail("Section already declared with incompatible %" PRIu8
|
fail("Section already declared with incompatible %u"
|
||||||
"-byte alignment (offset %" PRIu16 ")\n",
|
"-byte alignment (offset %" PRIu16 ")\n",
|
||||||
sect->align, sect->alignOfs);
|
1u << sect->align, sect->alignOfs);
|
||||||
} else if (alignment > sect->align) {
|
} else if (alignment > sect->align) {
|
||||||
// If the section is not fixed, its alignment is the largest of both
|
// If the section is not fixed, its alignment is the largest of both
|
||||||
sect->align = alignment;
|
sect->align = alignment;
|
||||||
|
|||||||
8
test/asm/incompatible-alignment.asm
Normal file
8
test/asm/incompatible-alignment.asm
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
; These section fragments have alignments that make them non-contiguous,
|
||||||
|
; and thus are incompatible
|
||||||
|
|
||||||
|
SECTION FRAGMENT "Test", ROM0,ALIGN[8]
|
||||||
|
|
||||||
|
ds 1
|
||||||
|
|
||||||
|
SECTION FRAGMENT "Test", ROM0,ALIGN[8]
|
||||||
4
test/asm/incompatible-alignment.err
Normal file
4
test/asm/incompatible-alignment.err
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
ERROR: incompatible-alignment.asm(8):
|
||||||
|
Section already declared with incompatible 256-byte alignment (offset 0)
|
||||||
|
FATAL: incompatible-alignment.asm(8):
|
||||||
|
Cannot create section "Test" (1 error)
|
||||||
0
test/asm/incompatible-alignment.out
Normal file
0
test/asm/incompatible-alignment.out
Normal file
@@ -1,6 +1,6 @@
|
|||||||
error: Section "conflicting alignment" is defined with conflicting 8-byte alignment (offset 7) and 16-byte alignment (offset 14)
|
error: Section "conflicting alignment" is defined with conflicting 8-byte alignment (offset 7) and 16-byte alignment (offset 14)
|
||||||
---
|
---
|
||||||
ERROR: <stdin>(18):
|
ERROR: <stdin>(18):
|
||||||
Section already declared with incompatible 3-byte alignment (offset 7)
|
Section already declared with incompatible 8-byte alignment (offset 7)
|
||||||
FATAL: <stdin>(18):
|
FATAL: <stdin>(18):
|
||||||
Cannot create section "conflicting alignment" (1 error)
|
Cannot create section "conflicting alignment" (1 error)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
error: Section "conflicting alignment" is defined with conflicting 8-byte alignment (offset 7) and 8-byte alignment (offset 6)
|
error: Section "conflicting alignment" is defined with conflicting 8-byte alignment (offset 7) and 8-byte alignment (offset 6)
|
||||||
---
|
---
|
||||||
ERROR: <stdin>(18):
|
ERROR: <stdin>(18):
|
||||||
Section already declared with incompatible 3-byte alignment (offset 7)
|
Section already declared with incompatible 8-byte alignment (offset 7)
|
||||||
FATAL: <stdin>(18):
|
FATAL: <stdin>(18):
|
||||||
Cannot create section "conflicting alignment" (1 error)
|
Cannot create section "conflicting alignment" (1 error)
|
||||||
|
|||||||
Reference in New Issue
Block a user