From a503fb362918363b28637b487eba83e9ad647ceb Mon Sep 17 00:00:00 2001 From: Stephen Hines Date: Thu, 2 Oct 2014 00:51:11 -0700 Subject: [PATCH] PIE executables created with mingw use "mainCRTStartup" as their entry point. Bug: 14416410 Our linker uses "start" as the primary entry point, so we need to adjust this for mingw-based Windows compiles, or nothing will execute correctly. Change-Id: I6e99f43e075ef9f00500099ce34ec4425c996454 --- core/definitions.mk | 4 ++++ 1 file changed, 4 insertions(+) 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)