Weak private linkage for Objective C

Hi all,

I’ve been subscribed to this list on-and-off and always found it very helpful.

I’m facing the problem of compiling a project in Objective C with LLVM in a Darwin environment. There is a certain Objective C protocol that appears in two .m files, and so the corresponding l_OBJC_PROTOCOL and l_OBJC_LABEL_PROTOCOL symbols appear in both .o files.

The problem is that while these symbols are created by gcc 4.2 as weak private external, LLVM (both 2.8 and bleeding-edge) produces these symbols as private external, but not weak. Because they are not weak, the linker (ld) shouts at the duplicate symbol. If I semi-manually patch the Mach-O object files to make these symbols weak [following this documentation: http://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/MachORuntime/Reference/reference.html#//apple_ref/doc/uid/20001298-section], then the problem is solved.

I saw a thread here from June 2010 (http://lists.cs.uiuc.edu/pipermail/llvmdev/2010-June/032767.html) about the weak private linkage type, but I’m not sure it’s now merged into the trunk (it seems to me it’s not) or how to use it exactly.

Is there some command-line flag I can give llvm-gcc or llvmc to make the Objective C protocols appear as weak private symbols in the object files? Any other way to work around this problem of mine?

Many thanks in advance,

Harel Cain

I’m just trying to raise this problem again as I got no answer at all.
Nobody has any information about support or workarounds for weak private linkage for Mach-O objects? See below.


Harel Cain