Port linkerscript parser to Bison (#1266)

Notable side effects:
* Use the standard-conformant MSVC preproc
* Add test for linker script INCLUDE
* Improve wording of placement conflict errors
* Fix errors from not newline-terminated files
* Teach checkdiff about the linker script doc
* Call linker script "commands" "directives" instead

---------

Co-authored-by: Rangi42 <remy.oukaour+rangi42@gmail.com>
This commit is contained in:
Eldred Habert
2023-12-11 02:29:37 +01:00
committed by GitHub
parent ab30690854
commit fd78a9ae83
28 changed files with 573 additions and 656 deletions

View File

@@ -128,7 +128,8 @@ static void mergeSections(struct Section *target, struct Section *other, enum Se
if (target->type != other->type)
errx("Section \"%s\" is defined with conflicting types %s and %s",
other->name, sectionTypeInfo[target->type].name, sectionTypeInfo[other->type].name);
other->name, sectionTypeInfo[target->type].name.c_str(),
sectionTypeInfo[other->type].name.c_str());
if (other->isBankFixed) {
if (!target->isBankFixed) {
@@ -202,7 +203,7 @@ void sect_AddSection(struct Section *section)
mergeSections(other, section, section->modifier);
} else if (section->modifier == SECTION_UNION && sect_HasData(section->type)) {
errx("Section \"%s\" is of type %s, which cannot be unionized",
section->name, sectionTypeInfo[section->type].name);
section->name, sectionTypeInfo[section->type].name.c_str());
} else {
// If not, add it
hash_AddElement(sections, section->name, section);
@@ -254,7 +255,7 @@ static void doSanityChecks(struct Section *section, void *)
// Too large an alignment may not be satisfiable
if (section->isAlignFixed && (section->alignMask & sectionTypeInfo[section->type].startAddr))
error(NULL, 0, "%s: %s sections cannot be aligned to $%04x bytes",
section->name, sectionTypeInfo[section->type].name, section->alignMask + 1);
section->name, sectionTypeInfo[section->type].name.c_str(), section->alignMask + 1);
uint32_t minbank = sectionTypeInfo[section->type].firstBank, maxbank = sectionTypeInfo[section->type].lastBank;