[PATCH] D33883: Fix building DynamicLibrary.cpp with musl libc
Dimitry Andric via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 4 13:37:09 PDT 2017
dim created this revision.
Herald added subscribers: krytarowski, srhines.
The workaround added in https://reviews.llvm.org/rL301240 for stderr/out/in symbols being both
macros and globals is only necessary for glibc, and it does not compile
with musl libc. Alpine Linux has had the following fix for it:
https://git.alpinelinux.org/cgit/aports/plain/main/llvm4/llvm-fix-DynamicLibrary-to-build-with-musl-libc.patch
Adapt the fix in our DynamicLibrary.inc for Unix.
https://reviews.llvm.org/D33883
Files:
lib/Support/Unix/DynamicLibrary.inc
Index: lib/Support/Unix/DynamicLibrary.inc
===================================================================
--- lib/Support/Unix/DynamicLibrary.inc
+++ lib/Support/Unix/DynamicLibrary.inc
@@ -101,10 +101,10 @@
#define EXPLICIT_SYMBOL(SYM) \
if (!strcmp(SymbolName, #SYM)) return &SYM
-// On linux we have a weird situation. The stderr/out/in symbols are both
+// Under glibc we have a weird situation. The stderr/out/in symbols are both
// macros and global variables because of standards requirements. So, we
// boldly use the EXPLICIT_SYMBOL macro without checking for a #define first.
-#if defined(__linux__) and !defined(__ANDROID__)
+#if defined(__GLIBC__)
{
EXPLICIT_SYMBOL(stderr);
EXPLICIT_SYMBOL(stdout);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33883.101369.patch
Type: text/x-patch
Size: 739 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170604/f358147c/attachment.bin>
More information about the llvm-commits
mailing list