From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Cc: Ard Biesheuvel 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: [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: , X-List-Received-Date: Fri, 28 Oct 2016 11:43:05 -0000 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(+) 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 -- 2.7.4