在 2025-3-8 10:23, Jeremy Drake via Mingw-w64-public 写道:
This patch unfortunately does a few different things at this point: * moves delay load directory table into .didat$2 section, and puts this into .idata(!) * fills in the delay import descriptor table data directory entry
I didn't add it because I am uncertain whether it is needed.btw, in the case of MSVC, `.idata` only exists in libraries; it seems to be merged into `.rdata` before the final output. Therefore, all these data other than the delay IAT should be put into `.rdata`.
* fills in the load config table data directory entry if _load_config_used is present (it isn't unless it's actually referenced by an object)
Oh thank you. I didn't know how to calculate the size of the load config directory.
I'm not at all convinced that your initial idea to put all of the delay load stuff into the new .didat section isn't the way to go. It seemed to me like only the IAT needed to go in the section where its protection changed. The module handle is still in .data, do you think it was intended to put that in .didat also so it also gets write protected? The docs do say: Delayload import table in its own .didat section (with nothing else in it) that can be freely reprotected.
As said above, ideally all the pieces in `.idata` and `.didat`, other than `.didat$5`, should be put into `.rdata` and not entire new sections on their own. I previously attempted to move `R_IDATA` etc. into `.rdata` but the program crashed upon startup.
@@ -61,6 +63,7 @@ R_IDATA234= R_IDATA5= R_IDATA67= + R_DIDAT5= R_CRT_XC= R_CRT_XI= R_CRT_XL=
You probably also need `R_DIDAT2=` here, in both 'ld/scripttempl/pe.sc' and 'ld/scripttempl/pep.sc'. -- Best regards, LIU Hao
OpenPGP_signature.asc
Description: OpenPGP digital signature
_______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public