Package: gnu-efi
Version: 3.0.3-2
Tags: upstream patch

----- Forwarded message from Ard Biesheuvel <ard.biesheu...@linaro.org> -----

Date: Tue, 28 Jun 2016 17:17:57 +0200
From: Ard Biesheuvel <ard.biesheu...@linaro.org>
To: nigel.cro...@hpe.com, leif.lindh...@linaro.org, b...@decadent.org.uk
Cc: Ard Biesheuvel <ard.biesheu...@linaro.org>
Subject: [PATCH] ARM: hide 'hidden' pragma for hosted build
Message-Id: <1467127077-31859-1-git-send-email-ard.biesheu...@linaro.org>
X-Mailer: git-send-email 2.7.4

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.

Signed-off-by: Ard Biesheuvel <ard.biesheu...@linaro.org>
---
 inc/arm/efibind.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/inc/arm/efibind.h b/inc/arm/efibind.h
index 0978079b0f89..4609d116ffa0 100644
--- a/inc/arm/efibind.h
+++ b/inc/arm/efibind.h
@@ -36,7 +36,7 @@ typedef signed char         int8_t;   // unqualified 'char' 
is unsigned on ARM
  * This prevents GCC from emitting GOT based relocations, and use R_ARM_REL32
  * relative relocations instead, which are more suitable for static binaries.
  */
-#ifdef __GNUC__
+#if defined(__GNUC__) && !__STDC_HOSTED__
 #pragma GCC visibility push (hidden)
 #endif
 
-- 
2.7.4


----- End forwarded message -----

-- 
Ben Hutchings
In a hierarchy, every employee tends to rise to his level of incompetence.

Attachment: signature.asc
Description: Digital signature

Reply via email to