Closed CognitiveDisson closed 1 month ago
@dmaclach fyi
Is there a reason you have to use the old linker? My guess is Apple will eventually remove it, so the new one will have to be used.
Is there a reason you have to use the old linker? My guess is Apple will eventually remove it, so the new one will have to be used.
@thomasvl We see a significant increase in binary size with ld_prime, even with all the size optimizations. We hope Apple improves this in future versions before the old linker is removed.
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.
This issue is labeled inactive
because the last activity was over 90 days ago. This issue will be closed and archived after 14 additional days without activity.
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please reopen it.
This issue was closed and archived because there has been no new activity in the 14 days since the inactive
label was added.
What version of protobuf and what language are you using? Protobuf / protoc 25.3 Language: Objective-C The issue is also reproducible on the latest main.
What operating system (Linux, Windows, ...) and version? MacOS
What runtime / compiler are you using (e.g., python version or gcc version) Xcode 15.1.0 Bazel 7.1.1
What did you do?
build --linkopt=-ld_classic
build --copt=-flto=thin --linkopt=-flto=thin --linkopt=-Wl,-object_path_lto,lto.o
I will attempt to prepare an example project that reproduces the problem, although this might be challenging.
What did you expect to see No errors.
What did you see instead?
Anything else we should know about your project / environment
After investigating, we found that the issue only arises when LTO is enabled and after we switch to a new proto compiler version. Disabling LTO or switching to ld-prime (default new linker in Xcode 15 which we can’t currently use for other reasons) solves the problem. Through a process of bisecting commits, we identified a commit that is causing the problem: [Objc] Replace reference to message's own class when calling the GPBDescriptor initializer, using a direct linker reference instead of +class. We also tried building protoc version 25.3 with the reverted changes in
src/google/protobuf/compiler/objectivec/message.cc
, which resolved the issue. Our assumption is that "forward declaration of the class, as a linker symbol", is causing this issue, since LTO can strip these symbols as unused.