On Sun, 2 Mar 2025, Alvin Wong wrote:

On 1/3/2025 20:25, Jacek Caban wrote:
This is mandatory on ARM64EC and also required on AArch64 for ARM64X builds. Instead of extending the existing logic, unify it by always including it in mingwex.

In practice, this means load config will always be present in output images when using
LLD. Since ld.bfd does not support load config, it remains unaffected.
---
  mingw-w64-crt/Makefile.am                                  | 7 +------
  mingw-w64-crt/configure.ac                                 | 4 +---
  .../{cfguard/mingw_cfguard_loadcfg.S => crt/loadcfg.S}     | 0
  3 files changed, 2 insertions(+), 9 deletions(-)
rename mingw-w64-crt/{cfguard/mingw_cfguard_loadcfg.S => crt/loadcfg.S} (100%)

I am concerned that `loadcfg.S` currently always embed the symbols related to control flow guard (`__guard_check_icall_fptr`, `__guard_fids_table`, `__guard_flags`, etc.). In my opinion they should not be included in the load config if mingw-w64 itself isn't compiled with CFGuard, i.e. the fields should be hardcoded to 0 to reflect that.

The reason for this is that LLD has extra checks to make sure these CFGuard-related fields are filled up with the correct symbols when linking with CFGuard enabled. This gives users a warning as an indication that their mingw-w64 has not been compiled with CFGuard. I believe it is beneficial to keep this warning functional.

Thanks, this is a very valuable point!

I guess there's no prepreocessor define we can check in loadcfg.S, so we'd need to pass one from the build system, when building with --enable-cfguard, which can be used to switch between including or omitting these pointers in the load config, irght?

// Martin



_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to