diff --git a/core/definitions.mk b/core/definitions.mk index d7d8b25e9c..38aa72066f 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -1414,6 +1414,10 @@ ifdef BUILD_HOST_static HOST_FPIE_FLAGS := else HOST_FPIE_FLAGS := -pie +# Force the correct entry point to workaround a bug in binutils that manifests with -pie +ifeq ($(HOST_OS),windows) +HOST_FPIE_FLAGS += -Wl,-e_mainCRTStartup +endif endif ifneq ($(HOST_CUSTOM_LD_COMMAND),true)