https://bugs.llvm.org/show_bug.cgi?id=51475
Vy Nguyen <[email protected]> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |RESOLVED
Resolution|--- |FIXED
--- Comment #15 from Vy Nguyen <[email protected]> ---
Repro case:
// Foo.h
#import <Foundation/Foundation.h>
@interface Foo : NSObject
@end
// Foo.m
#import "Foo.h"
@implementation Foo {
NSString* _privateDupSym;
}
- (void)prepareForReuse {
_privateDupSym = nil;
}
@end
Put both files in a directory called "one".
Copy the dir to "two".
clang -c -ObjC one/Foo.m -o one/Foo.o
clang -c -ObjC two/Foo.m -o two/Foo.o
llvm-ar r libDup.a one/Foo.o two/Foo.o
LD64 allows linking this.
ld -demangle -dynamic -bundle -arch "x86_64" -platform_version macos 10.15
11.0 -syslibroot
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
-ObjC -lc++ -lobjc -lSystem -framework Foundation libDup.a
LLD doesn't:
$ ../bin/ld64.lld.darwinnew -demangle -dynamic -bundle -arch "x86_64"
-platform_version macos 10.15 11.0 -syslibroot
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
-ObjC -lc++ -lobjc -lSystem -framework Foundation libDup.a
ld64.lld.darwinnew: warning: libDup.a(Foo.o) has version 11.0.0, which is newer
than target minimum of 10.15
ld64.lld.darwinnew: warning: libDup.a(Foo.o) has version 11.0.0, which is newer
than target minimum of 10.15
ld64.lld.darwinnew: error: duplicate symbol: _OBJC_METACLASS_$_Foo
>>> defined in libDup.a(Foo.o)
>>> defined in libDup.a(Foo.o)
ld64.lld.darwinnew: error: duplicate symbol: _OBJC_CLASS_$_Foo
>>> defined in libDup.a(Foo.o)
>>> defined in libDup.a(Foo.o)
-------------------------------------------
However, it seems this is a bug in LD64. It keeps a map symbol=>ar member, and
it *iterates* that for -ObjC. (So it discards duplicates symbols).
(Also if you put -force_load or -all_load the archive, then it'd also complain
about the duplicate symbols).
We probably don't want LLD to do this.
I'll re-close this bug - sorry!
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs