From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-x235.google.com (mail-wm0-x235.google.com [IPv6:2a00:1450:400c:c09::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 094671A1E27 for ; Wed, 3 Aug 2016 01:21:17 -0700 (PDT) Received: by mail-wm0-x235.google.com with SMTP id o80so324190435wme.1 for ; Wed, 03 Aug 2016 01:21:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=s9Q1ZmDQuGVYY7g3MhbYDMqqGkrzBzp+YrKuAFIEOg8=; b=J36LNFoLsKdnQZq/zfdvnbDk6R1RXhlYDktzylcwa9nd48KyS4OHvERb4tGX0+jwNz xHWhHMGbj8BPmQeLfTZ6OEvDquhws/iRhW5YFhrcqvjzrBuJovmYKdesGDm5VeLy1WSj kAokJ7QFRSJK520K8nbUbcyZ7aYWulbIatitw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=s9Q1ZmDQuGVYY7g3MhbYDMqqGkrzBzp+YrKuAFIEOg8=; b=LcP5aRn7eV93cC6plZ4U2L0BYhnbqKwdNFVRPrNx9Gbo40se3vn0/vi7QqbJh8tzd0 tliZ7z9xV+3uAN5Nedwl0fpM6bxrgbun6zqhr8fU4i6J2SrSusGoAT39/PLqd2Vytzqx 485H2ACXnhqcrFwO4pONiWPm8GhxBs4mfkkyLykhqAlPxbYwJhYIWSyms7TxXD7WLSwz p4PxeoxhvKe1g4xn0Qom7ARCek3vM/Y4M7JHCd1DBQB56nns/K8AQRB4G/swcu51XRMp 5tSc51xxi5jH/1h+7PpzFhwEuBuGtBO2v8ozYH31sqZt4cCS8uCcm1qEFYXso7hD3Qo8 6dmQ== X-Gm-Message-State: AEkoouuWsyOnmsi7+6PvcJjTSfYdXQZgNuxNVq0ElNgAFEa0lhzRqpxgSbOk11smvXrWaoqL X-Received: by 10.28.41.6 with SMTP id p6mr21929509wmp.18.1470212475388; Wed, 03 Aug 2016 01:21:15 -0700 (PDT) Received: from localhost.localdomain (3.red-81-34-118.dynamicip.rima-tde.net. [81.34.118.3]) by smtp.gmail.com with ESMTPSA id kq2sm6434685wjc.41.2016.08.03.01.21.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 03 Aug 2016 01:21:14 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, leif.lindholm@linaro.org, lersek@redhat.com Cc: Ard Biesheuvel Date: Wed, 3 Aug 2016 10:21:04 +0200 Message-Id: <1470212464-28071-3-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1470212464-28071-1-git-send-email-ard.biesheuvel@linaro.org> References: <1470212464-28071-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [PATCH 2/2] ArmVirtPkg ARM: make relocatable PrePi users build with CLANG35 X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 08:21:17 -0000 The clang developers have made a backward incompatible change to the command line arguments, and have replaced '-mllvm -arm-use-movt=0' with '-mno-movt'. This does not matter for most ARM platforms, and therefore it has been removed from the default CLANG35/ARM CC flags in patch 1c63516075b3 ("BaseTools CLANG35: drop problematic use-movt and save-temps options"), but as it turns out, the relocatable PrePi implementation used by ArmVirtQemuKernel and ArmVirtXen will fail to build if it contains MOVT/MOVW pairs, due to the fact that these are not runtime relocatable under ELF. Since they are runtime relocatable under PE/COFF, and GenFw does the right thing when encountering them, selectively controlling their use is more appropriate than disabling them altogether. Therefore, this patch adds the -mno-movt argument only for the platforms that use the relocatable PrePi, and only for the module types that may be pulled into its build. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- ArmVirtPkg/ArmVirtQemuKernel.dsc | 8 ++++++++ ArmVirtPkg/ArmVirtXen.dsc | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc index 01a1d9b4613b..6c536d9bbd2d 100644 --- a/ArmVirtPkg/ArmVirtQemuKernel.dsc +++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc @@ -45,6 +45,9 @@ [LibraryClasses.ARM] ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7Lib.inf ArmCpuLib|ArmPkg/Drivers/ArmCpuLib/ArmCortexA15Lib/ArmCortexA15Lib.inf +[LibraryClasses.ARM.SEC] + ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7LibSec.inf + [LibraryClasses.common] ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf @@ -77,6 +80,11 @@ [BuildOptions] GCC:*_*_ARM_PLATFORM_FLAGS == -mcpu=cortex-a15 -I$(WORKSPACE)/ArmVirtPkg/Include *_*_AARCH64_PLATFORM_FLAGS == -I$(WORKSPACE)/ArmVirtPkg/Include +[BuildOptions.ARM.EDKII.SEC, BuildOptions.ARM.EDKII.BASE] + # Avoid MOVT/MOVW instruction pairs in code that may end up in the PIE + # executable we build for the relocatable PrePi. They are not runtime + # relocatable in ELF. + *_CLANG35_*_CC_FLAGS = -mno-movt ################################################################################ # diff --git a/ArmVirtPkg/ArmVirtXen.dsc b/ArmVirtPkg/ArmVirtXen.dsc index 5ad1bf630bda..4ebead5ba6e6 100644 --- a/ArmVirtPkg/ArmVirtXen.dsc +++ b/ArmVirtPkg/ArmVirtXen.dsc @@ -44,6 +44,9 @@ [LibraryClasses.ARM] ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7Lib.inf ArmCpuLib|ArmPkg/Drivers/ArmCpuLib/ArmCortexA15Lib/ArmCortexA15Lib.inf +[LibraryClasses.ARM.SEC] + ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7LibSec.inf + [LibraryClasses.common] ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf @@ -77,6 +80,12 @@ [BuildOptions] GCC:*_*_ARM_PLATFORM_FLAGS == -mcpu=cortex-a15 -I$(WORKSPACE)/ArmVirtPkg/Include GCC:*_*_AARCH64_PLATFORM_FLAGS == -I$(WORKSPACE)/ArmVirtPkg/Include +[BuildOptions.ARM.EDKII.SEC, BuildOptions.ARM.EDKII.BASE] + # Avoid MOVT/MOVW instruction pairs in code that may end up in the PIE + # executable we build for the relocatable PrePi. They are not runtime + # relocatable in ELF. + *_CLANG35_*_CC_FLAGS = -mno-movt + ################################################################################ # # Pcd Section - list of all EDK II PCD Entries defined by this Platform -- 2.7.4