[PATCH] D39297: [DynamicLibrary] Fix build on musl libc

Keno Fischer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 25 09:53:08 PDT 2017


loladiro created this revision.

On musl libc, stdin/out/err are defined as `FILE* const` globals, and their address is not implicitly convertible to void *
(or at least gcc 6 doesn't allow it). Add an explicit cast to fix that problem.


Repository:
  rL LLVM

https://reviews.llvm.org/D39297

Files:
  lib/Support/Unix/DynamicLibrary.inc


Index: lib/Support/Unix/DynamicLibrary.inc
===================================================================
--- lib/Support/Unix/DynamicLibrary.inc
+++ lib/Support/Unix/DynamicLibrary.inc
@@ -71,7 +71,7 @@
 // Must declare the symbols in the global namespace.
 static void *DoSearch(const char* SymbolName) {
 #define EXPLICIT_SYMBOL(SYM) \
-   extern void *SYM; if (!strcmp(SymbolName, #SYM)) return &SYM
+   extern void *SYM; if (!strcmp(SymbolName, #SYM)) return (void*)&SYM
 
   // If this is darwin, it has some funky issues, try to solve them here.  Some
   // important symbols are marked 'private external' which doesn't allow


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39297.120274.patch
Type: text/x-patch
Size: 638 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171025/e8562455/attachment.bin>


More information about the llvm-commits mailing list