[lld] 08ef24f - Wrap xar/xar.h include in extern "C" block

Sylvestre Ledru via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 23 00:37:37 PDT 2021


Author: Mike Hommey
Date: 2021-09-23T09:37:30+02:00
New Revision: 08ef24f6abdfaee038c47e3fe0b61b40e8fd9053

URL: https://github.com/llvm/llvm-project/commit/08ef24f6abdfaee038c47e3fe0b61b40e8fd9053
DIFF: https://github.com/llvm/llvm-project/commit/08ef24f6abdfaee038c47e3fe0b61b40e8fd9053.diff

LOG: Wrap xar/xar.h include in extern "C" block

Without such wrapping, linking lld fails with missing symbols because of
C++ symbol mangling with older versions of the MacOSX SDK, in which
xar.h doesn't have an extern "C" block itself.

Reviewed By: #lld-macho, thakis

Differential Revision: https://reviews.llvm.org/D110224

Added: 
    

Modified: 
    lld/MachO/SyntheticSections.cpp

Removed: 
    


################################################################################
diff  --git a/lld/MachO/SyntheticSections.cpp b/lld/MachO/SyntheticSections.cpp
index 58306511932b1..b03810dc2c5ca 100644
--- a/lld/MachO/SyntheticSections.cpp
+++ b/lld/MachO/SyntheticSections.cpp
@@ -27,7 +27,9 @@
 
 #ifdef LLVM_HAVE_LIBXAR
 #include <fcntl.h>
+extern "C" {
 #include <xar/xar.h>
+}
 #endif
 
 using namespace llvm;


        


More information about the llvm-commits mailing list