http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48109
Summary: Objective-C class defs/refs are lost under LTO on Darwin for ABI0/1 Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: objc AssignedTo: unassig...@gcc.gnu.org ReportedBy: ia...@gcc.gnu.org Host: *-apple-darwin* Target: *-apple-darwin* Build: *-apple-darwin* This is a FE bug that manifests only on Darwin/NeXT (m32) under LTO. (originally reported as part of PR48094) e.g. -L/sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/x86_64-apple-darwin10.7.0/i386/libobjc/.libs -lobjc -m32 -o objc-dg-lto-trivial-1-21 (timeout = 300) ld: warning: section __OBJC/__image_info has unexpectedly large size 16 in /var/tmp//ccMlEsXS.lto.o^M Undefined symbols for architecture i386:^M ".objc_class_name_myRootObject", referenced from:^M pointer-to-literal-objc-class-name in ccMlEsXS.lto.o^M pointer-to-literal-objc-class-name in ccMlEsXS.lto.o^M ld: symbol(s) not found for architecture i386^M --- The reason is an anachronism in using target macros to emit efficient representations of class presence and requirement (ASM_DECLARE_CLASS_REFERENCE/ASM_DECLARE_UNRESOLVED_REFERENCE). .. because of this, there are no real vars representing the presence/requirement for the classes and, when LTO is engaged, the information is lost. The separate external defs/refs are required because the class metadata structures are all local to a given TU. The refs meet the linkage requirements. For the m64 ABI-2 this is not longer an issue, since class metadata definitions are now external and thus visible without additional action.