aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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)
380 area for the bss section, so we can make the new image the correct 380 area for the bss section, so we can make the new image the correct
381 size. */ 381 size. */
382 382
383 data_start = my_begdata; 383 /* We arrange for the Emacs initialized data to be in a separate
384 data_size = my_edata - my_begdata; 384 section if possible, because we cannot rely on my_begdata and
385 data_section = rva_to_section (PTR_TO_RVA (my_begdata), nt_header); 385 my_edata marking out the full extent of the initialized data, at
386 if (data_section != rva_to_section (PTR_TO_RVA (my_edata), nt_header)) 386 least on the Alpha where the linker freely reorders variables
387 across libraries. If we can arrange for this, all we need to do is
388 find the start and size of the EMDATA section. */
389 data_section = find_section ("EMDATA", nt_header);
390 if (data_section)
387 { 391 {
388 printf ("Initialized data is not in a single section...bailing\n"); 392 data_start = (char *) nt_header->OptionalHeader.ImageBase +
389 exit (1); 393 data_section->VirtualAddress;
394 data_size = data_section->Misc.VirtualSize;
395 }
396 else
397 {
398 /* Fallback on the old method if compiler doesn't support the
399 data_set #pragma (or its equivalent). */
400 data_start = my_begdata;
401 data_size = my_edata - my_begdata;
402 data_section = rva_to_section (PTR_TO_RVA (my_begdata), nt_header);
403 if (data_section != rva_to_section (PTR_TO_RVA (my_edata), nt_header))
404 {
405 printf ("Initialized data is not in a single section...bailing\n");
406 exit (1);
407 }
390 } 408 }
391 409
392 /* As noted in lastfile.c, the Alpha (but not the Intel) MSVC linker 410 /* As noted in lastfile.c, the Alpha (but not the Intel) MSVC linker