From 0b9f8ab5237ec69b01e9f86bb0ba5a764a5463e8 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Thu, 17 Sep 2026 13:19:26 -0400 Subject: [PATCH] Use `Section::typeInfo()` more --- src/link/layout.cpp | 4 ++-- src/link/sdas_obj.cpp | 5 ++--- src/link/section.cpp | 6 +++--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/link/layout.cpp b/src/link/layout.cpp index b5a79145..1a09b93a 100644 --- a/src/link/layout.cpp +++ b/src/link/layout.cpp @@ -263,7 +263,7 @@ void layout_PlaceSection(std::string const &name, bool isOptional) { "\"%s\" is specified to be a %s section, but it is already a %s section", name.c_str(), typeInfo.name.c_str(), - sectionTypeInfo[section->type].name.c_str() + section->typeInfo().name.c_str() ); } @@ -276,7 +276,7 @@ void layout_PlaceSection(std::string const &name, bool isOptional) { "The linker script places section \"%s\" in %s bank %" PRIu32 ", but it was already defined in bank %" PRIu32, name.c_str(), - sectionTypeInfo[section->type].name.c_str(), + section->typeInfo().name.c_str(), bank, section->bank ); diff --git a/src/link/sdas_obj.cpp b/src/link/sdas_obj.cpp index b90b2c31..0d0595aa 100644 --- a/src/link/sdas_obj.cpp +++ b/src/link/sdas_obj.cpp @@ -855,7 +855,6 @@ void sdobj_ReadFile(FileStackNode const &src, FILE *file, std::vector &f // RAM sections can have a size, but don't get any data (they shouldn't have any) if (section->type != SECTTYPE_INVALID) { - SectionTypeInfo const &typeInfo = sectionTypeInfo[section->type]; // Otherwise, how would the type already be known at this point? assume(section->isAddressFixed); @@ -866,7 +865,7 @@ void sdobj_ReadFile(FileStackNode const &src, FILE *file, std::vector &f "\"%s\" is implicitly defined as a %s section (being at address $%04" PRIx16 "), but it has data! (Was a bad `__at()` value used?)", section->name.c_str(), - typeInfo.name.c_str(), + section->typeInfo().name.c_str(), section->org ); } @@ -876,7 +875,7 @@ void sdobj_ReadFile(FileStackNode const &src, FILE *file, std::vector &f "\"%s\" is implicitly defined as a %s section (being at address $%04" PRIx16 "), but it doesn't have any data! (Was a bad `__at()` value used?)", section->name.c_str(), - typeInfo.name.c_str(), + section->typeInfo().name.c_str(), section->org ); } diff --git a/src/link/section.cpp b/src/link/section.cpp index f1659b54..369df7f9 100644 --- a/src/link/section.cpp +++ b/src/link/section.cpp @@ -115,8 +115,8 @@ static void mergeSections(Section &target, std::unique_ptr
&&other) { *other, "Section \"%s\" is defined with type `%s`, but also with type `%s`", target.name.c_str(), - sectionTypeInfo[target.type].name.c_str(), - sectionTypeInfo[other->type].name.c_str() + target.typeInfo().name.c_str(), + other->typeInfo().name.c_str() ); } @@ -190,7 +190,7 @@ void sect_AddSection(std::unique_ptr
&§ion) { fatal( "Section \"%s\" is of type `%s`, which cannot be `UNION`ized", section->name.c_str(), - sectionTypeInfo[section->type].name.c_str() + section->typeInfo().name.c_str() ); } else { sections.add(section->name, std::move(section));