From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8079 invoked by alias); 20 Jan 2014 18:49:59 -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 7976 invoked by uid 89); 20 Jan 2014 18:49:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.5 required=5.0 tests=AWL,BAYES_05,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS,URIBL_BLACK autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 20 Jan 2014 18:49:56 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s0KIntQa009411 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 20 Jan 2014 13:49:55 -0500 Received: from barimba.redhat.com (ovpn-113-85.phx2.redhat.com [10.3.113.85]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s0KIns51016576; Mon, 20 Jan 2014 13:49:54 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFC 1/2] link gdbserver against libiberty Date: Mon, 20 Jan 2014 18:49:00 -0000 Message-Id: <1390243792-31176-2-git-send-email-tromey@redhat.com> In-Reply-To: <1390243792-31176-1-git-send-email-tromey@redhat.com> References: <1390243792-31176-1-git-send-email-tromey@redhat.com> X-SW-Source: 2014-01/txt/msg00745.txt.bz2 This builds a libiberty just for gdbserver and arranges for gdbserver to use it. I've tripped across the lack of libiberty in gdbserver at least once, and I have seen other threads where it would have been useful. 2014-01-20 Tom Tromey * Makefile.in (LIBIBERTY_BUILDDIR, LIBIBERTY): New variables. (SUBDIRS, REQUIRED_SUBDIRS): Add libiberty. (FLAGS_TO_PASS): Remove AR, AR_FLAGS (gdbserver$(EXEEXT), gdbreplay$(EXEEXT)): Depend on and link against libiberty. ($(LIBGNU)): Depend on libiberty. (all-lib): Recurse into all subdirs. (vasprintf.o, vsnprintf.o, safe-ctype.o, lbasename.o): Remove targets. * configure: Rebuild. * configure.ac: Add ACX_CONFIGURE_DIR for libiberty. Don't check for vasprintf or vsnprintf. * configure.srv: Don't add safe-ctype.o or lbasename.o to srv_tgtobj. --- gdb/gdbserver/ChangeLog | 17 +++++++ gdb/gdbserver/Makefile.in | 40 +++++---------- gdb/gdbserver/configure | 120 ++++++++++++++++++++++++++++++++++++-------- gdb/gdbserver/configure.ac | 3 +- gdb/gdbserver/configure.srv | 6 --- 5 files changed, 129 insertions(+), 57 deletions(-) diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in index e72ee6b..ec3b86c 100644 --- a/gdb/gdbserver/Makefile.in +++ b/gdb/gdbserver/Makefile.in @@ -83,6 +83,9 @@ CC-LD=${CC} INCLUDE_DIR = ${srcdir}/../../include INCLUDE_DEP = $$(INCLUDE_DIR) +LIBIBERTY_BUILDDIR = build-libiberty-gdbserver +LIBIBERTY = $(LIBIBERTY_BUILDDIR)/libiberty.a + # Where is ust? These will be empty if ust was not available. ustlibs = @ustlibs@ ustinc = @ustinc@ @@ -190,14 +193,14 @@ XML_BUILTIN = @srv_xmlbuiltin@ IPA_DEPFILES = @IPA_DEPFILES@ extra_libraries = @extra_libraries@ -SUBDIRS = $(GNULIB_BUILDDIR) +SUBDIRS = $(GNULIB_BUILDDIR) $(LIBIBERTY_BUILDDIR) CLEANDIRS = $(SUBDIRS) # List of subdirectories in the build tree that must exist. # This is used to force build failures in existing trees when # a new directory is added. # The format here is for the `case' shell command. -REQUIRED_SUBDIRS = $(GNULIB_BUILDDIR) +REQUIRED_SUBDIRS = $(GNULIB_BUILDDIR) | $(LIBIBERTY_BUILDDIR) FLAGS_TO_PASS = \ "prefix=$(prefix)" \ @@ -213,8 +216,6 @@ FLAGS_TO_PASS = \ "includedir=$(includedir)" \ "against=$(against)" \ "DESTDIR=$(DESTDIR)" \ - "AR=$(AR)" \ - "AR_FLAGS=$(AR_FLAGS)" \ "CC=$(CC)" \ "CFLAGS=$(CFLAGS)" \ "CXX=$(CXX)" \ @@ -276,20 +277,20 @@ install-html: clean-info: force @$(MAKE) $(FLAGS_TO_PASS) DO=$@ "DODIRS=$(SUBDIRS)" subdir_do -gdbserver$(EXEEXT): $(OBS) ${ADD_DEPS} ${CDEPS} $(LIBGNU) +gdbserver$(EXEEXT): $(OBS) ${ADD_DEPS} ${CDEPS} $(LIBGNU) $(LIBIBERTY) rm -f gdbserver$(EXEEXT) ${CC-LD} $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) -o gdbserver$(EXEEXT) $(OBS) \ - $(LIBGNU) $(GDBSERVER_LIBS) $(XM_CLIBS) + $(LIBGNU) $(LIBIBERTY) $(GDBSERVER_LIBS) $(XM_CLIBS) -$(LIBGNU) $(GNULIB_H): all-lib -all-lib: $(GNULIB_BUILDDIR)/Makefile - @$(MAKE) $(FLAGS_TO_PASS) DO=all DODIRS=$(GNULIB_BUILDDIR) subdir_do +$(LIBGNU) $(LIBIBERTY) $(GNULIB_H): all-lib +all-lib: $(GNULIB_BUILDDIR)/Makefile $(LIBIBERTY_BUILDDIR)/Makefile + @$(MAKE) $(FLAGS_TO_PASS) DO=all DODIRS="$(SUBDIRS)" subdir_do .PHONY: all-lib -gdbreplay$(EXEEXT): $(GDBREPLAY_OBS) $(LIBGNU) +gdbreplay$(EXEEXT): $(GDBREPLAY_OBS) $(LIBGNU) $(LIBIBERTY) rm -f gdbreplay$(EXEEXT) ${CC-LD} $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) -o gdbreplay$(EXEEXT) $(GDBREPLAY_OBS) \ - $(XM_CLIBS) $(LIBGNU) + $(XM_CLIBS) $(LIBGNU) $(LIBIBERTY) IPA_OBJS=ax-ipa.o tracepoint-ipa.o format-ipa.o utils-ipa.o regcache-ipa.o remote-utils-ipa.o common-utils-ipa.o tdesc-ipa.o ${IPA_DEPFILES} @@ -533,23 +534,6 @@ linux-waitpid.o: ../nat/linux-waitpid.c $(COMPILE) $< $(POSTCOMPILE) -# We build vasprintf with -DHAVE_CONFIG_H because we want that unit to -# include our config.h file. Otherwise, some system headers do not get -# included, and the compiler emits a warning about implicitly defined -# functions (missing declaration). -vasprintf.o: $(srcdir)/../../libiberty/vasprintf.c - $(COMPILE) $< -DHAVE_CONFIG_H - $(POSTCOMPILE) -vsnprintf.o: $(srcdir)/../../libiberty/vsnprintf.c - $(COMPILE) $< - $(POSTCOMPILE) -safe-ctype.o: $(srcdir)/../../libiberty/safe-ctype.c - $(COMPILE) $< - $(POSTCOMPILE) -lbasename.o: $(srcdir)/../../libiberty/lbasename.c - $(COMPILE) $< - $(POSTCOMPILE) - aarch64.c : $(srcdir)/../regformats/aarch64.dat $(regdat_sh) $(SHELL) $(regdat_sh) $(srcdir)/../regformats/aarch64.dat aarch64.c reg-arm.c : $(srcdir)/../regformats/reg-arm.dat $(regdat_sh) diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure index fac7fb3..3526b2f 100755 --- a/gdb/gdbserver/configure +++ b/gdb/gdbserver/configure @@ -589,6 +589,7 @@ ac_includes_default="\ #endif" ac_subst_vars='LTLIBOBJS +LIBOBJS GNULIB_STDINT_H extra_libraries IPA_DEPFILES @@ -604,7 +605,6 @@ WERROR_CFLAGS WARN_CFLAGS ustinc ustlibs -LIBOBJS SET_MAKE GMAKE_FALSE GMAKE_TRUE @@ -4714,6 +4714,103 @@ $as_echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cach cd "$ac_popdir" + + in_src="../../libiberty" + in_build="build-libiberty-gdbserver" + + # Remove --cache-file, --srcdir, and --disable-option-checking arguments + # so they do not pile up. + ac_sub_configure_args= + ac_prev= + eval "set x $ac_configure_args" + shift + for ac_arg + do + if test -n "$ac_prev"; then + ac_prev= + continue + fi + case $ac_arg in + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \ + | --c=*) + ;; + --config-cache | -C) + ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + ;; + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + ;; + --disable-option-checking) + ;; + *) + case $ac_arg in + *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append ac_sub_configure_args " '$ac_arg'" ;; + esac + done + + # Always prepend --prefix to ensure using the same prefix + # in subdir configurations. + ac_arg="--prefix=$prefix" + case $ac_arg in + *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + ac_sub_configure_args="'$ac_arg' $ac_sub_configure_args" + + # Pass --silent + if test "$silent" = yes; then + ac_sub_configure_args="--silent $ac_sub_configure_args" + fi + + # Always prepend --disable-option-checking to silence warnings, since + # different subdirs can have different --enable and --with options. + ac_sub_configure_args="--disable-option-checking $ac_sub_configure_args" + + ac_popdir=`pwd` + ac_dir=$in_build + + ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)" + $as_echo "$as_me:${as_lineno-$LINENO}: $ac_msg" >&5 + $as_echo "$ac_msg" >&6 + as_dir="$ac_dir"; as_fn_mkdir_p + + case $srcdir in + [\\/]* | ?:[\\/]* ) + ac_srcdir=$srcdir/$in_src ;; + *) # Relative name. + ac_srcdir=../$srcdir/$in_src ;; + esac + + cd "$ac_dir" + + ac_sub_configure=$ac_srcdir/configure + + # Make the cache file name correct relative to the subdirectory. + case $cache_file in + [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;; + *) # Relative name. + ac_sub_cache_file=$ac_top_build_prefix$cache_file ;; + esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 +$as_echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;} + # The eval makes quoting arguments work. + eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \ + --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" || + as_fn_error "$ac_sub_configure failed for $ac_dir" "$LINENO" 5 + + cd "$ac_popdir" + + for ac_header in sgtty.h termio.h termios.h sys/reg.h string.h proc_service.h sys/procfs.h linux/elf.h errno.h fcntl.h signal.h sys/file.h malloc.h sys/ioctl.h netinet/in.h sys/socket.h netdb.h netinet/tcp.h arpa/inet.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` @@ -4741,27 +4838,6 @@ _ACEOF fi done -for ac_func in vasprintf vsnprintf -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -eval as_val=\$$as_ac_var - if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -else - case " $LIBOBJS " in - *" $ac_func.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" - ;; -esac - -fi -done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac index dc8131c..4a845d8 100644 --- a/gdb/gdbserver/configure.ac +++ b/gdb/gdbserver/configure.ac @@ -77,13 +77,14 @@ AC_PROG_MAKE_SET # build it in the same directory, when building in the source dir. ACX_CONFIGURE_DIR(["../gnulib"], ["build-gnulib-gdbserver"]) +ACX_CONFIGURE_DIR(["../../libiberty"], ["build-libiberty-gdbserver"]) + AC_CHECK_HEADERS(sgtty.h termio.h termios.h sys/reg.h string.h dnl proc_service.h sys/procfs.h linux/elf.h dnl errno.h fcntl.h signal.h sys/file.h malloc.h dnl sys/ioctl.h netinet/in.h sys/socket.h netdb.h dnl netinet/tcp.h arpa/inet.h) AC_CHECK_FUNCS(pread pwrite pread64 readlink) -AC_REPLACE_FUNCS(vasprintf vsnprintf) GDB_AC_COMMON diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv index f4e6154..32d935a 100644 --- a/gdb/gdbserver/configure.srv +++ b/gdb/gdbserver/configure.srv @@ -77,7 +77,6 @@ case "${target}" in ;; arm*-*-mingw32ce*) srv_regobj=reg-arm.o srv_tgtobj="win32-low.o win32-arm-low.o" - srv_tgtobj="${srv_tgtobj} safe-ctype.o lbasename.o" srv_tgtobj="${srv_tgtobj} wincecompat.o" # hostio_last_error implementation is in win32-low.c srv_hostio_err_objs="" @@ -101,7 +100,6 @@ case "${target}" in ;; i[34567]86-*-cygwin*) srv_regobj="$srv_i386_regobj" srv_tgtobj="i386-low.o win32-low.o win32-i386-low.o" - srv_tgtobj="${srv_tgtobj} safe-ctype.o lbasename.o" srv_xmlfiles="$srv_i386_xmlfiles" ;; i[34567]86-*-linux*) srv_regobj="$srv_i386_linux_regobj" @@ -128,7 +126,6 @@ case "${target}" in i[34567]86-*-mingw32ce*) srv_regobj="$srv_i386_regobj" srv_tgtobj="i386-low.o win32-low.o win32-i386-low.o" - srv_tgtobj="${srv_tgtobj} safe-ctype.o lbasename.o" srv_tgtobj="${srv_tgtobj} wincecompat.o" srv_xmlfiles="$srv_i386_xmlfiles" # hostio_last_error implementation is in win32-low.c @@ -138,7 +135,6 @@ case "${target}" in ;; i[34567]86-*-mingw*) srv_regobj="$srv_i386_regobj" srv_tgtobj="i386-low.o win32-low.o win32-i386-low.o" - srv_tgtobj="${srv_tgtobj} safe-ctype.o lbasename.o" srv_xmlfiles="$srv_i386_xmlfiles" srv_mingw=yes ;; @@ -330,13 +326,11 @@ case "${target}" in ;; x86_64-*-mingw*) srv_regobj="$srv_amd64_regobj" srv_tgtobj="i386-low.o i387-fp.o win32-low.o win32-i386-low.o" - srv_tgtobj="${srv_tgtobj} safe-ctype.o lbasename.o" srv_xmlfiles="$srv_i386_xmlfiles $srv_amd64_xmlfiles" srv_mingw=yes ;; x86_64-*-cygwin*) srv_regobj="$srv_amd64_regobj" srv_tgtobj="i386-low.o i387-fp.o win32-low.o win32-i386-low.o" - srv_tgtobj="${srv_tgtobj} safe-ctype.o lbasename.o" srv_xmlfiles="$srv_i386_xmlfiles" ;; -- 1.8.1.4