diff --git a/include/asm/section.h b/include/asm/section.h index 219b682d..5b2672d2 100644 --- a/include/asm/section.h +++ b/include/asm/section.h @@ -22,6 +22,8 @@ struct Section { char *name; enum SectionType type; enum SectionModifier modifier; + struct FileStackNode *src; /* Where the section was defined */ + uint32_t fileLine; /* Line where the section was defined */ uint32_t size; uint32_t org; uint32_t bank; diff --git a/src/asm/section.c b/src/asm/section.c index 40c7a1c6..22f9d557 100644 --- a/src/asm/section.c +++ b/src/asm/section.c @@ -230,8 +230,9 @@ static void mergeSections(struct Section *sect, enum SectionType type, uint32_t break; case SECTION_NORMAL: - // TODO: this should report where the section was defined - fail("Section already defined previously\n"); + fail("Section already defined previously at "); + fstk_Dump(sect->src, sect->fileLine); + putc('\n', stderr); break; } } @@ -325,6 +326,8 @@ static struct Section *getSection(char const *name, enum SectionType type, uint3 sect->type = type; sect->modifier = mod; + sect->src = fstk_GetFileStack(); + sect->fileLine = lexer_GetLineNo(); sect->size = 0; sect->org = org; sect->bank = bank; diff --git a/test/asm/duplicate-section.err b/test/asm/duplicate-section.err index 3d766a39..3ee901d5 100644 --- a/test/asm/duplicate-section.err +++ b/test/asm/duplicate-section.err @@ -1,4 +1,4 @@ ERROR: duplicate-section.asm(4): - Section already defined previously + Section already defined previously at duplicate-section.asm(2) FATAL: duplicate-section.asm(4): Cannot create section "sec" (1 error)