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: [plugins] RFA: Merge plugins into mainline [4/5 - configury]


On Thu, 2 Apr 2009, Diego Novillo wrote:

> +pluginlibs=
> +if test "${ENABLE_PLUGIN}" = "yes"; then
> +  # Check for ELF target.
> +  is_elf=no
> +  case "${target}" in
> +    *-*-elf* | *-*-sysv4* | *-*-unixware* | *-*-eabi* | hppa*64*-*-hpux* \
> +    | *-*-linux* | frv-*-uclinux* | *-*-irix5* | *-*-irix6* \
> +    | *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-solaris2*)
> +      case "${target}" in
> +        *-*-linux*aout* | *-*-linux*oldld*)
> +          ;;
> +        *)
> +          is_elf=yes
> +          ;;
> +      esac
> +  esac
> +
> +  # Currently plugins are only supported in ELF.
> +  if test "$is_elf" = "yes"; then
> +    pluginlibs="-rdynamic -ldl"
> +  fi
> +fi

Apart from all the other problems noted with the test needing to be a host 
test and potentially being able to test for features rather than host 
triplets, I don't see anything to address building with plugin support 
disabled, or on hosts without plugin support.

It looks like the configure option only affects linking; plugin.o will 
still be built unconditionally and the rest of the compiler will 
unconditionally contain calls to plugin functions.

You need to ensure that plugin.c does not include dlfcn.h on hosts where 
it is not available, and does not call dlopen etc. where not available or 
when plugin support is disabled.  The functions in plugin.c should still 
be available (so the rest of the compiler can call them unconditionally), 
but should have conditional code so that an error is given if -fplugin is 
used when plugin support is disabled, and so that all the other functions 
return quietly when no plugins are in use whether or not plugin support is 
enabled.  The aim should be minimal conditional compilation, to reduce the 
risk of plugins patches breaking non-plugin builds, hence putting 
conditionals inside functions only when needed rather than having a whole 
set of separate dummy functions for the non-plugin case.

The patches will need testing in at least three configurations: with 
plugins enabled, with them disabled on a host supporting plugins and on a 
host not supporting them (e.g. MinGW or Darwin).  This includes making 
sure the plugin tests are run only when plugins are enabled.

-- 
Joseph S. Myers
joseph@codesourcery.com


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