[PATCH 3/3] efi/libstub: arm64: set -fpie when building the EFI stub

Ard Biesheuvel ard.biesheuvel at linaro.org
Thu Jun 8 12:18:36 PDT 2017


On 8 June 2017 at 19:08, Matthias Kaehlcke <mka at chromium.org> wrote:
> El Thu, May 18, 2017 at 10:09:53AM +0100 Ard Biesheuvel ha dit:
>
>> Clang may emit absolute symbol references when building in non-PIC mode,
>> even when using the default 'small' code model, which is already mostly
>> position independent to begin with, due to its use of adrp/add pairs
>> that have a relative range of +/- 4 GB. The remedy is to pass the -fpie
>> flag, which can be done safely now that the code has been updated to avoid
>> GOT indirections (which may be emitted due to the compiler assuming that
>> the PIC/PIE code may end up in a shared library that is subject to ELF
>> symbol preemption)
>>
>> Passing -fpie when building code that needs to execute at an a priori
>> unknown offset is arguably an improvement in any case, and given that
>> the recent visibility changes allow the PIC build to pass with GCC as
>> well, let's add -fpie for all arm64 builds rather than only for Clang.
>>
>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel at linaro.org>
>
> Tested-by: Matthias Kaehlcke <mka at chromium.org>

Thanks Matthias.

For the record, did you test only with Clang?



More information about the linux-arm-kernel mailing list