This is an archive of the discontinued LLVM Phabricator instance.

Fix building DynamicLibrary.cpp with musl libc
ClosedPublic

Authored by dim on Jun 4 2017, 1:37 PM.

Details

Summary

The workaround added in 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.

Event Timeline

dim created this revision.Jun 4 2017, 1:37 PM
krytarowski accepted this revision.Jun 4 2017, 1:47 PM
/* Standard streams.  */
extern struct _IO_FILE *stdin;          /* Standard input stream.  */
extern struct _IO_FILE *stdout;         /* Standard output stream.  */
extern struct _IO_FILE *stderr;         /* Standard error output stream.  */
/* C89/C99 say they're macros.  Make them happy.  */
#define stdin stdin
#define stdout stdout
#define stderr stderr

Confirmed.

This revision is now accepted and ready to land.Jun 4 2017, 1:47 PM
This revision was automatically updated to reflect the committed changes.
tpimh added a subscriber: tpimh.Jun 5 2017, 6:31 AM