From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20734 invoked by alias); 7 Feb 2014 08:01:42 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 20570 invoked by uid 89); 7 Feb 2014 08:01:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.3 required=5.0 tests=AWL,BAYES_00,URIBL_BLACK autolearn=no version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 07 Feb 2014 08:01:39 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1WBgNU-0002Lh-JH from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Fri, 07 Feb 2014 00:01:36 -0800 Received: from SVR-ORW-FEM-04.mgc.mentorg.com ([147.34.97.41]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Fri, 7 Feb 2014 00:01:36 -0800 Received: from qiyao.dyndns.dyndns.org (147.34.91.1) by svr-orw-fem-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server id 14.2.247.3; Fri, 7 Feb 2014 00:01:35 -0800 From: Yao Qi To: Subject: [PATCH 3/3] Find and link with -lmachuser -lhurduser Date: Fri, 07 Feb 2014 08:01:00 -0000 Message-ID: <1391759958-972-4-git-send-email-yao@codesourcery.com> In-Reply-To: <1391759958-972-1-git-send-email-yao@codesourcery.com> References: <1391759958-972-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2014-02/txt/msg00188.txt.bz2 I see this link error when build native gdb for hurd. /home/yao/Software/hurd-toolchain/bin/../lib/gcc/i686-pc-gnu/4.8.0/../../../../i686-pc-gnu/bin/ld: gnu-nat.o: undefined reference to symbol 'mach_port_destroy' /home/yao/Software/hurd-toolchain/bin/../lib/gcc/i686-pc-gnu/4.8.0/../../../../i686-pc-gnu/bin/ld: note: 'mach_port_destroy' is defined in DSO /home/yao/Software/hurd-toolchain/bin/../i686-pc-gnu/libc/lib/libmachuser.so.1 so try adding it to the linker command line /home/yao/Software/hurd-toolchain/bin/../i686-pc-gnu/libc/lib/libmachuser.so.1: could not read symbols: Invalid operation This patch is to find and link GDB with -lmachuser and -lhurduser. I find my patch is quite similar to another patch posted here https://lists.debian.org/debian-hurd/2011/03/msg00198.html in which, it mentioned that this change "will not be needed in next version of libc0.3". However, I don't know much about hurd, and post the patch for review, because it fixes the build failure after all. gdb: 2014-02-07 Yao Qi * configure.ac: Invoke AC_SEARCH_LIBS to search libmachuser and libhurduser. * configure: Regenerated. --- gdb/configure | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ gdb/configure.ac | 4 ++ 2 files changed, 118 insertions(+), 0 deletions(-) diff --git a/gdb/configure b/gdb/configure index 8ae2e09..c4340b7 100755 --- a/gdb/configure +++ b/gdb/configure @@ -6711,6 +6711,120 @@ if test "$ac_res" != no; then : fi +# On GNU/Hurd we may need libmachuser and libhurduser (used by gnu-nat.c). +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing mach_port_destroy" >&5 +$as_echo_n "checking for library containing mach_port_destroy... " >&6; } +if test "${ac_cv_search_mach_port_destroy+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char mach_port_destroy (); +int +main () +{ +return mach_port_destroy (); + ; + return 0; +} +_ACEOF +for ac_lib in '' machuser; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_mach_port_destroy=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if test "${ac_cv_search_mach_port_destroy+set}" = set; then : + break +fi +done +if test "${ac_cv_search_mach_port_destroy+set}" = set; then : + +else + ac_cv_search_mach_port_destroy=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_mach_port_destroy" >&5 +$as_echo "$ac_cv_search_mach_port_destroy" >&6; } +ac_res=$ac_cv_search_mach_port_destroy +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing proc_getmsgport" >&5 +$as_echo_n "checking for library containing proc_getmsgport... " >&6; } +if test "${ac_cv_search_proc_getmsgport+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char proc_getmsgport (); +int +main () +{ +return proc_getmsgport (); + ; + return 0; +} +_ACEOF +for ac_lib in '' hurduser; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_proc_getmsgport=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if test "${ac_cv_search_proc_getmsgport+set}" = set; then : + break +fi +done +if test "${ac_cv_search_proc_getmsgport+set}" = set; then : + +else + ac_cv_search_proc_getmsgport=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_proc_getmsgport" >&5 +$as_echo "$ac_cv_search_proc_getmsgport" >&6; } +ac_res=$ac_cv_search_proc_getmsgport +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + + diff --git a/gdb/configure.ac b/gdb/configure.ac index feb28f3..52aebf5 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -521,6 +521,10 @@ AM_ZLIB # On HP/UX we may need libxpdl for dlgetmodinfo (used by solib-pa64.c). AC_SEARCH_LIBS(dlgetmodinfo, [dl xpdl]) +# On GNU/Hurd we may need libmachuser and libhurduser (used by gnu-nat.c). +AC_SEARCH_LIBS(mach_port_destroy, machuser) +AC_SEARCH_LIBS(proc_getmsgport, hurduser) + AM_ICONV # GDB may fork/exec the iconv program to get the list of supported character -- 1.7.7.6