From patchwork Fri Oct 28 11:42:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 79909 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp1128091qge; Fri, 28 Oct 2016 04:43:06 -0700 (PDT) X-Received: by 10.98.82.75 with SMTP id g72mr23973655pfb.119.1477654986729; Fri, 28 Oct 2016 04:43:06 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id m11si242436pgd.246.2016.10.28.04.43.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Oct 2016 04:43:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id DCE4C81D7E; Fri, 28 Oct 2016 04:43:05 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-wm0-x22a.google.com (mail-wm0-x22a.google.com [IPv6:2a00:1450:400c:c09::22a]) (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 C7CB981D7A for ; Fri, 28 Oct 2016 04:43:04 -0700 (PDT) Received: by mail-wm0-x22a.google.com with SMTP id n67so108421709wme.1 for ; Fri, 28 Oct 2016 04:43:05 -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=gm9b2SgBtLL9GifesHyeeNQajntHnX5hEHJWuko6UAE=; b=eql7CmM00kglGX7+CLOOv7qjmxvat7WtjHGSA7vzYLLYW/Ge4BdFZPk1CsT3wGN/gH q633Tf0c3LlHXCAqVsDoreAk+lZttQgKb4UPQsBKsg/CwPkY9htKFN7W2VoV9QlpBZKX Uro/xQrO6l3HA3ssQqQceyw5EHnMx2kHhhEhA= 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=gm9b2SgBtLL9GifesHyeeNQajntHnX5hEHJWuko6UAE=; b=h5IGgDnL0EVKVzZaDxHO++FQYMIuBY74+mqyfpfSguqf8lczrQuedg6I6O5jSJ5rZi W0UsH6BZvG9C72MnTHYEjgO2SqYA9VEbT2akua9HT2un1OPEtgPysJO1G4M9wgLgZe4v wfghtZ/SvLUERXNHW9T0M4qpsa+3lIo/m3d2VRgePcyqvE2uwAt23Lx8D7gv3e2O/1++ g2eexVza+CPh+gk1wERd6NAX8jb2olTJQraUhqSFEsvS4GfFw1cd3fVy1L3v86WabEwx AIaI0To1Yf/q2LSP9P8RbmTz+83wJDkDa4vxUwC4s0uATpJCRhTz09JCyvLG5fY8G9FW coww== X-Gm-Message-State: ABUngvfAgKDms0ZzeGp+u5pkVR/ovzedNEWmGnDx281jMhz+OinPM5pc6ymv0yTO3TQVkitw X-Received: by 10.194.105.41 with SMTP id gj9mr13363342wjb.58.1477654983854; Fri, 28 Oct 2016 04:43:03 -0700 (PDT) Received: from localhost.localdomain ([105.150.227.229]) by smtp.gmail.com with ESMTPSA id 1sm8485220wmk.22.2016.10.28.04.43.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 28 Oct 2016 04:43:03 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, leif.lindholm@linaro.org Date: Fri, 28 Oct 2016 12:42:52 +0100 Message-Id: <1477654974-5598-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477654974-5598-1-git-send-email-ard.biesheuvel@linaro.org> References: <1477654974-5598-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 1/3] ArmPkg RVCT: add ADRL/LDRL macro equivalents 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: , Cc: Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" The GCC ARM builds have access to ADRL/LDRL macros that emit relative symbol references, i.e., references that do not require fixing up at load time (or FV generation time for XIP modules) Implement equivalent functionality for RVCT: note that this does not use movw/movt pairs, but the more compatible add/add/add or add/add/ldr sequences (which Clang does not support, unfortunately, hence the use of movw/movt for the GCC toolchain family) Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- ArmPkg/Include/AsmMacroIoLib.inc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Leif Lindholm diff --git a/ArmPkg/Include/AsmMacroIoLib.inc b/ArmPkg/Include/AsmMacroIoLib.inc index c9cad5230c94..4bc3146fb399 100644 --- a/ArmPkg/Include/AsmMacroIoLib.inc +++ b/ArmPkg/Include/AsmMacroIoLib.inc @@ -26,4 +26,24 @@ ldr $Reg, =($Data) MEND + MACRO + adrll $Reg, $Symbol + add $Reg, pc, #-8 + RELOC R_ARM_ALU_PC_G0_NC, $Symbol + add $Reg, $Reg, #-4 + RELOC R_ARM_ALU_PC_G1_NC, $Symbol + add $Reg, $Reg, #0 + RELOC R_ARM_ALU_PC_G2, $Symbol + MEND + + MACRO + ldrl $Reg, $Symbol + add $Reg, pc, #-8 + RELOC R_ARM_ALU_PC_G0_NC, $Symbol + add $Reg, $Reg, #-4 + RELOC R_ARM_ALU_PC_G1_NC, $Symbol + ldr $Reg, [$Reg, #0] + RELOC R_ARM_LDR_PC_G2, $Symbol + MEND + END