From patchwork Sat Nov 19 20:25:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 696953 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3tLmsP6wl6z9sfH for ; Sun, 20 Nov 2016 07:38:17 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="SnGiK5dj"; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CE896B38ED; Sat, 19 Nov 2016 21:32:51 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ssT9LfEBbnhc; Sat, 19 Nov 2016 21:32:51 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 81E50B387F; Sat, 19 Nov 2016 21:30:27 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7D7D0A7579 for ; Sat, 19 Nov 2016 21:29:49 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QB9b5K3z9AIP for ; Sat, 19 Nov 2016 21:29:49 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-oi0-f52.google.com (mail-oi0-f52.google.com [209.85.218.52]) by theia.denx.de (Postfix) with ESMTPS id 62A47B38D5 for ; Sat, 19 Nov 2016 21:27:58 +0100 (CET) Received: by mail-oi0-f52.google.com with SMTP id 128so123535357oih.0 for ; Sat, 19 Nov 2016 12:27:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=1lcfhMedVNn2I1rQmhDqV2Y1MS2lvevLLcONFr/CFas=; b=SnGiK5djOMcB1Q+6dcsSKcupfFbDVGBmVzQQVTjFJYffHgiG65h0SGDvyDAEZUZs/W 2RKvbEC4+LIJ8QUfK1TLlzvkkEM3kqvyr2SezN+uW1BehLLIGPF8wMSmBrvRamhGMv7E 8tsWRJTW0B0tt2jbxQVyLbMUZj2FkAIWYVPLoKkmDS6glk2DXb+IqipeMykykfHEepma 07zLEwwws4BbtbQIaYOxSnSLI3nmYErcqeV+DQEmQgxmC0qCwOuEDH1oLbjY5/Z7JuvD OvGe3snvc9zFE/wsjSrJ1wbzBvXExgqbkiLKWJWkNvXYofb/UA3PtYor3FWoWQBqE8SB 6pHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=1lcfhMedVNn2I1rQmhDqV2Y1MS2lvevLLcONFr/CFas=; b=U5Gdxw7fSALviMN+McGZ2j0zrwZFxy76m8rgYtdkF1K57QeS35+QzIqU//zJ2vuK6Z UvRa6fr2+Sya7sC3VK/Kj2L1Fy48Qae7D2Hs01nJVkiVV66UYc0SIjzGlXeDVwDlXQgE /j7hGXmDRZBGeQxFONeHcZz5QVkSy9UJFCeuhBPUAhusVPX/fi7o2A/f2PCWVJw2+jOk X5pL9U1iwoOEw7xA5nfapyG6qhKAqWf/YvotKYPhVqpsKrZx/oSLTOCIbuFHcKoJbZzt Fhy6di/sk1lDAQ2wteztyVGF6pjZ5xaSb9cZeiT1XUWCzeggO6oGEaombL5ekSFdDDbl vlCA== X-Gm-Message-State: AKaTC03/xYzewgtf7lrzRPCCWc6N5+mZIoXQiTl4qlmHYMIt6iNAJFKWS1/AeEG66vzdRbPQ X-Received: by 10.157.54.75 with SMTP id w69mr3772335otb.256.1479587277135; Sat, 19 Nov 2016 12:27:57 -0800 (PST) Received: from kaki.bld.corp.google.com ([2620:0:10f2:12:28b9:cda2:f7f2:e7b8]) by smtp.gmail.com with ESMTPSA id e63sm4717432oih.23.2016.11.19.12.27.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 19 Nov 2016 12:27:56 -0800 (PST) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 3C108403A3; Sat, 19 Nov 2016 13:27:56 -0700 (MST) From: Simon Glass To: U-Boot Mailing List Date: Sat, 19 Nov 2016 13:25:51 -0700 Message-Id: <1479587152-25065-63-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 In-Reply-To: <1479587152-25065-1-git-send-email-sjg@chromium.org> References: <1479587152-25065-1-git-send-email-sjg@chromium.org> Subject: [U-Boot] [PATCH v2 62/63] x86: Update compile/link flags to support 64-bit U-Boot X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Update config.mk settings to support both 32-bit and 64-bit U-Boot. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- Changes in v2: None arch/x86/config.mk | 30 ++++++++++++++++++++++++++++-- arch/x86/cpu/config.mk | 2 -- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/arch/x86/config.mk b/arch/x86/config.mk index 03c71f7..13c2660 100644 --- a/arch/x86/config.mk +++ b/arch/x86/config.mk @@ -15,11 +15,25 @@ PF_CPPFLAGS_X86 := $(call cc-option, -fno-toplevel-reorder, \ PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_X86) PLATFORM_CPPFLAGS += -fno-dwarf2-cfi-asm + +ifdef CONFIG_SPL_BUILD +IS_32BIT := y +else +ifndef CONFIG_X86_64 +IS_32BIT := y +endif +endif + +ifeq ($(IS_32BIT),y) PLATFORM_CPPFLAGS += -march=i386 -m32 +else +PLATFORM_CPPFLAGS += $(if $(CONFIG_SPL_BUILD),,-fpic) -fno-common +endif PLATFORM_RELFLAGS += -ffunction-sections -fvisibility=hidden -PLATFORM_LDFLAGS += -Bsymbolic -Bsymbolic-functions -m elf_i386 +PLATFORM_LDFLAGS += -Bsymbolic -Bsymbolic-functions +PLATFORM_LDFLAGS += -m $(if $(IS_32BIT),elf_i386,elf_x86_64) LDFLAGS_FINAL += --wrap=__divdi3 --wrap=__udivdi3 LDFLAGS_FINAL += --wrap=__moddi3 --wrap=__umoddi3 @@ -31,7 +45,9 @@ LDFLAGS_EFI_PAYLOAD := -Bsymbolic -Bsymbolic-functions -shared --no-undefined OBJCOPYFLAGS_EFI := -j .text -j .sdata -j .data -j .dynamic -j .dynsym \ -j .rel -j .rela -j .reloc +ifeq ($(IS_32BIT),y) CFLAGS_NON_EFI := -mregparm=3 +endif CFLAGS_EFI := -fpic -fshort-wchar ifeq ($(CONFIG_EFI_STUB_64BIT),) @@ -62,8 +78,18 @@ else PLATFORM_CPPFLAGS += $(CFLAGS_NON_EFI) PLATFORM_LDFLAGS += --emit-relocs -LDFLAGS_FINAL += --gc-sections -pie +LDFLAGS_FINAL += --gc-sections $(if $(CONFIG_SPL_BUILD),,-pie) + +endif +ifdef CONFIG_X86_64 +ifndef CONFIG_SPL_BUILD +PLATFORM_CPPFLAGS += -D__x86_64__ +else +PLATFORM_CPPFLAGS += -D__I386__ +endif +else +PLATFORM_CPPFLAGS += -D__I386__ endif ifneq ($(CONFIG_EFI_STUB)$(CONFIG_CMD_BOOTEFI_HELLO),) diff --git a/arch/x86/cpu/config.mk b/arch/x86/cpu/config.mk index 4c99a35..b519f43 100644 --- a/arch/x86/cpu/config.mk +++ b/arch/x86/cpu/config.mk @@ -7,8 +7,6 @@ CROSS_COMPILE ?= i386-linux- -PLATFORM_CPPFLAGS += -D__I386__ - # DO NOT MODIFY THE FOLLOWING UNLESS YOU REALLY KNOW WHAT YOU ARE DOING! LDPPFLAGS += -DRESET_SEG_START=$(CONFIG_RESET_SEG_START) LDPPFLAGS += -DRESET_SEG_SIZE=$(CONFIG_RESET_SEG_SIZE)