# HG changeset patch # User Andrew Innes # Date 925639988 0 # Node ID 66df82aa955e81d0d3b7ebd86402bd6907d6714f # Parent 6c9eaa09906c5e6c159979b6ec63614554ce9486 (get_section_info): Dump back the entire EMDATA section if we can put Emacs' initialized data in a separate section, otherwise use the my_begdata/my_edata method. diff -r 6c9eaa09906c -r 66df82aa955e src/unexw32.c --- a/src/unexw32.c Sun May 02 10:11:35 1999 +0000 +++ b/src/unexw32.c Sun May 02 10:13:08 1999 +0000 @@ -380,13 +380,31 @@ area for the bss section, so we can make the new image the correct size. */ - data_start = my_begdata; - data_size = my_edata - my_begdata; - data_section = rva_to_section (PTR_TO_RVA (my_begdata), nt_header); - if (data_section != rva_to_section (PTR_TO_RVA (my_edata), nt_header)) + /* We arrange for the Emacs initialized data to be in a separate + section if possible, because we cannot rely on my_begdata and + my_edata marking out the full extent of the initialized data, at + least on the Alpha where the linker freely reorders variables + across libraries. If we can arrange for this, all we need to do is + find the start and size of the EMDATA section. */ + data_section = find_section ("EMDATA", nt_header); + if (data_section) { - printf ("Initialized data is not in a single section...bailing\n"); - exit (1); + data_start = (char *) nt_header->OptionalHeader.ImageBase + + data_section->VirtualAddress; + data_size = data_section->Misc.VirtualSize; + } + else + { + /* Fallback on the old method if compiler doesn't support the + data_set #pragma (or its equivalent). */ + data_start = my_begdata; + data_size = my_edata - my_begdata; + data_section = rva_to_section (PTR_TO_RVA (my_begdata), nt_header); + if (data_section != rva_to_section (PTR_TO_RVA (my_edata), nt_header)) + { + printf ("Initialized data is not in a single section...bailing\n"); + exit (1); + } } /* As noted in lastfile.c, the Alpha (but not the Intel) MSVC linker