Skip to content

Commit

Permalink
fixup! Do not override symbols in the muslc linker
Browse files Browse the repository at this point in the history
  • Loading branch information
pablogsal committed Feb 7, 2024
1 parent 73887e8 commit 422a0ee
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
6 changes: 3 additions & 3 deletions src/memray/_memray/hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,15 +344,15 @@ class DlsymCache
return d_handles.insert(handle);
}

void deleteEntry(const void* handle)
void erase(const void* handle)
{
std::unique_lock lock(mutex_);
d_handles.erase(handle);
}

private:
mutable std::mutex mutex_;
std::set<const void*> d_handles;
std::unordered_set<const void*> d_handles;
};

static DlsymCache dlsym_cache;
Expand Down Expand Up @@ -390,7 +390,7 @@ dlclose(void* handle) noexcept
tracking_api::RecursionGuard guard;
ret = MEMRAY_ORIG(dlclose)(handle);
}
dlsym_cache.deleteEntry(handle);
dlsym_cache.erase(handle);
tracking_api::NativeTrace::flushCache();
if (!ret) tracking_api::Tracker::invalidate_module_cache();
return ret;
Expand Down
10 changes: 0 additions & 10 deletions tests/integration/rpath_extension/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,13 @@

from setuptools import Extension
from setuptools import setup
from setuptools.command.build_ext import build_ext

# Compile the shared library before building the extension
subprocess.run(
["gcc", "-shared", "-o", "sharedlibs/sharedlib.so", "sharedlibs/sharedlib.c"]
)


class CustomBuildExt(build_ext):
def run(self):
# Run the original build_ext command
build_ext.run(self)

# Add code to compile the shared library


setup(
name="ext",
version="1.0",
Expand All @@ -28,5 +19,4 @@ def run(self):
extra_link_args=["-Wl,-rpath,$ORIGIN/sharedlibs"],
)
],
cmdclass={"build_ext": CustomBuildExt},
)
2 changes: 1 addition & 1 deletion tests/integration/test_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ def test_hard_exit(tmpdir, py_finalize):


@pytest.mark.skipif(
sys.platform == "darwin", reason="Test requires a linker that supports -rpath"
sys.platform == "darwin", reason="Test requires a linker that supports $ORIGIN"
)
def test_dlopen_with_rpath(tmpdir, monkeypatch):
# GIVEN
Expand Down

0 comments on commit 422a0ee

Please sign in to comment.