Hi everyone,
I just reported the following issue: https://llvm.org/bugs/show_bug.cgi?id=24927
Using the Xcode 7 linker, one gets messages such as the following when linking objects generated using llvm: __*ld: warning: object file (foo.o) was built for newer OS X version (14.5) than being linked (10.9)*__ The issue is the following: a) In lib/Support/Unix/Host.inc, sys::getDefaultTargetTriple() sets the OS name to darwin14.5 when running on MaxOS X 10.10. 14.5 is the Darwin kernel version as reported by uname. b) In lib/CodeGen/AsmPrinter.cpp, AsmPrinter::doInitialization() writes out this version number to the LC_VERSION_MIN_MACOSX of the generated object. c) The XCode 7 linker seems to expect that LC_VERSION_MIN_MACOSX contains the minimum version number of the MacOS X SDK (10.9, 10.11, ...), NOT the Darwin kernel version number! _**AFAICT, LLVM had this wrong behaviour for a long time. The only new thing with Xcode 7 is that the linker is now reporting a warning for the version mismatch.**_
As a workaround, we are temporarily stripping out the darwin kernel version number from the triple in our project code. Something like:
// FIXME: LLVM confuses Darwin Kernel version numbers with MacOS X SDK // version. By stripping out the kernel version number, we prevent the // LC_VERSION_MIN_MACOSX directive from being emitted. Hopefully, that // will get fixed by LLVM 3.8... // // See LLVM bug 24927: https://llvm.org/bugs/show_bug.cgi?id=24927#if defined(OSX) #if (LLVM_VERSION_MAJOR < 3) || ((LLVM_VERSION_MAJOR == 3) && (LLVM_VERSION_MINOR < 8 )) triple = Triple(triple.getArchName(), triple.getVendorName(), "darwin", triple.getEnvironmentName()); #endif #endif
This prevents the LC_VERSION_MIN_MACOSX directives from being emitted into the LLVM generated object files.
<b>*Any suggestions how to go about fixing LLVM to generate the correct LC_VERSION_MIN_MACOSX minimum SDK version number ? There seems to be no way to pass this information correctly through the Triple!*</b>
Thanks,
Benoit
Benoit Belley
Sr Principal Developer
M&E-Product Development Group
MAIN +1 514 393 1616
DIRECT +1 438 448 6304
FAX +1 514 393 0110
Autodesk, Inc.
10 Duke Street
Montreal, Quebec, Canada H3C 2L7