-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
honor the needed
flag of SystemLibs in the macos linker code
#10192
Comments
@andrewrk So this one is interesting. AFAIK Apple's With upstream zig:
With Apple's clang (and ld64):
|
I'd like to make it consistent across platforms if possible, meaning that we would take the "as needed" as the default. Unless this imposes too much of a perf cost from a linker perspective, in which case I think that is enough to change the default back. If you're on board with this, it's done from the frontend perspective; all that needs to happen is the MachO linker code honor the "needed" field of SystemLib. |
Hmm, I don't think we should change the default behaviour of |
As it stands the frontend code that collects CLI arguments decides whether a SystemLib has the needed flag set, and regardless this issue is for the MachO linker code to honor the needed flag. If we want to make the default different for MachO, that still goes into the frontend code that collects CLI arguments, and will need to do conditional logic based on the target OS. Can you form an argument about why to not make it consistent across platforms? My proposal is that the default would be to effectively add |
My main argument is linking in Objective-C runtime which sometimes is required even if no symbols are physically imported. This was already reported as a bug to us and fixed in #9542. My main argument is that macOS users won't expect this as this is the status quo on macOS. |
Also, from
which is effectively a warning not to do this if your program depends on a runtime such as Objective-C runtime as in the linked PR. |
Understood. In this case let us change the default back to I will make the frontend CLI change separately. |
Extracted from #10164. The Mach-O linking code does not currently inspect the
needed
flag of dynamic libraries before linking against a dynamic library. In order to support this feature, it must be possible to do something like this:Excuse my use of objdump - I'm not sure what the equivalent tool is for macho.
The text was updated successfully, but these errors were encountered: