From dffc6a6425d286cd29643dcf96b5c2f61e756480 Mon Sep 17 00:00:00 2001 From: Kai Tietz Date: Tue, 6 Nov 2007 12:28:57 +0000 Subject: [PATCH] Add __ImageBase symbol to pe.em and pep.em. --- ld/ChangeLog | 8 ++++++++ ld/emultempl/pe.em | 5 +++++ ld/emultempl/pep.em | 4 ++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index 5fc553ca791..74eacabd33d 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,11 @@ +2007-11-06 Kai Tietz + + * emultempl/pe.em: (init): Add __ImageBase symbol. + (MSIMAGEBASEOFF): New. + (set_pe_name): Keep __image_base and __ImageBase value synch. + (_set_symbols): Likewise. + * emultempl/pep.em: Likewise. + 2007-10-26 Alan Modra PR 5215 diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em index 503f79ec2ae..10887b0032f 100644 --- a/ld/emultempl/pe.em +++ b/ld/emultempl/pe.em @@ -286,6 +286,8 @@ static definfo init[] = D(ImageBase,"__image_base__", NT_EXE_IMAGE_BASE), #define DLLOFF 1 {&dll, sizeof(dll), 0, "__dll__", 0}, +#define MSIMAGEBASEOFF 2 + D(ImageBase, U ("__ImageBase"), NT_EXE_IMAGE_BASE), D(SectionAlignment,"__section_alignment__", PE_DEF_SECTION_ALIGNMENT), D(FileAlignment,"__file_alignment__", PE_DEF_FILE_ALIGNMENT), D(MajorOperatingSystemVersion,"__major_os_version__", 4), @@ -374,6 +376,8 @@ set_pe_name (char *name, long val) { init[i].value = val; init[i].inited = 1; + if (strcmp (name,"__image_base__") == 0) + set_pe_name (U ("__ImageBase"), val); return; } } @@ -708,6 +712,7 @@ gld_${EMULATION_NAME}_set_symbols (void) #endif else init[IMAGEBASEOFF].value = NT_EXE_IMAGE_BASE; + init[MSIMAGEBASEOFF].value = init[IMAGEBASEOFF].value; } /* Don't do any symbol assignments if this is a relocatable link. */ diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em index 36b4f612375..20523edd87c 100644 --- a/ld/emultempl/pep.em +++ b/ld/emultempl/pep.em @@ -260,7 +260,7 @@ static definfo init[] = #define DLLOFF 1 {&dll, sizeof(dll), 0, "__dll__", 0}, #define MSIMAGEBASEOFF 2 - D(ImageBase,"__ImageBase", NT_EXE_IMAGE_BASE), + D(ImageBase,"___ImageBase", NT_EXE_IMAGE_BASE), D(SectionAlignment,"__section_alignment__", PE_DEF_SECTION_ALIGNMENT), D(FileAlignment,"__file_alignment__", PE_DEF_FILE_ALIGNMENT), D(MajorOperatingSystemVersion,"__major_os_version__", 4), @@ -343,7 +343,7 @@ set_pep_name (char *name, long val) init[i].value = val; init[i].inited = 1; if (strcmp (name,"__image_base__") == 0) - set_pep_name ("__ImageBase", val); + set_pep_name ("___ImageBase", val); return; } } -- 2.30.2