From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=209.85.128.48; helo=mail-wm1-f48.google.com; envelope-from=philmd@redhat.com; receiver=edk2-devel@lists.01.org Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (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 E55E82119C8AD for ; Wed, 12 Dec 2018 05:56:06 -0800 (PST) Received: by mail-wm1-f48.google.com with SMTP id q26so6018495wmf.5 for ; Wed, 12 Dec 2018 05:56:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=6IUdrlyi9EtFOIwecNqSMtHLYa0kiOLN6PX/0Vd7HIw=; b=fBOjzeKTkAbg9KaqalFShc5TqkkuiQqrnLzVneFj/USSWhJH+oChSJoP9qyVwfC0gx eFaqDB6Is+YOaYu+dl33rRUkVxjBFJfIiE7hUxDN8QoBDHKa4d+wgZH8Mtk2+75DKm5r dxV5Yl1qaYfvLzL5rUnlwl46t+lGJXvLlXo0X0cxsiUXbvzS9UCE5qQWqhwQuO5MUweW osIxUjMXZ8ffaGrgwSCkfU6JG3dbPM1LUNZWeS+hy+mXnyKaUiyaIAJ2F6wvUQbErPV1 PdKA3kVtV9OUNgx4G9BOOCuAzBo+JVL3+48Kznxypu3a5RLm3orSYLY6cMF2RnoG4rvT UyjQ== X-Gm-Message-State: AA+aEWbVmRa5ihh7P0RbdBzCOA7qBTYuk+NFF5fQ5CUN+/OejxjiKj04 YM4HlmOaGg0gn5HSs4OWI9kuPg== X-Google-Smtp-Source: AFSGD/WqLZBViUb3NcLQ8b15ihvr/LcayiydaxCkVuvndTauVKBOGpymR77o6i6ZY7O7VxNw2wPOUQ== X-Received: by 2002:a1c:8cd0:: with SMTP id o199mr6066545wmd.56.1544622964069; Wed, 12 Dec 2018 05:56:04 -0800 (PST) Received: from [10.201.33.118] ([195.166.127.210]) by smtp.gmail.com with ESMTPSA id n82sm3110136wma.42.2018.12.12.05.56.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 05:56:03 -0800 (PST) To: Ard Biesheuvel , edk2-devel@lists.01.org Cc: liming.gao@intel.com References: <20181212121931.26620-1-ard.biesheuvel@linaro.org> From: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= Openpgp: id=89C1E78F601EE86C867495CBA2A3FD6EDEADC0DE; url=http://pgp.mit.edu/pks/lookup?op=get&search=0xA2A3FD6EDEADC0DE Message-ID: <9940a871-68be-339f-b5e5-a7628df273b5@redhat.com> Date: Wed, 12 Dec 2018 14:56:01 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 In-Reply-To: <20181212121931.26620-1-ard.biesheuvel@linaro.org> 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 13:56:07 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit On 12/12/18 1:19 PM, 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. > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Ard Biesheuvel Reviewed-by: Philippe Mathieu-Daudé > --- > 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) >