Skip to content
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

[Mach-O] Support -flat_namespace flag #795

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Oct 19, 2022

  1. [Mach-O] Support -flat_namespace flag

    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>
    carlocab committed Oct 19, 2022
    Configuration menu
    Copy the full SHA
    d8c64c2 View commit details
    Browse the repository at this point in the history