Skip to content

ld: support -dynamic_lookup_library#1

Open
mathstuf wants to merge 1 commit intoapple-opensource:masterfrom
mathstuf:dynamic-lookup-linking
Open

ld: support -dynamic_lookup_library#1
mathstuf wants to merge 1 commit intoapple-opensource:masterfrom
mathstuf:dynamic-lookup-linking

Conversation

@mathstuf
Copy link
Copy Markdown

@mathstuf mathstuf commented Jun 3, 2020

This causes all symbols found in the specified library to be looked up
at load time. The library itself is not linked by the output library at
all.

The main use case for this is creating compiled modules for dynamic
languages (e.g., Ruby or Python) where the application loading the
module provides the interpreter's symbols. This allows the compiled
module to be agnostic to the installation of the interpreter. That is,
it can link against the Apple-provided Python, but be run with an
Anaconda-provided interpreter.

if ( dylib != NULL ) {
// Handle -dynamic_lookup_library
if ( dylib->forcedDynamicLookupLinked() )
return BIND_SPECIAL_DYLIB_FLAT_LOOKUP;
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is also BIND_SPECIAL_DYLIB_MAIN_EXECUTABLE. However, I suspect this is more geared towards the case where the symbols are actually in the main executable which is not the case for the libpython use case.

@mathstuf
Copy link
Copy Markdown
Author

mathstuf commented Jun 3, 2020

@Bigcheese Bruno and I talked about this in Kona 2019, but I can't seem to find his GitHub handle.

@seanm
Copy link
Copy Markdown

seanm commented Aug 2, 2022

I don't think Apple pays attention to github pull requests, so I filed FB10995337 in their bugtracker.

This causes all symbols found in the specified library to be looked up
at load time. The library itself is not linked by the output library at
all.

The main use case for this is creating compiled modules for dynamic
languages (e.g., Ruby or Python) where the application loading the
module provides the interpreter's symbols. This allows the compiled
module to be agnostic to the installation of the interpreter. That is,
it can link against the Apple-provided Python, but be run with an
Anaconda-provided interpreter.
@mathstuf mathstuf force-pushed the dynamic-lookup-linking branch from c754c2b to 659e8e8 Compare February 6, 2023 18:53
@mathstuf
Copy link
Copy Markdown
Author

mathstuf commented Feb 6, 2023

Updated to actually compile based on testing within the cctools-port project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants