This is an archive of the discontinued LLVM Phabricator instance.

Use va_copy instead of __va_copy to fix building libomp against musl libc
ClosedPublic

Authored by plevine on Aug 4 2017, 5:01 PM.

Details

Summary

Building libomp in Gentoo Linux with musl as libc using GCC-6.3.0 or GCC-5.4.0 results in:

/var/tmp/portage/sys-libs/libomp-9999/work/libomp-9999/runtime/src/kmp_str.cpp:171:28: error: ‘__va_copy’ was not declared in this scope
       __va_copy(_args, args); // Make copy of args.
                            ^

musl had previously provided __va_copy but has since relegated it only for scenarios in which __GNUC__ < 3, in favor of using va_copy (see http://git.musl-libc.org/cgit/musl/commit/?id=def0af189871a499efdc9bc37438d8b20eb702ab).

Seeing as libomp source code already uses one-line, double-slash style comments which implies a dependency on at least C99 standard dialect, and that va_copy is a C99 standard macro, it would seem the best course of action would be to change __va_copy to va_copy.

Fixes https://bugs.llvm.org/show_bug.cgi?id=34040

Diff Detail

Repository
rL LLVM

Event Timeline

plevine created this revision.Aug 4 2017, 5:01 PM
jlpeyton accepted this revision.Aug 7 2017, 2:26 PM

All our sources are compiled as C++11 files and va_copy() is part of the C++11 standard. So this looks good to me.

This revision is now accepted and ready to land.Aug 7 2017, 2:26 PM

I'm afraid I don't have write access so I would appreciate it if someone could commit this for me. Thanks.

This revision was automatically updated to reflect the committed changes.