[Mach-O] Support -flat_namespace flag - #795
Draft
carlocab wants to merge 1 commit into
Draft
Conversation
This implements the minimum necessary to support the `-flat_namespace`
flag.
I have not added this flag to the `-help` text, because I'm not certain
this is faithful to ld64's behaviour under this flag. From `man ld`:
-flat_namespace
Alters how symbols are resolved at build time and runtime. With -two_levelnamespace (the default), the linker only
searches dylibs on the command line for symbols, and records in which dylib they were found. With -flat_namespace, the
linker searches all dylibs on the command line and all dylibs those original dylibs depend on. The linker does not record
which dylib an external symbol came from, so at runtime dyld again searches all images and uses the first definition it
finds. In addition, any undefines in loaded flat_namespace dylibs must be resolvable at build time.
However, I believe what is done here is enough to approximate what build
systems expect to happen when they pass `-flat_namespace` to the linker.
Closes rui314#785.
Signed-off-by: Carlo Cabrera <30379873+carlocab@users.noreply.github.com>
Author
|
Actually, I'd like to test this some more to make sure. |
carlocab
marked this pull request as draft
October 19, 2022 16:32
Owner
|
Yeah, I think the flag needs more than this. We record dylib names along with dynamic symbols, but that doesn't make sense for the flag namespace. |
rui314
force-pushed
the
main
branch
2 times, most recently
from
December 31, 2022 23:41
bf2c440 to
df9e997
Compare
rui314
force-pushed
the
main
branch
3 times, most recently
from
January 14, 2023 02:22
cc86039 to
25d02bb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This implements the minimum necessary to support the
-flat_namespaceflag.I have not added this flag to the
-helptext, because I'm not certain this is faithful to ld64's behaviour under this flag. Fromman ld:However, I believe what is done here is enough to approximate what build systems expect to happen when they pass
-flat_namespaceto the linker.Closes #785.
Signed-off-by: Carlo Cabrera 30379873+carlocab@users.noreply.github.com