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]

Re: [plugin] Mudflap plugin


>> 3) Enable pragma redefines
>
> What is this needed for?

This is needed for redirecting standard library functions to mudflap
using pragmas. It is controlled
 by TARGET_HANDLE_PRAGMA_REDEFINE_EXTNAME and currently enabled only
for solaris 2.
This patch enables it for all targets. See
http://gcc.gnu.org/ml/gcc-patches/2001-11/msg00685.html

>
>> + ?if (flag_mudflap || flag_plugin)
>> ? ? return NULL_RTX;
>
> I'm not sure it works, but maybe mudflap can go over GIMPLE_CALLs and make
> them not inlinable (gimple_call_set_cannot_inline). ?Then you can check the
> flag bit here.

Great, I 'll explore this.
>
>> +#define MFWRAP_SPEC " %{static: %{fmudflap|fmudflapth|fplugin=*: \
>
> You can keep the full functionality of the -fmudflap and -fmudflapth
> options. ?You can have your own spec file like libgomp does. ?The idea is
> that in LINK_COMMAND_SPEC you can replace $(mfwrap) with
>
> ?%{fmudflap|fmudflapth: %:include(libmudflap.spec)%(mfwrap)}
>
> and in libmudflap.spec you can have something like this:
>
> mfwrap: %{static: ?--wrap=malloc --wrap=free --wrap=calloc
> ?--wrap=realloc --wrap=mmap --wrap=munmap --wrap=alloca}
> ?%{fmudflapth: --wrap=pthread_create}}
> ?%{fmudflap|fmudflapth: --wrap=main}
> ?%{fmudflap|fmudflapth: -fplugin=@plugin_path@/libmudflap.so}
>

Will do.

> (I added specs to remove the mudflap options so that you can
> There is some complication for testing, probably something like this could
> work too:
>
> mfwrap: %{static: ?--wrap=malloc --wrap=free --wrap=calloc
> ?--wrap=realloc --wrap=mmap --wrap=munmap --wrap=alloca}
> ?%{fmudflapth: --wrap=pthread_create}}
> ?%{fmudflap|fmudflapth: --wrap=main}
> ?%{fmudflap|fmudflapth: -fplugin=@plugin_path@/libmudflap.so}
> ?%{fmudflap=*: -fplugin=%* %<fmudflap=* -fmudflap}
>
> to specify the plugin path with -fmudflap=/path/to/libmudflap_plugin.so in
> cfrags.exp.
>

Will do.

>
>> +/* Nonzero means dont emit call to builtin alloca. ?*/
>> +
>> +int flag_no_builtin_alloca;
>> +
>
> This variable is unused.

Apologies, it might become redundant if the suggested approach takes
care of handling builtin alloca.

>
> This is great work, as I said. ?I think the first steps should be to
> separate the infrastructure changes and submit them separately. ?In the
> meanwhile you can work on building and installing mudflap as a plugin, and
> integrate something like the spec changes above. ?Cleaning up the
> builtin_alloca part should be the last thing to do before it's ready to be
> committed.
>

Thanks for the review and insightful suggestions. I 'll work on them.

> Paolo
>


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