From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Google-Smtp-Source: AFSGD/ULD08o0BaT5ty12yy3dvjmClowyHv/Ci5d7VCJJH2Tt0JroAFjlved39EBBLKp2j+s7CP/9A== 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 Cc: leif.lindholm@linaro.org, liming.gao@intel.com, Ard Biesheuvel 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: [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: , X-List-Received-Date: Wed, 12 Dec 2018 12:19:36 -0000 Content-Transfer-Encoding: 8bit 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(-) 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) -- 2.19.2