Skip to content

lld/mac category behavior doesn't match ld64 #51740

@keith

Description

@keith
Bugzilla Link 52398
Version unspecified
OS All
CC @gkmhub,@int3,@smeenai

Extended Description

With this Objective-C code:

#import <Foundation/Foundation.h>

@interface NSArray (first)
- (void)firstMethod;
@end

@implementation NSArray (first)
- (void)firstMethod {}
@end

@interface NSArray (second)
- (void)secondMethod;
@end

@implementation NSArray (second)
- (void)secondMethod {}
@end

int main() {
    return 0;
}

The produced binary has significantly different symbols than ld64:

--- ld64
+++ lld
@@ -1,7 +1,10 @@
 -[NSArray(first) firstMethod]
 -[NSArray(second) secondMethod]
 _OBJC_CLASS_$_NSArray
+__OBJC_$_CATEGORY_INSTANCE_METHODS_NSArray_$_first
+__OBJC_$_CATEGORY_INSTANCE_METHODS_NSArray_$_second
 __OBJC_$_CATEGORY_NSArray_$_first
-__OBJC_$_INSTANCE_METHODS_NSArray(first|second)
+__OBJC_$_CATEGORY_NSArray_$_second
 __mh_execute_header
 _main
+dyld_stub_binder

It's unclear to me if differences like this will be a major issue, but I assume we're hoping to match ld64 more closely than this?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions