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

Backport 2.x: DT_NEEDED for shared builds in makefile #5133

Conversation

haampie
Copy link
Contributor

@haampie haampie commented Nov 5, 2021

Backport of #5126

@haampie haampie changed the base branch from development to development_2.x November 5, 2021 08:18
@haampie haampie changed the title DT_NEEDED for shared builds in makefile (backport) Backport 2.x: DT_NEEDED for shared builds in makefile Nov 5, 2021
@haampie haampie closed this Nov 5, 2021
@haampie haampie reopened this Nov 5, 2021
The makefile build specifies -L. -lmbedx509 -lmbedcrypto flags first,
and only then object files referencing symbols from those libraries.

In this order the linker will not add the linked libraries to the
DT_NEEDED section because they are not referenced yet (at least that
happens for me on ubuntu 20.04 with the default gnu compiler tools).

By first specifying the object files and then the linked libraries, we
do end up with libmbedx509 and libmbedcrypto in the DT_NEEDED sections.

This way running dlopen(...) on libmedtls.so just works.

Note that the CMake build does this by default.

Signed-off-by: Harmen Stoppels <[email protected]>
@haampie haampie force-pushed the fix/DT_NEEDED_for_shared_libraries-2.x branch from bdfe3e4 to 3ed4263 Compare November 5, 2021 08:31
@gilles-peskine-arm gilles-peskine-arm added bug Community single-reviewer This PR qualifies for having only one reviewer labels Nov 5, 2021
@gilles-peskine-arm gilles-peskine-arm merged commit 95c3971 into Mbed-TLS:development_2.x Nov 5, 2021
@haampie haampie deleted the fix/DT_NEEDED_for_shared_libraries-2.x branch November 5, 2021 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug single-reviewer This PR qualifies for having only one reviewer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants