Skip to content


Browse files Browse the repository at this point in the history
[efi] Fix building elf2efi.c when -fpic is enabled by default
The x86_64 EDK2 headers include a #pragma to mark all subsequent
symbol declarations and references as hidden if position-independent
code is being generated.  Since libgen.h is currently included only
after the EDK2 headers, this results in __xpg_basename() being
erroneously marked as having hidden visibility (if the compiler
defaults to building position-independent code); this eventually
results in a failure to link the elf2efi binary.

Fix by including libgen.h prior to including the EDK2 headers.

Originally-fixed-by: Doug Goldstein <>
Signed-off-by: Michael Brown <>
  • Loading branch information
mcb30 committed Jan 25, 2017
1 parent bd6255c commit 941c53a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/util/elf2efi.c
Expand Up @@ -32,9 +32,9 @@
#include <sys/mman.h>
#include <fcntl.h>
#include <elf.h>
#include <libgen.h>
#include <ipxe/efi/Uefi.h>
#include <ipxe/efi/IndustryStandard/PeImage.h>
#include <libgen.h>

#define eprintf(...) fprintf ( stderr, __VA_ARGS__ )

Expand Down

0 comments on commit 941c53a

Please sign in to comment.