diff options
author | Zhenqiang Chen <zhenqiang.chen@linaro.org> | 2012-06-04 15:37:23 +0800 |
---|---|---|
committer | Zhenqiang Chen <zhenqiang.chen@linaro.org> | 2012-06-04 15:37:23 +0800 |
commit | bf1d25885a615162a1b1b7d40676064264706d99 (patch) | |
tree | 81760b21dbe7f98a84d24abd96dde4716e4cb43b | |
parent | 97b8e4610d5dacc939e50e4f6a0820eaf01b2eeb (diff) |
Backport from mainline r187327 and r187323
The two patches add new argument MULTILIB_REQUIRED for multilib support.
-rw-r--r-- | ChangeLog.linaro | 14 | ||||
-rw-r--r-- | gcc/Makefile.in | 3 | ||||
-rw-r--r-- | gcc/doc/fragments.texi | 25 | ||||
-rw-r--r-- | gcc/genmultilib | 45 |
4 files changed, 82 insertions, 5 deletions
diff --git a/ChangeLog.linaro b/ChangeLog.linaro index 45e1cbbfc91..c138ba496e1 100644 --- a/ChangeLog.linaro +++ b/ChangeLog.linaro @@ -1,3 +1,17 @@ +2012-06-04 Zhenqiang Chen <zhenqiang.chen@linaro.org> + + Backport from mainline r187327 and r187323 + + gcc/ + 2012-05-09 Terry Guo <terry.guo@arm.com> + * genmultilib: Update copyright dates. + * doc/fragments.texi: Ditto. + + 2012-05-09 Terry Guo <terry.guo@arm.com> + * Makefile.in (s-mlib): Add new argument MULTILIB_REQUIRED. + * genmultilib (MULTILIB_REQUIRED): New. + * doc/fragments.texi: Document the MULTILIB_REQUIRED. + 2012-05-26 Ramana Radhakrishnan <ramana.radhakrishnan@linaro.org> gcc/ diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 2319cab3b1f..d6af456e235 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1833,10 +1833,11 @@ s-mlib: $(srcdir)/genmultilib Makefile "$(MULTILIB_EXTRA_OPTS)" \ "$(MULTILIB_EXCLUSIONS)" \ "$(MULTILIB_OSDIRNAMES)" \ + "$(MULTILIB_REQUIRED)" \ "@enable_multilib@" \ > tmp-mlib.h; \ else \ - $(SHELL) $(srcdir)/genmultilib '' '' '' '' '' '' '' no \ + $(SHELL) $(srcdir)/genmultilib '' '' '' '' '' '' '' '' no\ > tmp-mlib.h; \ fi $(SHELL) $(srcdir)/../move-if-change tmp-mlib.h multilib.h diff --git a/gcc/doc/fragments.texi b/gcc/doc/fragments.texi index 31674f9a5d0..f53df29603e 100644 --- a/gcc/doc/fragments.texi +++ b/gcc/doc/fragments.texi @@ -1,5 +1,5 @@ @c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, -@c 1999, 2000, 2001, 2003, 2004, 2005, 2008, 2011 +@c 1999, 2000, 2001, 2003, 2004, 2005, 2008, 2011, 2012 @c Free Software Foundation, Inc. @c This is part of the GCC manual. @c For copying conditions, see the file gcc.texi. @@ -121,6 +121,29 @@ options enabled. Therefore @code{MULTILIB_EXCEPTIONS} is set to: *mthumb/*mhard-float* @end smallexample +@findex MULTILIB_REQUIRED +@item MULTILIB_REQUIRED +Sometimes when there are only a few combinations are required, it would +be a big effort to come up with a @code{MULTILIB_EXCEPTIONS} list to +cover all undesired ones. In such a case, just listing all the required +combinations in @code{MULTILIB_REQUIRED} would be more straightforward. + +The way to specify the entries in @code{MULTILIB_REQUIRED} is same with +the way used for @code{MULTILIB_EXCEPTIONS}, only this time what are +required will be specified. Suppose there are multiple sets of +@code{MULTILIB_OPTIONS} and only two combinations are required, one +for ARMv7-M and one for ARMv7-R with hard floating-point ABI and FPU, the +@code{MULTILIB_REQUIRED} can be set to: +@smallexample +@code{MULTILIB_REQUIRED} = mthumb/march=armv7-m +@code{MULTILIB_REQUIRED} += march=armv7-r/mfloat-abi=hard/mfpu=vfpv3-d16 +@end smallexample + +The @code{MULTILIB_REQUIRED} can be used together with +@code{MULTILIB_EXCEPTIONS}. The option combinations generated from +@code{MULTILIB_OPTIONS} will be filtered by @code{MULTILIB_EXCEPTIONS} +and then by @code{MULTILIB_REQUIRED}. + @findex MULTILIB_EXTRA_OPTS @item MULTILIB_EXTRA_OPTS Sometimes it is desirable that when building multiple versions of diff --git a/gcc/genmultilib b/gcc/genmultilib index 270de2b2a2c..dc4751b0439 100644 --- a/gcc/genmultilib +++ b/gcc/genmultilib @@ -1,6 +1,6 @@ #!/bin/sh # Generates multilib.h. -# Copyright (C) 1994, 1995, 1996, 1997, 1999, 2002, 2007 +# Copyright (C) 1994, 1995, 1996, 1997, 1999, 2002, 2007, 2012 # Free Software Foundation, Inc. #This file is part of GCC. @@ -73,6 +73,17 @@ # the os directory names are used exclusively. Use the mapping when # there is no one-to-one equivalence between GCC levels and the OS. +# The optional eighth argument which intends to reduce the effort to write +# so many MULTILIB_EXCEPTIONS rules. This option defines a series of option +# combinations that we actually required. +# For some cases, the generated option combinations are far more than what +# we need, we have to write a lot of rules to screen out combinations we +# don't need. If we missed some rules, the unexpected libraries will be built. +# Now with this argument, one can simply give what combinations are needed. +# It is pretty straigtforward. +# This argument can be used together with MULTILIB_EXCEPTIONS and will take +# effect after the MULTILIB_EXCEPTIONS. + # The last option should be "yes" if multilibs are enabled. If it is not # "yes", all GCC multilib dir names will be ".". @@ -93,7 +104,7 @@ # genmultilib 'm64/m32 mno-app-regs|mcmodel=medany' '64 32 alt' # 'mcmodel?medany=mcmodel?medmid' 'm32/mno-app-regs* m32/mcmodel=*' # '' 'm32/!m64/mno-app-regs m32/!m64/mcmodel=medany' -# '../lib64 ../lib32 alt' yes +# '../lib64 ../lib32 alt' '' yes # This produces: # ". !m64 !m32 !mno-app-regs !mcmodel=medany;", # "64:../lib64 m64 !m32 !mno-app-regs !mcmodel=medany;", @@ -121,7 +132,8 @@ exceptions=$4 extra=$5 exclusions=$6 osdirnames=$7 -enable_multilib=$8 +multilib_required=$8 +enable_multilib=$9 echo "static const char *const multilib_raw[] = {" @@ -195,6 +207,33 @@ EOF combinations=`./tmpmultilib2 ${combinations}` fi +# If the MULTILIB_REQUIRED list are provided, +# filter out combinations not in this list. +if [ -n "${multilib_required}" ]; then + cat >tmpmultilib2 <<\EOF +#!/bin/sh +# This recursive script weeds out any combination of multilib +# switches that not in the expected list. + + for opt in $@; do + case "$opt" in +EOF + + for expect in ${multilib_required}; do + echo " /${expect}/) echo \${opt};;" >> tmpmultilib2 + done + +cat >>tmpmultilib2 <<\EOF + *) ;; + esac + done +EOF + + chmod +x tmpmultilib2 + combinations=`./tmpmultilib2 ${combinations}` + +fi + # Construct a sed pattern which will convert option names to directory # names. todirnames= |