Building a gnulib testdir on CentOS 8-stream with Oracle DeveloperStudio 12.6,
configure bails out, due to option '-rdynamic', that 'cc' transforms into a
linker option '-dynamic', but the linker (/usr/bin/ld) does not support that
option.


2025-09-18  Bruno Haible  <[email protected]>

        stack-trace: Add support for Oracle DeveloperStudio cc.
        * m4/stack-trace.m4 (gl_STACK_TRACE_EARLY): Use option
        '-Wl,-export-dynamic' instead of '-rdynamic'.

diff --git a/m4/stack-trace.m4 b/m4/stack-trace.m4
index abf6fc21b4..b8c8297abd 100644
--- a/m4/stack-trace.m4
+++ b/m4/stack-trace.m4
@@ -1,5 +1,5 @@
 # stack-trace.m4
-# serial 4
+# serial 5
 dnl Copyright (C) 2024-2025 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -71,10 +71,13 @@ AC_DEFUN([gl_STACK_TRACE_EARLY]
           if test $CAN_PRINT_STACK_TRACE = 1; then
             dnl Link all programs in such a way that the stack trace includes
             dnl the function names.
-            dnl '-rdynamic' is equivalent to '-Wl,-export-dynamic'.
+            dnl gcc supports '-rdynamic' as an option equivalent to
+            dnl '-Wl,-export-dynamic'. But cc from Oracle DeveloperStudio 12.6
+            dnl converts '-rdynamic' into a linker option '-dynamic', which the
+            dnl linker does not understand. So better avoid '-rdynamic'.
             case "$host_os" in
               *-gnu* | gnu* | openbsd*)
-                LDFLAGS="$LDFLAGS -rdynamic"
+                LDFLAGS="$LDFLAGS -Wl,-export-dynamic"
                 ;;
             esac
           fi




Reply via email to