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

Link against snmalloc target, rather than including override sources #6750

Open
eddyashton opened this issue Jan 13, 2025 · 2 comments
Open

Comments

@eddyashton
Copy link
Member

Originally posted by @achamayou in #6746 (comment)

@achamayou
Copy link
Member

It does look like we should be able to use something like:

set(SNMALLOC_ENABLE_DYNAMIC_LOADING ON)
set_property(TARGET snmalloc-new-override PROPERTY POSITION_INDEPENDENT_CODE ON)

...
build snmalloc

target_link_libraries($OUR_LIB INTERFACE snmalloc-new-override)

The first half is only needed for the .so, and can perhaps be removed when we switch to monolithic binaries.

@mjp41
Copy link
Member

mjp41 commented Jan 27, 2025

That should work. It won't override malloc/free, but will do new/delete.

The snmallocshim-static target will provide a malloc and free. You also need to set:

SNMALLOC_STATIC_LIBRARY_PREFIX=""

As it defaults to SNMALLOC_STATIC_LIBRARY_PREFIX="sn_", and this defining sn_malloc, sn_free, ...

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

No branches or pull requests

3 participants