From: Bin Meng Date: Sun, 23 Jul 2017 02:37:37 -0700 Subject: [U-Boot] [PATCH 2/2] x86: Allow 32-bit toolchain to compile 64-bit U-Boot In-Reply-To: <1500802657-26243-1-git-send-email-bmeng.cn@gmail.com> References: <1500802657-26243-1-git-send-email-bmeng.cn@gmail.com> Message-ID: <1500802657-26243-2-git-send-email-bmeng.cn@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Attempting to use a 32-bit toolchain (eg: kernel.org 4.9 i386-linux-gcc) to compile 64-bit U-Boot (qemu-x86_64_defconfig) fails with the following errors: arch/x86/cpu/intel_common/microcode.c:79:2: error: PIC register clobbered by 'ebx' in 'asm' The issue is with 32-bit toolchain compiling sources for 64-bit. Using a 64-bit toolchain (eg: kernel.org 4.9 x86_64-linux-gcc) works out of the box. When compiling sources for 32-bit, '-m32' is passed to the toolchain (no matter it's 32-bit or 64-bit). Now do the same thing, passing '-m64' to the toolchain for 64-bit sources build. Signed-off-by: Bin Meng --- arch/x86/config.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/config.mk b/arch/x86/config.mk index 043425e..8835dcf 100644 --- a/arch/x86/config.mk +++ b/arch/x86/config.mk @@ -26,7 +26,7 @@ endif ifeq ($(IS_32BIT),y) PLATFORM_CPPFLAGS += -march=i386 -m32 else -PLATFORM_CPPFLAGS += $(if $(CONFIG_SPL_BUILD),,-fpic) -fno-common +PLATFORM_CPPFLAGS += $(if $(CONFIG_SPL_BUILD),,-fpic) -fno-common -m64 endif PLATFORM_RELFLAGS += -ffunction-sections -fvisibility=hidden -- 2.9.2