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.
Summary of changes
This PR addresses the issue #6045
Reason for change
When using the
dlsym
function, the compiler adds in the import symbols table that we need thedlsym
symbol.Before being a universal binary (same binary used for glibc-based linux and musl-libc-based linux) and the compiler added in a
DT_NEEDED
section the librarylibdl.so
(the library containingdlsym
). When the wrapper is loaded, it will look through all theDT_NEEDED
sections to find a library that contains thedlsym
symbol.Since being a universal binary, the
DT_NEEDED
sections are removed (part of being universal) and we have to resolve by hand needed symbols (dlsym
,pthread_once
..).If we use
dlsym
(or other symbol), we will hit this issue.Implementation details
__dd_dlsym
insteadTest coverage
Added a snapshot test using
nm
that verifies that the undefined symbols in the universal binary haven't changed. It's equivalent to runningbut done using Nuke instead. It would probably make sense for this to be a "normal" test in the native tests, but given it has a dependency on
nm
, which is definitely available in the universal build dockerfile it was quicker and easier to get this up and running directly. When it fails, it prints the diff and throws an exception, e.g.Other details
This is a hotfix of