[PATCH, V6 10/10] gdb: sim: buildsystem changes to accommodate libctfframe

Indu Bhagat indu.bhagat@oracle.com
Tue Aug 2 08:04:52 GMT 2022


[No changes from V5, V4, V3, V2, V1]

Both gdb and sim need buildsystem fixes to now include libctfframe for a
successful build.

gdb/ChangeLog:
	* acinclude.m4: Fix GDB_AC_CHECK_BFD to include libctfframe.
	* Makefile.in: Bring in libctfframe for linking.
	* configure.ac: Check for static or shared.
	* configure: Regenerated.

sim/common/ChangeLog:
	* sim/common/Make-common.in: Bring in libctfframe.a for linking.
---
 gdb/Makefile.in           |  8 ++++++--
 gdb/acinclude.m4          |  4 ++--
 gdb/configure             | 35 +++++++++++++++++++++++++++++++----
 gdb/configure.ac          | 11 +++++++++++
 sim/common/Make-common.in |  7 +++++--
 5 files changed, 55 insertions(+), 10 deletions(-)

diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 2598b81d205..26ed82749eb 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -161,6 +161,10 @@ LIBIBERTY = ../libiberty/libiberty.a
 LIBCTF = @LIBCTF@
 CTF_DEPS = @CTF_DEPS@
 
+# Where is the CTF frame library?  Typically in ../libctfframe.
+LIBCTFFRAME = @LIBCTFFRAME@
+CTFFRAME_DEPS = @CTFFRAME_DEPS@
+
 # Where is the BFD library?  Typically in ../bfd.
 BFD_DIR = ../bfd
 BFD = $(BFD_DIR)/libbfd.a
@@ -647,7 +651,7 @@ INTERNAL_LDFLAGS = \
 # Libraries and corresponding dependencies for compiling gdb.
 # XM_CLIBS, defined in *config files, have host-dependent libs.
 # LIBIBERTY appears twice on purpose.
-CLIBS = $(SIM) $(READLINE) $(OPCODES) $(LIBCTF) $(BFD) $(ZLIB) \
+CLIBS = $(SIM) $(READLINE) $(OPCODES) $(LIBCTF) $(BFD) $(LIBCTFFRAME) $(ZLIB) \
         $(LIBSUPPORT) $(INTL) $(LIBIBERTY) $(LIBDECNUMBER) \
 	$(XM_CLIBS) $(GDBTKLIBS)  $(LIBBACKTRACE_LIB) \
 	@LIBS@ @GUILE_LIBS@ @PYTHON_LIBS@ \
@@ -655,7 +659,7 @@ CLIBS = $(SIM) $(READLINE) $(OPCODES) $(LIBCTF) $(BFD) $(ZLIB) \
 	$(WIN32LIBS) $(LIBGNU) $(LIBGNU_EXTRA_LIBS) $(LIBICONV) \
 	$(LIBMPFR) $(LIBGMP) $(SRCHIGH_LIBS) $(LIBXXHASH) $(PTHREAD_LIBS) \
 	$(DEBUGINFOD_LIBS) $(LIBBABELTRACE_LIB)
-CDEPS = $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE_DEPS) $(CTF_DEPS) \
+CDEPS = $(NAT_CDEPS) $(SIM) $(CTFFRAME_DEPS) $(BFD) $(READLINE_DEPS) $(CTF_DEPS) \
 	$(OPCODES) $(INTL_DEPS) $(LIBIBERTY) $(CONFIG_DEPS) $(LIBGNU) \
 	$(LIBSUPPORT)
 
diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4
index 95ff2b6f35e..f3a4ebba1be 100644
--- a/gdb/acinclude.m4
+++ b/gdb/acinclude.m4
@@ -233,9 +233,9 @@ AC_DEFUN([GDB_AC_CHECK_BFD], [
   # always want our bfd.
   CFLAGS="-I${srcdir}/../include -I../bfd -I${srcdir}/../bfd $CFLAGS"
   ZLIBDIR=`echo $zlibdir | sed 's,\$(top_builddir)/,,g'`
-  LDFLAGS="-L../bfd -L../libiberty $ZLIBDIR $LDFLAGS"
+  LDFLAGS="-L../bfd -L../libiberty -L../libctfframe/.libs/ $ZLIBDIR $LDFLAGS"
   intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'`
-  LIBS="-lbfd -liberty -lz $intl $LIBS"
+  LIBS="-lbfd -liberty -lz -lctfframe $intl $LIBS"
   AC_CACHE_CHECK(
     [$1],
     [$2],
diff --git a/gdb/configure b/gdb/configure
index 4b5e031bff9..773197fe6d6 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -631,6 +631,8 @@ GDB_NM_FILE
 LTLIBXXHASH
 LIBXXHASH
 HAVE_LIBXXHASH
+CTFFRAME_DEPS
+LIBCTFFRAME
 CTF_DEPS
 LIBCTF
 LTLIBBABELTRACE
@@ -936,6 +938,7 @@ with_libbabeltrace_prefix
 with_libbabeltrace_type
 with_xxhash
 enable_libctf
+enable_libctfframe
 with_libxxhash_prefix
 with_libxxhash_type
 enable_unit_tests
@@ -1612,6 +1615,7 @@ Optional Features:
   --enable-libbacktrace   use libbacktrace to write a backtrace after a fatal
                           signal.
   --enable-libctf         Handle .ctf type-info sections [default=yes]
+  --enable-libctfframe    Handle .ctf_frame sections [default=yes]
   --enable-unit-tests     Enable the inclusion of unit tests when compiling
                           GDB
 
@@ -17265,9 +17269,9 @@ WIN32LIBS="$WIN32LIBS $WIN32APILIBS"
   # always want our bfd.
   CFLAGS="-I${srcdir}/../include -I../bfd -I${srcdir}/../bfd $CFLAGS"
   ZLIBDIR=`echo $zlibdir | sed 's,\$(top_builddir)/,,g'`
-  LDFLAGS="-L../bfd -L../libiberty $ZLIBDIR $LDFLAGS"
+  LDFLAGS="-L../bfd -L../libiberty -L../libctfframe/.libs/ $ZLIBDIR $LDFLAGS"
   intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'`
-  LIBS="-lbfd -liberty -lz $intl $LIBS"
+  LIBS="-lbfd -liberty -lz -lctfframe $intl $LIBS"
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ELF support in BFD" >&5
 $as_echo_n "checking for ELF support in BFD... " >&6; }
 if ${gdb_cv_var_elf+:} false; then :
@@ -17380,9 +17384,9 @@ fi
   # always want our bfd.
   CFLAGS="-I${srcdir}/../include -I../bfd -I${srcdir}/../bfd $CFLAGS"
   ZLIBDIR=`echo $zlibdir | sed 's,\$(top_builddir)/,,g'`
-  LDFLAGS="-L../bfd -L../libiberty $ZLIBDIR $LDFLAGS"
+  LDFLAGS="-L../bfd -L../libiberty -L../libctfframe/.libs/ $ZLIBDIR $LDFLAGS"
   intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'`
-  LIBS="-lbfd -liberty -lz $intl $LIBS"
+  LIBS="-lbfd -liberty -lz -lctfframe $intl $LIBS"
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Mach-O support in BFD" >&5
 $as_echo_n "checking for Mach-O support in BFD... " >&6; }
 if ${gdb_cv_var_macho+:} false; then :
@@ -19347,6 +19351,29 @@ fi
 
 
 
+ # Check whether --enable-libctfframe was given.
+if test "${enable_libctfframe+set}" = set; then :
+  enableval=$enable_libctfframe;
+      case "$enableval" in
+       yes|no) ;;
+       *) as_fn_error $? "Argument to enable/disable libctfframe must be yes or no" "$LINENO" 5 ;;
+      esac
+
+else
+  enable_libctfframe=yes
+fi
+
+
+if test x${enable_static} = xno; then
+  LIBCTFFRAME="-Wl,--rpath,../libctfframe/.libs ../libctfframe/.libs/libctfframe.so"
+  CTFFRAME_DEPS="../libctfframe/.libs/libctfframe.so"
+else
+  LIBCTFFRAME="../libctfframe/.libs/libctfframe.a"
+  CTFFRAME_DEPS="$LIBCTFFRAME"
+fi
+
+
+
 # If nativefile (NAT_FILE) is not set in configure.nat, we link to an
 # empty version.
 
diff --git a/gdb/configure.ac b/gdb/configure.ac
index b681988d7a4..40f3dbb658b 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -2191,6 +2191,17 @@ fi
 AC_SUBST(LIBCTF)
 AC_SUBST(CTF_DEPS)
 
+GCC_ENABLE([libctfframe], [yes], [], [Handle .ctf_frame sections])
+if test x${enable_static} = xno; then
+  LIBCTFFRAME="-Wl,--rpath,../libctfframe/.libs ../libctfframe/.libs/libctfframe.so"
+  CTFFRAME_DEPS="../libctfframe/.libs/libctfframe.so"
+else
+  LIBCTFFRAME="../libctfframe/.libs/libctfframe.a"
+  CTFFRAME_DEPS="$LIBCTFFRAME"
+fi
+AC_SUBST(LIBCTFFRAME)
+AC_SUBST(CTFFRAME_DEPS)
+
 # If nativefile (NAT_FILE) is not set in configure.nat, we link to an
 # empty version.
 
diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index 74e5dad3049..ac974087798 100644
--- a/sim/common/Make-common.in
+++ b/sim/common/Make-common.in
@@ -222,11 +222,14 @@ SIM_HW_DEVICES = cfi core pal glue $(SIM_EXTRA_HW_DEVICES)
 ZLIB = $(zlibdir) -lz
 LIBIBERTY_LIB = ../../libiberty/libiberty.a
 BFD_LIB = ../../bfd/libbfd.a
+LIBCTFFRAME_LIB = ../../libctfframe/.libs/libctfframe.a
 OPCODES_LIB = ../../opcodes/libopcodes.a
 CONFIG_LIBS = $(COMMON_LIBS) @LIBS@ $(ZLIB)
-LIBDEPS = $(BFD_LIB) $(OPCODES_LIB) $(LIBINTL_DEP) $(LIBIBERTY_LIB)
+LIBDEPS = $(BFD_LIB) $(OPCODES_LIB) $(LIBINTL_DEP) $(LIBIBERTY_LIB) \
+	  $(LIBCTFFRAME_LIB)
 EXTRA_LIBS = $(BFD_LIB) $(OPCODES_LIB) $(LIBINTL) $(LIBIBERTY_LIB) \
-	$(CONFIG_LIBS) $(SIM_EXTRA_LIBS) $(LIBDL) $(LIBGNU) $(LIBGNU_EXTRA_LIBS)
+	     $(LIBCTFFRAME_LIB) $(CONFIG_LIBS) $(SIM_EXTRA_LIBS) \
+	     $(LIBDL) $(LIBGNU) $(LIBGNU_EXTRA_LIBS)
 
 COMMON_OBJS_NAMES = \
 	callback.o \
-- 
2.37.1



More information about the Binutils mailing list