ARM: hide 'hidden' pragma for hosted build

The hidden visibility #pragma in inc/arm/efibind.h was meant to inform
the compiler that symbols with external linkage are never exported from
shared libraries [and thus never preempted] when executing in UEFI context
(since UEFI does not support shared libraries). This allows the compiler to
generate relative symbol references instead of GOT entries, which is much more
efficient since the latter need to be relocated before invoking the entry
point of the UEFI app.

However, as it turns out, this pragma is leaking into other code that does
not run in UEFI context, but simply needs to access data structures that
UEFI defines. So make the pragma dependent on whether we are building with
-ffreestanding, which is only used for bare metal code such as UEFI.

Last-Update: 2018-08-24

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

Elder versions of sbsigntool failed to build on armhf without the patch,
cf. https://launchpad.net/ubuntu/+source/gnu-efi/3.0.8-0ubuntu1~16.04.1
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
This commit is contained in:
Ard Biesheuvel 2016-06-28 17:17:57 +02:00 committed by Heinrich Schuchardt
parent b916d1e54e
commit fa506bd242

View File

@ -38,7 +38,7 @@ typedef int32_t intptr_t;
* This prevents GCC from emitting GOT based relocations, and use R_ARM_REL32 * This prevents GCC from emitting GOT based relocations, and use R_ARM_REL32
* relative relocations instead, which are more suitable for static binaries. * relative relocations instead, which are more suitable for static binaries.
*/ */
#ifdef __GNUC__ #if defined(__GNUC__) && !__STDC_HOSTED__
#pragma GCC visibility push (hidden) #pragma GCC visibility push (hidden)
#endif #endif