[tree-ssa libmudflap] dlopen tweaks

Frank Ch. Eigler fche@redhat.com
Mon Mar 31 21:13:00 GMT 2003


Hi -

To improve compatiblity with some dl* applications like
the one posted to the general gcc@ mailing list by
<eyal@eyal.emu.id.au>, the following patch removes
(the useless) interception of dlopen().

- FChE


2003-03-31  Frank Ch. Eigler  <fche@redhat.com>

	* gcc.c (MFLIB_SPEC): Remove -ld.
	(MFWRAP_SPEC): Remove dlopen wrapping.

2003-03-31  Frank Ch. Eigler  <fche@redhat.com>

	* Makefile.am (AM_CFLAGS): Remove optimization flags.
	(HOOKOBJS): Remove dlopen hook.
	(libmudflap_la_LIBADD): Add -ldl.
	* mf-hooks.c (dlopen): Remove hook.
	* mf-impl.h (__mf_dynamic): Ditto.
	* mf-runtime.c (__mf_resolve_dynamics): Ditto.
	* Makefile.in: Regenerated.


Index: gcc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcc.c,v
retrieving revision 1.324.2.25
diff -u -r1.324.2.25 gcc.c
--- gcc.c	5 Mar 2003 19:08:03 -0000	1.324.2.25
+++ gcc.c	31 Mar 2003 21:02:35 -0000
@@ -615,11 +615,11 @@
 /* XXX: should exactly match hooks provided by libmudflap.a */
 #define MFWRAP_SPEC " %{fmudflap: %{static:\
  --wrap=malloc --wrap=free --wrap=calloc --wrap=realloc\
- --wrap=dlopen --wrap=mmap --wrap=munmap --wrap=alloca\
+ --wrap=mmap --wrap=munmap --wrap=alloca\
 }}"
 #endif
 #ifndef MFLIB_SPEC
-#define MFLIB_SPEC " %{fmudflap: -export-dynamic -lmudflap %{!static:-ldl} %{static:%(link_gcc_c_sequence) -lmudflap}}"
+#define MFLIB_SPEC " %{fmudflap: -export-dynamic -lmudflap %{static:%(link_gcc_c_sequence) -lmudflap}}"
 #endif
 
 /* config.h can define LIBGCC_SPEC to override how and when libgcc.a is



Index: Makefile.am
===================================================================
RCS file: /cvs/gcc/gcc/libmudflap/Attic/Makefile.am,v
retrieving revision 1.1.2.24
diff -u -w -s -r1.1.2.24 Makefile.am
--- Makefile.am	11 Mar 2003 22:48:29 -0000	1.1.2.24
+++ Makefile.am	31 Mar 2003 20:57:53 -0000
@@ -8,7 +8,7 @@
 MAINT_CHARSET = latin1
 SUBDIRS = testsuite
 
-AM_CFLAGS = -ansi -Wall -O3 -g -freorder-blocks
+AM_CFLAGS = -ansi -Wall
 
 lib_LTLIBRARIES = libmudflap.la
 include_HEADERS = mf-runtime.h
@@ -49,7 +49,6 @@
  bcmp-hook.lo \
  index-hook.lo \
  rindex-hook.lo \
- dlopen-hook.lo \
  mmap-hook.lo \
  munmap-hook.lo \
  alloca-hook.lo
@@ -60,7 +59,7 @@
 	$(LTCOMPILE) -DWRAP_$$hook -c $(srcdir)/mf-hooks.c -o $@
 
 libmudflap_la_LDFLAGS = 
-libmudflap_la_LIBADD = $(HOOKOBJS)
+libmudflap_la_LIBADD = $(HOOKOBJS) -ldl
 libmudflap_la_DEPENDENCIES = $(libmudflap_la_LIBADD)
 
 
Index: mf-hooks.c
===================================================================
RCS file: /cvs/gcc/gcc/libmudflap/Attic/mf-hooks.c,v
retrieving revision 1.1.2.26
diff -u -w -s -r1.1.2.26 mf-hooks.c
--- mf-hooks.c	10 Mar 2003 22:29:58 -0000	1.1.2.26
+++ mf-hooks.c	31 Mar 2003 20:57:53 -0000
@@ -238,19 +238,6 @@
 #endif
 
 
-#ifdef WRAP_dlopen
-#undef dlopen
-WRAPPER(void *, dlopen, const char *filename, int flag)
-{
-  DECLARE(void * , dlopen, const char *filename, int flag);
-  BEGIN_PROTECT(void *, dlopen, filename, flag);
-  result = CALL_REAL(dlopen, filename, flag);
-  __mf_state = old_state;
-  return result;
-}
-#endif
-
-
 #ifdef WRAP_mmap
 #undef mmap
 WRAPPER(void *, mmap, 
Index: mf-impl.h
===================================================================
RCS file: /cvs/gcc/gcc/libmudflap/Attic/mf-impl.h,v
retrieving revision 1.1.2.15
diff -u -w -s -r1.1.2.15 mf-impl.h
--- mf-impl.h	28 Mar 2003 22:33:26 -0000	1.1.2.15
+++ mf-impl.h	31 Mar 2003 20:57:53 -0000
@@ -168,7 +168,6 @@
 struct __mf_dynamic 
 {
   void * dyn_calloc;
-  void * dyn_dlopen;
   void * dyn_free;
   void * dyn_malloc;
   void * dyn_mmap;
Index: mf-runtime.c
===================================================================
RCS file: /cvs/gcc/gcc/libmudflap/Attic/mf-runtime.c,v
retrieving revision 1.1.2.29
diff -u -w -s -r1.1.2.29 mf-runtime.c
--- mf-runtime.c	28 Mar 2003 22:33:26 -0000	1.1.2.29
+++ mf-runtime.c	31 Mar 2003 20:57:53 -0000
@@ -423,7 +423,6 @@
 #define RESOLVE(fname) \
 resolve_single_dynamic (&__mf_dynamic.dyn_ ## fname, #fname)
   RESOLVE(calloc);
-  RESOLVE(dlopen);
   RESOLVE(free);
   RESOLVE(malloc);
   RESOLVE(mmap);



More information about the Gcc-patches mailing list