This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Simplify the IPA parts of the gdbserver Makefile


Instead of adding the Gnulib CFLAGS and partially undoing them, just
don't add them.

Requires a minor change to common-defs.h, and depends on
https://sourceware.org/ml/gdb-patches/2019-11/msg00908.html

gdb/ChangeLog:

2019-11-26  Christian Biesinger  <cbiesinger@google.com>

	* gdbsupport/common-defs.h: Don't use Gnulib when building IPA.

gdb/gdbserver/ChangeLog:

2019-11-26  Christian Biesinger  <cbiesinger@google.com>

	* Makefile.in: Don't use Gnulib headers when building IPA.

Change-Id: I93266a721def7e5cd40b5a2f2ed959c70446a2d8
---
 gdb/gdbserver/Makefile.in    | 16 +++++-----------
 gdb/gdbsupport/common-defs.h |  5 ++++-
 2 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index 16012dddcb..aba0eea78f 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -119,8 +119,7 @@ GNULIB_H = $(GNULIB_BUILDDIR)/import/string.h @GNULIB_STDINT_H@
 # e.g.: "target/wait.h".
 #
 INCLUDE_CFLAGS = -I. -I${srcdir} \
-	-I$(srcdir)/../regformats -I$(srcdir)/.. -I$(INCLUDE_DIR) \
-	$(INCGNU)
+	-I$(srcdir)/../regformats -I$(srcdir)/.. -I$(INCLUDE_DIR)
 
 # M{H,T}_CFLAGS, if defined, has host- and target-dependent CFLAGS
 # from the config/ directory.
@@ -143,7 +142,8 @@ CPPFLAGS = @CPPFLAGS@
 INTERNAL_CFLAGS_BASE = ${CXXFLAGS} ${GLOBAL_CFLAGS} \
 	${PROFILE_CFLAGS} ${INCLUDE_CFLAGS} ${CPPFLAGS}
 INTERNAL_WARN_CFLAGS = ${INTERNAL_CFLAGS_BASE} $(WARN_CFLAGS)
-INTERNAL_CFLAGS = ${INTERNAL_WARN_CFLAGS} $(WERROR_CFLAGS) -DGDBSERVER
+NON_GNU_CFLAGS = ${INTERNAL_WARN_CFLAGS} $(WERROR_CFLAGS) -DGDBSERVER
+INTERNAL_CFLAGS = ${NON_GNU_CFLAGS} $(INCGNU)
 
 # LDFLAGS is specifically reserved for setting from the command line
 # when running make.
@@ -440,7 +440,7 @@ IPA_LIB = libinproctrace.so
 $(IPA_LIB): $(sort $(IPA_OBJS)) ${CDEPS}
 	$(SILENCE) rm -f $(IPA_LIB)
 	$(ECHO_CXXLD) $(CC_LD) -shared -fPIC -Wl,--soname=$(IPA_LIB) \
-		-Wl,--no-undefined $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) \
+		-Wl,--no-undefined $(NON_GNU_CFLAGS) $(INTERNAL_LDFLAGS) \
 		-o $(IPA_LIB) ${IPA_OBJS} -ldl -pthread
 
 # Put the proper machine-specific files first, so M-. on a machine
@@ -551,15 +551,9 @@ regdat_sh = $(srcdir)/../regformats/regdat.sh
 
 UST_CFLAGS = $(ustinc) -DCONFIG_UST_GDB_INTEGRATION
 
-# Undo gnulib replacements for the IPA shared library build.
-# The gnulib headers are still needed, but gnulib is not linked
-# into the IPA lib so replacement apis don't work.
-UNDO_GNULIB_CFLAGS = -Drpl_strerror=strerror
-
 # Note, we only build the IPA if -fvisibility=hidden is supported in
 # the first place.
-IPAGENT_CFLAGS = $(INTERNAL_CFLAGS) $(UST_CFLAGS) \
-	$(UNDO_GNULIB_CFLAGS) \
+IPAGENT_CFLAGS = $(NON_GNU_CFLAGS) $(UST_CFLAGS) \
 	-fPIC -DIN_PROCESS_AGENT \
 	-fvisibility=hidden
 
diff --git a/gdb/gdbsupport/common-defs.h b/gdb/gdbsupport/common-defs.h
index 4fa84ff8e5..d28e996abe 100644
--- a/gdb/gdbsupport/common-defs.h
+++ b/gdb/gdbsupport/common-defs.h
@@ -108,9 +108,12 @@
    MinGW, gnulib might enable __USE_MINGW_ANSI_STDIO, which may or not
    require use of attribute gnu_printf instead of printf.  gnulib
    checks that at configure time.  Since _GL_ATTRIBUTE_FORMAT_PRINTF
-   is compatible with ATTRIBUTE_PRINTF, simply use it.  */
+   is compatible with ATTRIBUTE_PRINTF, simply use it.
+   Since IPA does not use Gnulib, we don't do it there.  */
+#ifndef IN_PROCESS_AGENT
 #undef ATTRIBUTE_PRINTF
 #define ATTRIBUTE_PRINTF _GL_ATTRIBUTE_FORMAT_PRINTF
+#endif
 
 #if GCC_VERSION >= 3004
 #define ATTRIBUTE_UNUSED_RESULT __attribute__ ((__warn_unused_result__))
-- 
2.24.0.432.g9d3f5f5b63-goog


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]