Clang linker fails with assertion when modules support enabled

Originator:jalkut
Number:rdar://14219599 Date Originated:20-Jun-2013 03:20 PM
Status:Duplicate of 14147402 Resolved:
Product:Developer Tools Product Version:
Classification:Serious Bug Reproducible:Always
 
I have a reproduceable clang linkage assertion when compiling and linking a Mac OS X framework where ALL of the following conditions are met:

1. Clang modules support is enabled (CLANG_ENABLE_MODULES = YES)

2. Deployment target is set to 10.7 or earlier.

3. An ObjC source file imports <Cocoa/Cocoa.h>.

4. An ObjC source file references a LaunchServices.framework symbol.

I'm attaching a sample project that demonstrates this problem. Open it and build in Xcode 5.0, and you will see a clang assertion along the lines of:

0  0x10660f118  __assert_rtn + 144
1  0x10665bf72  ld::tool::OutputFile::addSectionRelocs(ld::Internal&, ld::Internal::FinalSection*, ld::Atom const*, ld::Fixup*, ld::Fixup*, ld::Fixup*, ld::Atom const*, ld::Atom const*, unsigned long long, unsigned long long) + 0
2  0x10665cadc  ld::tool::OutputFile::addDyldInfo(ld::Internal&, ld::Internal::FinalSection*, ld::Atom const*, ld::Fixup*, ld::Fixup*, ld::Fixup*, ld::Atom const*, ld::Atom const*, unsigned long long, unsigned long long) + 2386
3  0x106657cd7  ld::tool::OutputFile::generateLinkEditInfo(ld::Internal&) + 1217
4  0x1066536c6  ld::tool::OutputFile::write(ld::Internal&) + 114
5  0x10660f662  main + 1012
6  0x7fff941b07e1  start + 0
A linker snapshot was created at:
	/tmp/ModulesLinkingBug-2013-05-20-151144.ld-snapshot
ld: Assertion failed: (0 && "dylib not assigned ordinal"), function compressedOrdinalForAtom, file /SourceCache/ld64/ld64-142/src/ld/OutputFile.cpp, line 2413.
clang: error: linker command failed with exit code 1 (use -v to see invocation)

(NOTE: I am also including the references linker snapshot folder).

To alleviate the problem, arrange that one of the 5 necessary conditions above is no longer true.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!