[llvm] r316672 - [DynamicLibrary] Fix build on musl libc
Keno Fischer via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 26 09:44:13 PDT 2017
Author: kfischer
Date: Thu Oct 26 09:44:13 2017
New Revision: 316672
URL: http://llvm.org/viewvc/llvm-project?rev=316672&view=rev
Log:
[DynamicLibrary] Fix build on musl libc
Summary:
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, giving errors like:
```
error: cannot initialize return object of type 'void *' with an rvalue of type 'FILE *const *' (aka '_IO_FILE *const *')
EXPLICIT_SYMBOL(stderr);
^~~~~~~~~~~~~~~~~~~~~~~
```
Add an explicit cast to fix that problem.
Reviewers: marsupial, krytarowski, dim
Reviewed By: dim
Differential Revision: https://reviews.llvm.org/D39297
Modified:
llvm/trunk/lib/Support/Unix/DynamicLibrary.inc
Modified: llvm/trunk/lib/Support/Unix/DynamicLibrary.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/DynamicLibrary.inc?rev=316672&r1=316671&r2=316672&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Unix/DynamicLibrary.inc (original)
+++ llvm/trunk/lib/Support/Unix/DynamicLibrary.inc Thu Oct 26 09:44:13 2017
@@ -71,7 +71,7 @@ void *DynamicLibrary::HandleSet::DLSym(v
// 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
More information about the llvm-commits
mailing list