From: Robert Pengelly Date: Sat, 14 Dec 2024 00:54:11 +0000 (+0000) Subject: Changed __edata to size end of initialized data and __end to end of bss area and... X-Git-Url: https://git.candlhat.org/?a=commitdiff_plain;h=b87fe3b1e681b19314db7b540e7dff151703db1a;p=slink.git Changed __edata to size end of initialized data and __end to end of bss area and added __etext which is the end of text segment to match dev86's ld86 --- diff --git a/link.c b/link.c index d65c2f6..01cc159 100644 --- a/link.c +++ b/link.c @@ -603,34 +603,50 @@ void link (void) { value = 0; - if ((symbol = symbol_find ("__edata")) && symbol_is_undefined (symbol)) { + if ((symbol = symbol_find ("__etext")) && symbol_is_undefined (symbol)) { if ((section = section_find (".text"))) { - value += align_section_if_needed (section->total_size); + value = align_section_if_needed (section->total_size); } of = object_file_make (FAKE_LD_FILENAME, 1); symbol = of->symbol_arr; - symbol->name = xstrdup ("__edata"); + symbol->name = xstrdup ("__etext"); symbol->section_number = ABSOLUTE_SECTION_NUMBER; - symbol->value = value / 16; + symbol->value = value; symbol_record_external_symbol (symbol); } - value %= 16; + value = 0; - if ((symbol = symbol_find ("__end")) && symbol_is_undefined (symbol)) { + if ((symbol = symbol_find ("__edata")) && symbol_is_undefined (symbol)) { if ((section = section_find (".data"))) { - value += align_section_if_needed (section->total_size); + value = align_section_if_needed (section->total_size); } + of = object_file_make (FAKE_LD_FILENAME, 1); + + symbol = of->symbol_arr; + symbol->name = xstrdup ("__edata"); + + symbol->section_number = ABSOLUTE_SECTION_NUMBER; + symbol->value = value; + + symbol_record_external_symbol (symbol); + + } + + value = 0; + + if ((symbol = symbol_find ("__end")) && symbol_is_undefined (symbol)) { + if ((section = section_find (".bss"))) { - value += align_section_if_needed (section->total_size); + value = align_section_if_needed (section->total_size); } of = object_file_make (FAKE_LD_FILENAME, 1); @@ -639,7 +655,7 @@ void link (void) { symbol->name = xstrdup ("__end"); symbol->section_number = ABSOLUTE_SECTION_NUMBER; - symbol->value = value/* % 16*/; + symbol->value = value; symbol_record_external_symbol (symbol);