[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
link failure of gdb with non-gcc compiler
From: |
Bruno Haible |
Subject: |
link failure of gdb with non-gcc compiler |
Date: |
Wed, 10 May 2006 20:07:30 -0000 |
User-agent: |
KMail/1.5 |
Bulding gdb-6.4 on Linux/x86 with Sun C 5.9 finally also leads to a static
executable, because "-rdynamic" with this compiler is unsupported:
cc: Warning: illegal option -dynamic
and leads to a statically linked executable (undocumented behaviour).
Instead, for this compiler, the equivalent option is -Wl,--export-dynamic.
Here is a fix, choosing the right option to use in configure.ac. (Btw,
this patch uses the option --export-dynamic of GNU ld. I don't understand
why the Solaris handling in configure.ac uses the option -export-dynamic.
This is *not* a documented option of GNU ld.)
2006-05-07 Bruno Haible <address@hidden>
Make it possible to use a non-gcc compiler on Linux/x86.
* configure.ac (EXPORT_DYNAMIC) [linux]: New variable.
* config/i386/linux.mh (LOADLIBES): Use it.
*** gdb-6.4/gdb/configure.ac.bak 2005-07-25 17:08:40.000000000 +0200
--- gdb-6.4/gdb/configure.ac 2006-05-07 19:19:26.000000000 +0200
***************
*** 1019,1024 ****
--- 1019,1053 ----
AC_MSG_RESULT(no)
fi
;;
+ linux*)
+ # The GNU linker requires the --export-dynamic option to make
+ # all symbols visible in the dynamic symbol table. But the option
+ # to pass depends on the compiler.
+ if test "$GCC" = "yes" ; then
+ EXPORT_DYNAMIC="-rdynamic"
+ else
+ # Try "-rdynamic" and "-Wl,--export-dynamic".
+ AC_MSG_CHECKING([for the -rdynamic flag])
+ saved_ldflags=$LDFLAGS
+ LDFLAGS="${LDFLAGS} -ldl -rdynamic"
+ AC_TRY_RUN([#include <dlfcn.h>
+ #include <stddef.h>
+ int foo () { return 42; }
+ int main ()
+ {
+ return (dlsym (NULL, "foo") == NULL);
+ }],
+ found=yes, found=no)
+ LDFLAGS=$saved_ldflags
+ AC_MSG_RESULT($found)
+ if test $found = yes; then
+ EXPORT_DYNAMIC="-rdynamic"
+ else
+ EXPORT_DYNAMIC="-Wl,--export-dynamic"
+ fi
+ fi
+ AC_SUBST([EXPORT_DYNAMIC])
+ ;;
aix*)
AC_MSG_CHECKING(for AiX thread debugging library)
AC_CACHE_VAL(gdb_cv_have_aix_thread_debug,
*** gdb-6.4/gdb/config/i386/linux.mh.bak 2005-09-10 20:11:10.000000000
+0200
--- gdb-6.4/gdb/config/i386/linux.mh 2006-05-07 19:09:08.000000000 +0200
***************
*** 8,11 ****
# The dynamically loaded libthread_db needs access to symbols in the
# gdb executable.
! LOADLIBES = -ldl -rdynamic
--- 8,11 ----
# The dynamically loaded libthread_db needs access to symbols in the
# gdb executable.
! LOADLIBES = -ldl @EXPORT_DYNAMIC@
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- link failure of gdb with non-gcc compiler,
Bruno Haible <=