On Saturday 22 April 2023 20:56:26 LIU Hao wrote: > 在 2023-04-22 20:01, Pali Rohár 写道: > > Now I have looked at it again... what about just for mingw-w64-crt build > > add following CFLAG -D__ImageBase=__MINGW_LSYMBOL(_image_base__) > > > > It would work only for mingw-w64-crt build, needs just configure.ac and > > Makefile.am adjustment, and does not need any hack in header files or > > source code files. > > I think it may be a nice solution. Modern binutils has both defined, so > source code should reference `__ImageBase` and leave the hack in CFLAGS. > > There are actually dedicated CFLAGS for individual targets, so for > i686-w64-mingw32 this'd be `-D__ImageBase=_image_base__`, and for others > it'd be `-D__ImageBase=__image_base__`.
I think that there is no need to set individual target CFLAGS. Macros are expanded at the time of their use so adding just -D__ImageBase=__MINGW_LSYMBOL(_image_base__) should work if source file which uses __ImageBase includes appropriate header file where is __MINGW_LSYMBOL defined (which are already). _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public