This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

[plugin] Mudflap plugin


Hi,
 I ve been working on converting the mudflap bounds checking code in
gcc into a plugin. The attached patch enables me to get a plugin which
is
 functionally equivalent to the gcc mudflap (-fmudflap). By
functionally equivalence, testing the plugin with the existing
libmudflap testuite
 with the following changes to the relevant .exp files shows no regression.

--- cfrags.exp  2009-06-03 18:08:48.000000000 -0700
+++ cfrags_plugin.exp   2009-06-16 15:04:06.000000000 -0700
@@ -14,7 +14,7 @@
                             ${srcdir}/libmudflap.c/pass*.c]] {
        set bsrc [file tail $srcfile]
        setenv MUDFLAP_OPTIONS "-viol-segv"
-       dg-runtest $srcfile $flags "-fmudflap -lmudflap"
+       dg-runtest $srcfile $flags "-fplugin=/tmp/libmudflap_plugin.so
-fno-builtin -fno-merge-constants -include mf-runtime.h -D_MUDFLAP
-lmudflap"
     }
 }


Summary of the changes in this patch:
1)  Expose global variables (varpool) and constants (const_desc_htab)
to the plugin for instrumentation.
2)  Pass linkers options for generating function wrappers (--wrap=)
and -export-dynamic.
3) Enable pragma redefines
4) Disable use of builtin_alloca

The plugin code itself is based on the existing tree-mudflap.c   Up to
this point, I have focused solely on getting the functionality right
with little regards to cleanliness and robustness in design. So I
would appreciate comments and reviews on the work so far.
 Thanks

tunji

Attachment: mudflap_plugin.txt
Description: Text document


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