RE: [RFC-v4] Fix .text section offset for windows DLL (was Calling __stdcall functions in the inferior)

Pierre Muller
2012-12-07T17:03:33Z

Hi Pedro,

The values are indeed included in include/coff/pe.h header...
The problem is that coff-pe-read.c was
written completely without the use of this
header.
Using that header would probably be better,
but would also require even more rewrite
of current code...

I tried nevertheless to include coff/pe.h
I got an error about AOUTHDR not being defined,
which requires adding coff/external.h
but if I add that one, I get another error
that L_LNNO_SIZE must be defined...
And that one is defined in cpu specific files
coff/CPU.h

This seems to mean that including pe.h is not that easy :(

Pierre

> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Pedro Alves
> Envoyé : vendredi 7 décembre 2012 17:38
> À : Pierre Muller
> Cc : 'Joel Brobecker'; 'Eli Zaretskii'; gdb-patches@sourceware.org
> Objet : Re: [RFC-v4] Fix .text section offset for windows DLL (was Calling
> __stdcall functions in the inferior)
>
> On 11/25/2012 10:50 PM, Pierre Muller wrote:
> >>> > > +#ifndef IMAGE_SCN_CNT_CODE
> >>> > > +# define IMAGE_SCN_CNT_CODE 0x20
> >>> > > +#endif
> >>> > > +#ifndef IMAGE_SCN_CNT_INITIALIZED_DATA
> >>> > > +# define IMAGE_SCN_CNT_INITIALIZED_DATA 0x40
> >>> > > +#endif
> >>> > > +#ifndef IMAGE_SCN_CNT_UNINITIALIZED_DATA
> >>> > > +# define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x80
> >>> > > +#endif
> >> > Do you have an idea of when these macros might not be defined?
> >> > (and where they are normally coming from?). It'd be nice to add
> >> > a comment providing the answer to those questions.
> >
> > These are windows specific macros,
> > but can also be compiled on any other target, if one
> > of the windows target is included in the target list.
>
> But then, when _are_ they defined? You mean they're being picked
> up by something including windows.h on Windows hosts?
> It'd be much better if they were defined in src/include/coff/pe.h,
> like other IMAGE_SCN_ constants.
>
> --
> Pedro Alves