[LLVMbugs] [Bug 23007] New: With LTO, dead stripped ObjC protocols can result in linker error
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Mar 24 11:41:19 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=23007
Bug ID: 23007
Summary: With LTO, dead stripped ObjC protocols can result in
linker error
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Common Code Generator Code
Assignee: unassignedbugs at nondot.org
Reporter: peter at pcc.me.uk
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
On Darwin:
$ cat foo.mm
#import <Foundation/Foundation.h>
@protocol CrAppProtocol
- (bool)isHandlingSendEvent;
@end
bool foo(NSObject *obj) {
return [obj conformsToProtocol:@protocol(CrAppProtocol)];
}
$ cat main.c
int main() {}
$ export DYLD_LIBRARY_PATH=$HOME/src/llvm-build-rel/lib
$ $HOME/src/llvm-build-rel/bin/clang -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk
-c -flto foo.mm main.c
$ ar cru libfoo.a foo.o
$ $HOME/src/llvm-build-rel/bin/clang -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk
-flto -Wl,-ObjC -Wl,-dead_strip main.o libfoo.a
ld: warning: '__Z3fooP8NSObject' is implemented in bitcode, but it was loaded
too late
Undefined symbols for architecture x86_64:
"_objc_msgSend", referenced from:
import-atom in libfoo.a(foo.o)
"l_OBJC_PROTOCOL_REFERENCE_$_CrAppProtocol", referenced from:
import-atom in libfoo.a(foo.o)
"l_OBJC_LABEL_PROTOCOL_$_CrAppProtocol", referenced from:
import-atom in libfoo.a(foo.o)
"l_OBJC_PROTOCOL_$_CrAppProtocol", referenced from:
l_OBJC_LABEL_PROTOCOL_$_CrAppProtocol in lto.o
l_OBJC_PROTOCOL_REFERENCE_$_CrAppProtocol in lto.o
import-atom in libfoo.a(foo.o)
l_OBJC_LABEL_PROTOCOL_$_CrAppProtocol in libfoo.a(foo.o)
l_OBJC_PROTOCOL_REFERENCE_$_CrAppProtocol in libfoo.a(foo.o)
ld: symbol(s) not found for architecture x86_64
clang-3.7: error: linker command failed with exit code 1 (use -v to see
invocation)
Reverting 209227 and 207979 in LLVM appears to fix this problem.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150324/861540a6/attachment.html>
More information about the llvm-bugs
mailing list