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::342; helo=mail-wm1-x342.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) (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 031A02119C897 for ; Wed, 12 Dec 2018 04:36:32 -0800 (PST) Received: by mail-wm1-x342.google.com with SMTP id c126so5769509wmh.0 for ; Wed, 12 Dec 2018 04:36:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=26V8DtSWSCpuhW4fFMTFc+EAyyEP+wkbhq235bru6jE=; b=ZtUy+MVFPGkz3oKHYv+PViGCXpLPR9hcQ1sRHp2KCh3TF2RuwsUG48pbFk+vcwrBqw 744U+Kbz3ZpQJ4N20/SK2G5JR2JI0AhvymmdIs19EhAj2IA3pPHj+1X0F6Ym8v5fmF9A 6AYTQwDDJZjkP+7X7V+C6S2EMo8U6LkKV47TQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=26V8DtSWSCpuhW4fFMTFc+EAyyEP+wkbhq235bru6jE=; b=IEgBXMfiNc7EeToyI3lMQXEQMMQfCw1detmLVaCAqPat/TNu9DQWUULfoUa0xg4A84 6IK28F3jHqOcHcb27oxohQNmpM7n/ytLd501lETx5WqgY5nYEtDYUn6DmD/pvhmIEVB9 pmeQhInlTcqJTSCKpsutilwPdP+Xt6oUdSdZ5CmekL76RJ4j0m0Z0tCAnZK3zSXqxxy5 dkNwWOVcFlTvl+SonLOzSw7Dc8JTKGVJ4vnKz61xCj6FP1ODHxrAXmRSLEnskSKFvXjy dfEHEqw0c71Vsrey0loSQ7e70oV4fFNjvTN2DJqYxdM0H2r9OS99bZQI1mc49bQMPH7K 4/+w== X-Gm-Message-State: AA+aEWa6dorYmO1mj7D2vaf4uIWuxbVBYriQ3rq8uWOypCDZXSie872g TzZ/p15PWNws1Xfg+uayxmix/Q== X-Google-Smtp-Source: AFSGD/WfZccV0m9YBB9f1DdBAo6pPXCxCZEhg0v3vTBsBQshbYFqWbhwg7xdMMIUDNNmYuHsoUr7aQ== X-Received: by 2002:a1c:6e01:: with SMTP id j1mr6101646wmc.103.1544618191214; Wed, 12 Dec 2018 04:36:31 -0800 (PST) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id h12sm6570959wma.48.2018.12.12.04.36.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 12 Dec 2018 04:36:30 -0800 (PST) Date: Wed, 12 Dec 2018 12:36:29 +0000 From: Leif Lindholm To: Ard Biesheuvel Cc: edk2-devel@lists.01.org, liming.gao@intel.com Message-ID: <20181212123629.rkfzkb4lr5arjpo4@bivouac.eciton.net> References: <20181212121931.26620-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 In-Reply-To: <20181212121931.26620-1-ard.biesheuvel@linaro.org> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [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:36:33 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Dec 12, 2018 at 01:19:31PM +0100, Ard Biesheuvel wrote: > 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. Do we know how ling that flag has been around for? I find a post from 2009 referring to as "new", so I guess we're safe for anything we care about. Reviewed-by: Leif Lindholm > 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 >