From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4864:20::d42; helo=mail-io1-xd42.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-io1-xd42.google.com (mail-io1-xd42.google.com [IPv6:2607:f8b0:4864:20::d42]) (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 D41B02119BBDC for ; Wed, 19 Dec 2018 12:11:21 -0800 (PST) Received: by mail-io1-xd42.google.com with SMTP id p7so8976204iog.12 for ; Wed, 19 Dec 2018 12:11:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Jod4dwxa07jUPQ9vaCflhDxrwPwxTHervNZ/FEVMjWo=; b=JtptT8vOGYGwrEICJIY1uItxd1pJzCLo0dJmcwU0T2/cGqoxQb3K33lLmm/5djk+2W JItjW4WeqnvlrfMelxvS/ikRIR/oNJPqXjw+Yw+Z5npMSHpIitz08ZDl8ZaybeDoGyZz HdToFUHxq2q58zHRftXIJv8R841Pb27bP7/tM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Jod4dwxa07jUPQ9vaCflhDxrwPwxTHervNZ/FEVMjWo=; b=regUGYBEOr81kXN5c99vYBOprcnut2PHi+YMByDYuc3RQQsuwSx/R0g8oRnmfNiYXV nN6/QpP7hTLVGBQGsxZsh+RvTbdgMz88gxoXVlLUiEYvvwtrFhTt7bVqHk8CVVeEHgYA XaD59bfcrCI9J98LrByLpe1dq/kwoIGBvRY4wh9AJ4oAaLAku0jWDPDIfX2PHA0+4PVL /Y59Cj5KlGCzXfMyeh8Hh9VMtlQ6x2RxfnlA5ijh8bZXVhsjSooPoPoVVn73S2LCorEv 14ac2euvipjL/+zIdZyEbxpBaQPPVZ1SR2tlY3E7wuAHzcY5YuRS0qLmv4OzfskcPcn/ fbJg== X-Gm-Message-State: AA+aEWY+HaFjCc1QPk3YKeNwq6xvIpFXUzNUhDr7AfG5YPF8WVWTWxpo xSUflCqM/jyNjKp+O9qF0/BVyVkLimcu9AgsbC9gOA== X-Google-Smtp-Source: AFSGD/X4HIQS8dr6ddoxLMQ4eXbbUmYvTD/xB8Z1TiuzObtto9Zs5OXDI+UgKprh+6psejSPKa3qBy3R6SYrIwJWLM0= X-Received: by 2002:a5e:cb0b:: with SMTP id p11mr20249061iom.60.1545250280912; Wed, 19 Dec 2018 12:11:20 -0800 (PST) MIME-Version: 1.0 References: <20181212121931.26620-1-ard.biesheuvel@linaro.org> <20181212123629.rkfzkb4lr5arjpo4@bivouac.eciton.net> In-Reply-To: <20181212123629.rkfzkb4lr5arjpo4@bivouac.eciton.net> From: Ard Biesheuvel Date: Wed, 19 Dec 2018 21:11:09 +0100 Message-ID: To: Leif Lindholm Cc: "edk2-devel@lists.01.org" , "Gao, Liming" 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, 19 Dec 2018 20:11:22 -0000 Content-Type: text/plain; charset="UTF-8" On Wed, 12 Dec 2018 at 13:36, Leif Lindholm wrote: > > 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 > I accidentally pushed this, and failed to add the tags as well. Given that this only affects 32-bit ARM, I guess few people are going to mind, so I am going to leave this as-is unless anyone complains. > > 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 > >