Bankpack: linker order: Update Comments to match final design

- Also some typos
This commit is contained in:
bbbbbr
2026-01-23 16:34:55 -08:00
parent 230971708a
commit 9c2ac6059d
2 changed files with 11 additions and 7 deletions

View File

@@ -97,10 +97,10 @@ static int linkerfile_order_compare(const void* a, const void* b) {
// Set linkerfile order
//
// Helps ensure fixed bank areas (hopefully) get linked/placed before autobank.
// Helps ensure fixed bank areas get linked/placed before autobank via linkerfile output order.
// Intended to facilitate alignment assumptions for size padded object files.
// - Files that only have non-banked data ("_CODE", "_HOME") will always be first in the order
// - See area_item_compare() for full details of how linkerfile_order gets set
// - See obj_data_process() and area_item_compare() for full details of how linkerfile_order gets set
static void linkerfile_output_order_sort(const file_item * p_files, file_order_t * p_filelist_order, const uint32_t count) {
uint32_t c;
@@ -274,7 +274,7 @@ static unsigned int get_obj_file_format(FILE * obj_file, const char * str_filena
}
// Extract areas from files, then collected assign them to banks
// Extract areas from files, once collected assign them to banks
void files_extract(void) {
uint32_t c;
char strline_in[OBJ_NAME_MAX_STR_LEN] = "";

View File

@@ -408,8 +408,12 @@ void obj_data_process(list_type * p_filelist) {
for (c = 0; c < arealist.count; c++) {
banks_assign_area(&(areas[c]));
// Set linkerfile order based on sort order above
// The + 1 is to separate banked from non-banked files so non-banked always go first
// (non-banked files aren't passed into this function, so stay at default [0])
//
// All files get processed here, including Fixed bank files.
// The Fixed vs Auto sorting guarantees Fixed are always before Auto,
// they are then sub-sorted by size
//
// The + 1 differentiates it from the default LINKERFILE_ORDER_FIRST
files[ areas[c].file_id ].linkerfile_order = c + 1;
// If area was auto-banked then set bank number in associated file
@@ -427,8 +431,8 @@ void obj_data_process(list_type * p_filelist) {
}
}
// Check all symbols for matches to banked entries, flag if match found
// TODO: ineffecient to loop over symbols for all files
// Check all symbols for matching banked entries ("b<symbol>"), flag if match found
// TODO: inefficient to loop over symbols for all files
for (c = 0; c < symbollist.count; c++) {
if (symbols[c].is_banked_def) {
for (s = 0; s < symbollist.count; s++) {