summaryrefslogtreecommitdiff
path: root/src/unexw32.c
diff options
context:
space:
mode:
authorAndrew Innes <andrewi@gnu.org>1999-05-02 10:13:08 +0000
committerAndrew Innes <andrewi@gnu.org>1999-05-02 10:13:08 +0000
commite3ddd18c28c58472ef8e707a30f06703ef95e177 (patch)
treeb2997dfe1317b10693b83b688fc77d793157dea3 /src/unexw32.c
parent9551468ff4aeb9dec3b7284b07f5bc41c27c8b41 (diff)
downloademacs-e3ddd18c28c58472ef8e707a30f06703ef95e177.tar.gz
(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.
Diffstat (limited to 'src/unexw32.c')
-rw-r--r--src/unexw32.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/unexw32.c b/src/unexw32.c
index 743ce0086f6..2aa2a529329 100644
--- a/src/unexw32.c
+++ b/src/unexw32.c
@@ -380,13 +380,31 @@ get_section_info (file_data *p_infile)
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