Skip to content

[compiler-rt][memprof] Do not add libdl to MEMPROF_UNITTEST_LINK_LIBRARIES #98221

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

Conversation

alexander-shaposhnikov
Copy link
Collaborator

The memprof tests do not actually depend on libdl.
They might have a transitive dependency on libdl through the runtime, but the runtime takes care of itself.
Based on the offline discussions it looks like this piece of code in cmake is a historical artifact.

Test plan: ninja check-all

@llvmbot llvmbot added compiler-rt PGO Profile Guided Optimizations labels Jul 9, 2024
@llvmbot
Copy link
Member

llvmbot commented Jul 9, 2024

@llvm/pr-subscribers-pgo

Author: Alexander Shaposhnikov (alexander-shaposhnikov)

Changes

The memprof tests do not actually depend on libdl.
They might have a transitive dependency on libdl through the runtime, but the runtime takes care of itself.
Based on the offline discussions it looks like this piece of code in cmake is a historical artifact.

Test plan: ninja check-all


Full diff: https://github.com/llvm/llvm-project/pull/98221.diff

1 Files Affected:

  • (modified) compiler-rt/lib/memprof/tests/CMakeLists.txt (-1)
diff --git a/compiler-rt/lib/memprof/tests/CMakeLists.txt b/compiler-rt/lib/memprof/tests/CMakeLists.txt
index 0b5c302a4ce5d..a35f12bc14265 100644
--- a/compiler-rt/lib/memprof/tests/CMakeLists.txt
+++ b/compiler-rt/lib/memprof/tests/CMakeLists.txt
@@ -49,7 +49,6 @@ endif()
 set(MEMPROF_UNITTEST_LINK_LIBRARIES
   ${COMPILER_RT_UNWINDER_LINK_LIBS}
   ${SANITIZER_TEST_CXX_LIBRARIES})
-append_list_if(COMPILER_RT_HAS_LIBDL -ldl MEMPROF_UNITTEST_LINK_LIBRARIES)
 
 # Adds memprof tests for each architecture.
 macro(add_memprof_tests_for_arch arch)

@alexander-shaposhnikov alexander-shaposhnikov merged commit 04f0adc into llvm:main Jul 9, 2024
7 of 8 checks passed
@chapuni
Copy link
Contributor

chapuni commented Jul 10, 2024

This fails linking MemProfTests on Linux.

sanitizer_linux_libcdep.cpp uses dlsym but sanitizer_common doesn't provide deps on -ldl.

alexander-shaposhnikov added a commit that referenced this pull request Jul 10, 2024
Copy link
Member

@arichardson arichardson left a comment

Choose a reason for hiding this comment

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

As far as I recall libdl is only needed for dl_iterate_phdrs which is used by some sanitizers (and won't be pulled in implicitly for static linking), but if memprof does not need it we can defintely drop it.

aaryanshukla pushed a commit to aaryanshukla/llvm-project that referenced this pull request Jul 14, 2024
…ARIES (llvm#98221)

Remove unnecessary dependency.

Test plan: ninja check-all
aaryanshukla pushed a commit to aaryanshukla/llvm-project that referenced this pull request Jul 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler-rt PGO Profile Guided Optimizations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants