[tree-ssa libmudflap] build portability changes
Frank Ch. Eigler
fche@redhat.com
Tue Apr 15 19:53:00 GMT 2003
Hi -
The following patch aims to make the libmudflap build more
sensitive to the target presence of -ldl and uintptr_t.
- FChE
2003-04-15 Frank Ch. Eigler <fche@redhat.com>
* Makefile.am (libmudflap_la_LIBADD): Remove -ldl.
* configure.in: Look for uintptr_t and -ldl on target.
* mf-runtime.h.in: Adjust uintptr_t declaration logic.
* Makefile.in, aclocal.m4, configure, config.h.in: Regenerated.
* testsuite/Makefile.in: Regenerated.
* mf-runtime.c (__mf_sigusr1_respond): Tweak declaration and calls
for better C compliance.
Index: Makefile.am
===================================================================
RCS file: /cvs/gcc/gcc/libmudflap/Attic/Makefile.am,v
retrieving revision 1.1.2.25
diff -u -w -s -p -r1.1.2.25 Makefile.am
--- Makefile.am 31 Mar 2003 21:09:43 -0000 1.1.2.25
+++ Makefile.am 15 Apr 2003 19:52:38 -0000
@@ -59,7 +59,7 @@ $(HOOKOBJS): mf-hooks.c mf-runtime.h mf-
$(LTCOMPILE) -DWRAP_$$hook -c $(srcdir)/mf-hooks.c -o $@
libmudflap_la_LDFLAGS =
-libmudflap_la_LIBADD = $(HOOKOBJS) -ldl
+libmudflap_la_LIBADD = $(HOOKOBJS)
libmudflap_la_DEPENDENCIES = $(libmudflap_la_LIBADD)
Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/libmudflap/Attic/configure.in,v
retrieving revision 1.1.2.12
diff -u -w -s -p -r1.1.2.12 configure.in
--- configure.in 28 Mar 2003 22:33:26 -0000 1.1.2.12
+++ configure.in 15 Apr 2003 19:52:39 -0000
@@ -27,8 +27,18 @@ AC_SUBST(enable_static)
AC_CHECK_HEADER(stdint.h, [MF_HAVE_STDINT_H=1], [MF_HAVE_STDINT_H=0])
AC_SUBST(MF_HAVE_STDINT_H)
+if test $MF_HAVE_STDINT_H = 1
+then
+ MF_HAVE_UINTPTR_T=1
+else
+ AC_TRY_COMPILE([#include <sys/types.h>], [uintptr_t k = 0;],
+ [MF_HAVE_UINTPTR_T=1], [MF_HAVE_UINTPTR_T=0])
+fi
+AC_SUBST(MF_HAVE_UINTPTR_T)
+
AC_CHECK_HEADERS(stdint.h execinfo.h signal.h)
AC_CHECK_FUNCS(backtrace backtrace_symbols gettimeofday signal)
+AC_CHECK_LIB(dl, dlsym)
if ${CONFIG_SHELL-/bin/sh} ./libtool --tag CC --features |
grep "enable shared" > /dev/null; then
Index: mf-runtime.c
===================================================================
RCS file: /cvs/gcc/gcc/libmudflap/Attic/mf-runtime.c,v
retrieving revision 1.1.2.32
diff -u -w -s -p -r1.1.2.32 mf-runtime.c
--- mf-runtime.c 15 Apr 2003 16:52:47 -0000 1.1.2.32
+++ mf-runtime.c 15 Apr 2003 19:52:39 -0000
@@ -93,6 +93,11 @@ enum __mf_state __mf_state = inactive;
struct __mf_dynamic __mf_dynamic;
#endif
+
+static void __mf_sigusr1_respond ();
+
+
+
/* ------------------------------------------------------------------------ */
/* Configuration engine */
@@ -500,7 +505,6 @@ static void __mf_adapt_cache ();
static void __mf_unlink_object (__mf_object_tree_t *obj);
static void __mf_describe_object (__mf_object_t *obj);
static unsigned __mf_watch_or_not (void *ptr, size_t sz, char flag);
-static void __mf_sigusr1_respond ();
/* ------------------------------------------------------------------------ */
@@ -581,10 +585,11 @@ void __mf_check (void *ptr, size_t sz, i
uintptr_t ptr_high = CLAMPSZ (ptr, sz);
struct __mf_cache old_entry = *entry;
+ BEGIN_RECURSION_PROTECT;
+
if (UNLIKELY (__mf_opts.sigusr1_report))
__mf_sigusr1_respond ();
- BEGIN_RECURSION_PROTECT;
TRACE ("mf: check ptr=%08lx b=%u size=%lu %s location=`%s'\n",
ptr, entry_idx, sz, (type == 0 ? "read" : "write"), location);
@@ -1071,10 +1076,11 @@ __mf_unregister (void *ptr, size_t sz)
{
DECLARE (void, free, void *ptr);
+ BEGIN_RECURSION_PROTECT;
+
if (UNLIKELY (__mf_opts.sigusr1_report))
__mf_sigusr1_respond ();
- BEGIN_RECURSION_PROTECT;
TRACE ("mf: unregister ptr=%08lx size=%lu\n", ptr, sz);
switch (__mf_opts.mudflap_mode)
Index: mf-runtime.h.in
===================================================================
RCS file: /cvs/gcc/gcc/libmudflap/Attic/mf-runtime.h.in,v
retrieving revision 1.1.2.10
diff -u -w -s -p -r1.1.2.10 mf-runtime.h.in
--- mf-runtime.h.in 11 Mar 2003 22:48:29 -0000 1.1.2.10
+++ mf-runtime.h.in 15 Apr 2003 19:52:39 -0000
@@ -6,15 +6,14 @@
#if @MF_HAVE_STDINT_H@ /* autoconf HAVE_STDINT_H */
#include <stdint.h>
-#else
-# if !defined (HAVE_UINTPTR_T)
-typedef unsigned long uintptr_t;
-# endif
#endif
+#include <sys/types.h>
+#if ! @MF_HAVE_UINTPTR_T@
+typedef unsigned long uintptr_t;
+#define HAVE_UINTPTR_T 1
/* Define this here, in case an autoconf application was run
without CFLAGS=-fmudflap but is being compiled with -fmudflap. */
-#define HAVE_UINTPTR_T 1
-#include <sys/types.h>
+#endif
/* Global declarations used by instrumentation. */
More information about the Gcc-patches
mailing list