This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch]: Add MS __ImageBase symbol to 32-bit pe.em


Hi Pedro,

> Kai Tietz wrote:
> 
>  > +#define MSIMAGEBASEOFF   2
>  > +  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),
>  > @@ -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 ("__ImageBase", val);
>  >
> 
> Shouldn't it be ___ImageBase (3 underscores) on i386 9x/NT
> Windows, as opposed to x64, which I think I've read that it
> is not underscored?  This file is also used for arm-wince,
> which is not underscored.  (Although this __ImageBase thing
> isn't as useful in Windows CE, because HMODULE == base address
> isn't true there.)
> 
> You may use U take care of the differences between targets,
> it's defined in the top of pe.em:
> 
> #define U(S) ${INITIAL_SYMBOL_CHAR} S
> 
> Where INITIAL_SYMBOL_CHAR is "_" in i386.
> 
> Like so:
> +       set_pe_name (U ("__ImageBase"), val);

The symbol is defined by MS as 'extern IMAGE_DOS_HEADER _ImageBase'. So 
the name is correct. I will add the U.
For Windows CE and arm-wince __image_base__ is invalid too (the same thing 
as for _ImageBase).
No, for x64 it is underscored, too.

Cheers,
 i.A. Kai Tietz


|  (\_/)  This is Bunny. Copy and paste Bunny
| (='.'=) into your signature to help him gain
| (")_(") world domination.

------------------------------------------------------------------------------------------
  OneVision Software Entwicklungs GmbH & Co. KG
  Dr.-Leo-Ritter-StraÃe 9 - 93049 Regensburg
  Tel: +49.(0)941.78004.0 - Fax: +49.(0)941.78004.489 - www.OneVision.com
  Commerzbank Regensburg - BLZ 750 400 62 - Konto 6011050
  Handelsregister: HRA 6744, Amtsgericht Regensburg
  KomplementÃrin: OneVision Software Entwicklungs Verwaltungs GmbH
  Dr.-Leo-Ritter-StraÃe 9 â 93049 Regensburg
  Handelsregister: HRB 8932, Amtsgericht Regensburg - GeschÃftsfÃhrer: 
Ulrike DÃhler, Manuela Kluger

Attachment: imagebase32.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]