[petsc-dev] Symbol names using clang in addition to gcc

Aagaard, Brad T baagaard at usgs.gov
Thu Sep 22 11:23:05 CDT 2022


Satish,

I used to be able to get symbol names using clang (macOS) and this still works, but I need to edit the defines in dlimpl.c because __USE_GNU is not defined. Is there a reason why the current code is limited to __USE_GNU and doesn’t allow broader use when it works?

Here is the change I made to my local version to allow symbol names.

diff --git a/src/sys/dll/dlimpl.c b/src/sys/dll/dlimpl.c
index 5bd68aa5a33..ded4ce5adbb 100644
--- a/src/sys/dll/dlimpl.c
+++ b/src/sys/dll/dlimpl.c
@@ -323,7 +323,7 @@ PetscErrorCode PetscDLAddr(void (*func)(void), char **name) {
   PetscFunctionBegin;
   PetscValidPointer(name, 2);
   *name = NULL;
-#if defined(PETSC_HAVE_DLADDR) && defined(__USE_GNU)
+#if defined(PETSC_HAVE_DLADDR) && (defined(__USE_GNU) || defined(__clang__))
   dlerror(); /* clear any previous error */
   {
     Dl_info info;


Thanks,
Brad

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20220922/cd676577/attachment.html>


More information about the petsc-dev mailing list