From patchwork Wed Dec 12 12:19:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 153576 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1755577ljp; Wed, 12 Dec 2018 04:19:38 -0800 (PST) X-Google-Smtp-Source: AFSGD/XXK2g3efQqoji0Zlh5893g4t5N0vI21AwiTDFv5pvEbUazXyOfQNnhUmcnzarR2CO9UrTh X-Received: by 2002:a17:902:720c:: with SMTP id ba12mr19753214plb.79.1544617178096; Wed, 12 Dec 2018 04:19:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544617178; cv=none; d=google.com; s=arc-20160816; b=0prymUZZ8wfsl5zObkXgINOAU8PzK2uu6EwwcOdE/PjVZ6PdIBvoAkSb17OtHT0qx8 3HmxMAM46iCw994UjxzVIIhk3KEW/tu+VR20IwBuO5Wj+Jm/Y1m2ml3qqXnyEk6g+lTe gOhmnLIPw0nhW66Z0t7GwFTy/dfhtoiiSeZsW9B6zyW7KlSKIuHgIi+uoZmQSqKhw7E8 VgcYeb5qWf1tF9yw7aQnEprJ8xm3TIptkZHCAy+VzLNKGu6w5kz76vGvF+MAKqjOOWay 1IXvjpmLTDIG2wy9WfBsI4IvZikzPh16l+h5I8U/Z4bRYqJGZPQduRcSfBEqgoV1jfOm fWhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=iXmTWbkE6A5DjZxc/YN9j8zyxZVT4ZWnAkTWXcOAFsU=; b=G8tgXpVD7iI8CXUdRH0pce+K6ERkbrKzMPsMz6MjLOH8W4gjcQBbx0o1F9udKcaK5f HhNOgFFmRJT7bSeGcNL9KWKvPi6lFcr44WIqWczW7yOSLgK+KSAjS/C0pEQ5Q+mEhDjc RN62zmVrM0V//FwvTUmphrpLKJ2vxpSCKbPxzm0xJB/8IYtgJuwsuX0h4aiN5q3D/z7V P4CVqcyTeYvGT3bNxaSsZe2yklNT4Q7P5xUF4xsQ49sl0L6v1UwhbH002r02B1EORVrH CkAEJgNmQ2mMxatWF7IT5Y9xryZkjWquuG2lECVcgrXnXFHxZzPWlhTc1c1g0fTOUi+Q C7bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=UeH8AJOB; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id l66si15332421pfl.258.2018.12.12.04.19.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 04:19:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=UeH8AJOB; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 3E4F32119C8B2; Wed, 12 Dec 2018 04:19:37 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:4864:20::341; helo=mail-wm1-x341.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) (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 EF1992119BBD4 for ; Wed, 12 Dec 2018 04:19:35 -0800 (PST) Received: by mail-wm1-x341.google.com with SMTP id y139so5505169wmc.5 for ; Wed, 12 Dec 2018 04:19:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=wm4LAzd0jbnToYmWizq/n7+WiXrUANp+TxGtGQpVVWI=; b=UeH8AJOB+3E3E9+B1tv6a065YGl9076OByewq5spcG4wRh/LS2MTTHolNDo40UMZNv g4gukAawwpCf5Uq1EwsPSCTfxoa9hoJbZcdeQ5w4wBQ6F4vHLFQxunpxwDbFb8ZZ08sf 6dguzXd5vXXoGNZ1nXSmwg/hmxxYjaHmxT54w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=wm4LAzd0jbnToYmWizq/n7+WiXrUANp+TxGtGQpVVWI=; b=GWNu7jL2zjwDKCDw6/JahdGErk+5BeQ2N3rzJM+PjnmhY71XraJI9x8Fpif6xfikjB TVmCqll/PHzoUiLivunf/MpNzk/Yu/sZJBNfK3KL1tOdP86O3CQ0Zgf7bRpJoTcZeTcg MgJ9twBfidZ5jJDFF38CnUnGzWOcX1GicIrLno3JgKp9LVibTsvsuSMVjIzZDUiucFL7 FqZ5593//5H3RvzjpQ7qFehsC9JsMiKPPTLnJjQZYedSSvtoObifBbxzAxuXcaNB32qE AdE50f9gb4dA2mRSyFZc4sLzKeNqUj2/cUcpSt2tg+fUXVlfxu0O6dBDG1mIU2gzIgL6 ne1A== X-Gm-Message-State: AA+aEWZ/MHe0KPPpp76DwrViiAKba+uSllgxIBM68jngenNaehjiO/2T lS3Y4svLkkoPpPuimVNLHJvI1zgkH+x54Q== X-Received: by 2002:a1c:bbd6:: with SMTP id l205mr5702206wmf.97.1544617173772; Wed, 12 Dec 2018 04:19:33 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:1db:abd7:f798:3277]) by smtp.gmail.com with ESMTPSA id q185sm3893471wmg.14.2018.12.12.04.19.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 04:19:33 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Wed, 12 Dec 2018 13:19:31 +0100 Message-Id: <20181212121931.26620-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 Subject: [edk2] [PATCH] BaseTools/tools_def ARM: emit PIC veneers X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: liming.gao@intel.com Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" The ARM linker may emit veneers, i.e., trampolines, when ordinary direct relative branches cannot be used, e.g., for Thumb interworking or branch targets that are out of range. Usually, such veneers carry an absolute reference to the branch target, which is problematic for us, since these absolute references are not covered by annotations that are visible to GenFw in the PE/COFF conversion, and so these absolute references are not fixed up by the PE/COFF loader at runtime. So switch to all ARM GNU ld toolchains to position independent veneers. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- BaseTools/Conf/tools_def.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.19.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Leif Lindholm Reviewed-by: Philippe Mathieu-Daudé diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template index 2ba833e1fb06..902680c24c85 100755 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -4150,7 +4150,7 @@ DEFINE GCC_DLINK_FLAGS_COMMON = -nostdlib --pie DEFINE GCC_DLINK2_FLAGS_COMMON = -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds DEFINE GCC_IA32_X64_DLINK_COMMON = DEF(GCC_DLINK_FLAGS_COMMON) --gc-sections DEFINE GCC_ARM_AARCH64_DLINK_COMMON= -Wl,--emit-relocs -nostdlib -Wl,--gc-sections -u $(IMAGE_ENTRY_POINT) -Wl,-e,$(IMAGE_ENTRY_POINT),-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map -DEFINE GCC_ARM_DLINK_FLAGS = DEF(GCC_ARM_AARCH64_DLINK_COMMON) -z common-page-size=0x20 +DEFINE GCC_ARM_DLINK_FLAGS = DEF(GCC_ARM_AARCH64_DLINK_COMMON) -z common-page-size=0x20 -Wl,--pic-veneer DEFINE GCC_AARCH64_DLINK_FLAGS = DEF(GCC_ARM_AARCH64_DLINK_COMMON) -z common-page-size=0x20 DEFINE GCC_ARM_AARCH64_ASLDLINK_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0 DEF(GCC_DLINK2_FLAGS_COMMON) -z common-page-size=0x20 DEFINE GCC_IA32_X64_ASLDLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_COMMON) --entry _ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT)