
On targets with non-default program address space (e.g., Harvard architectures), clang crashes when emitting Objective-C method metadata, because the address of the method IMP cannot be bitcast to i8*. It similarly crashes at messenger callsite with a failed bitcast. Define the _imp field instead as i8 addrspace(1)* (or whatever the target's program address space is). And in getMessageSendInfo(), create signatureType by specifying the program address space. Add a regression test using the AVR target. Test failed previously and passes now. Checked codegen of the test for x86_64-apple-darwin19.6.0 and saw no difference, as expected. Reviewed By: rjmccall, dylanmckay Differential Revision: https://reviews.llvm.org/D112113
22 lines
251 B
Objective-C
22 lines
251 B
Objective-C
// RUN: %clang_cc1 -triple avr -emit-llvm -fobjc-runtime=macosx %s -o /dev/null
|
|
|
|
__attribute__((objc_root_class))
|
|
@interface Foo
|
|
|
|
- (id)foo;
|
|
- (id)bar;
|
|
|
|
@end
|
|
|
|
@implementation Foo
|
|
|
|
- (id)foo {
|
|
return self;
|
|
}
|
|
|
|
- (id)bar {
|
|
return [self foo];
|
|
}
|
|
|
|
@end
|