Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/asm/output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,14 @@ static uint32_t getSectIDIfAny(Section *sect) {
if (!sect)
return UINT32_MAX;

if (auto search = sectionMap.find(sect->name); search != sectionMap.end())
return static_cast<uint32_t>(sectionMap.size() - search->second - 1);
// Search in `sectionList` instead of `sectionMap`, since section fragments share the
// same name but have different IDs
if (auto search =
std::find_if(RANGE(sectionList), [&sect](Section const &s) { return &s == sect; });
search != sectionList.end())
return static_cast<uint32_t>(
sectionList.size() - std::distance(sectionList.begin(), search) - 1
);

fatalerror("Unknown section '%s'\n", sect->name.c_str());
}
Expand Down
Loading