This is an archive of the discontinued LLVM Phabricator instance.

Protect calls to KMP_DLSYM in kmp_alloc.cpp
AbandonedPublic

Authored by alban.bridonneau on Sep 29 2021, 5:57 AM.

Details

Summary

This fixes static builds of openmp. They currently
fail at runtime because of an "undefined symbol"
error. dlsym is only available for dynamic builds.

Diff Detail

Event Timeline

alban.bridonneau requested review of this revision.Sep 29 2021, 5:57 AM
alban.bridonneau created this revision.
Herald added a project: Restricted Project. · View Herald Transcript

Which platform has the problem? Static build does not preclude linking libdl, which will provide dlsym. So, an alternative solution might be to link libdl for the static library?

kmp_ftn_entry.h uses the same function in several places. No issues there?

openmp/runtime/src/kmp_alloc.cpp
1364

This variable should at least be set to 0/false

The issue was detected on Linux, AArch64.

Other calls to dlsym in kmp_alloc.cpp are already protected by that define, which is why i thought it made sense to do the same here.
It seems that kmp_ftn_entry.h was not included in my build. I'll go through the CMake files to see what happened.

Thanks

kmp_ftn_entry.h provides the implementation for all OpenMP API functions. I'm curious to see what happened, that it is not included.

Hi!
Sorry for the delay, i had a couple of concurrent tasks.

kmp_ftn_entry.h was indeed included, i had just looked at it wrong. Also, we are going to follow your suggestion and link against libdl, so this patch is no longer needed

Thanks for the review!

alban.bridonneau abandoned this revision.Oct 5 2021, 3:17 AM