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: [PATCH, ARM, 3/3] Add multilib support for bare-metal ARM architectures


Hi all!

> As to the need to modify Makefile.in and
> configure.ac, this is because the patch aims to let control to the user
> as to what multilib should be built.
As Ramana asked in his answer to my first version of the patch: Why?
The GCC mechanism to forward this to the t-* makefile is "TM_MULTILIB_CONFIG"
(as far as I have understand it). It is not necessary to introduce a new
variable to configure and Makefile.

Ramana mentioned also:
>> ... as well as comments up top to explain what multilibs are being
>> built .

Additionally the error message "You cannot use any of ..." didn't print the
the right text in any case.

Attached is an improved version of this patch:
- it uses TM_MULTILIB_CONFIG
- fixed the error message "You cannot use any of ..."
- made the error message "Error: .... not supported." more clear
- added a FSF copyright header to t-baremetal file and described what is
  built there
- commented out armv8-m.base and armv8-m.main, because this is currently not
  available in GCC mainline and gcc 5.3.0 release, but will be added soon
  (I guess)

Ramana mentioned in another message a test of the new options:
- I did test it with "test_arm_none_eabi.sh"; procedure taken from this
  message: https://gcc.gnu.org/ml/gcc-patches/2013-10/msg00659.html
- The result is in "test_result.txt".
(both files attached also)

My copyright assignment number: 1059920

Please note, that the patch
  "[PATCH, GCC/ARM, 2/3] Error out for incompatible ARM multilibs"
  from 12/16/2015 12:58 PM
needs to be applied before my new version of this patch.

BR
   Jasmin

**************************************************************************

On 12/16/2015 01:04 PM, Thomas Preud'homme wrote:
> Hi Ramana,
> 
> As suggested in your initial answer to this thread, we updated the multilib
> patch provided in ARM's embedded branch to be up-to-date with regards to
> supported CPUs in GCC. As to the need to modify Makefile.in and
> configure.ac, this is because the patch aims to let control to the user
> as to what multilib should be built. To this effect, it takes a list of
> architecture at configure time and that list needs to be passed down to
> t-baremetal Makefile to set the multilib variables appropriately.
> 
> ChangeLog entry is as follows:
> 
> 
> *** gcc/ChangeLog ***
> 
> 2015-12-15  Thomas Preud'homme  <thomas.preudhomme@arm.com>
> 
>         * Makefile.in (with_multilib_list): New variables substituted by
>         configure.
>         * config.gcc: Handle bare-metal multilibs in --with-multilib-list
>         option.
>         * config/arm/t-baremetal: New file.
>         * configure.ac (with_multilib_list): New AC_SUBST.
>         * configure: Regenerate.
>         * doc/install.texi (--with-multilib-list): Update description for
>         arm*-*-* targets to mention bare-metal multilibs.
> 
> 
> diff --git a/gcc/Makefile.in b/gcc/Makefile.in
> index 1f698798aa2df3f44d6b3a478bb4bf48e9fa7372..18b790afa114aa7580be0662d3ac9ffbc94e919d 100644
> --- a/gcc/Makefile.in
> +++ b/gcc/Makefile.in
> @@ -546,6 +546,7 @@ lang_opt_files=@lang_opt_files@ $(srcdir)/c-family/c.opt $(srcdir)/common.opt
>  lang_specs_files=@lang_specs_files@
>  lang_tree_files=@lang_tree_files@
>  target_cpu_default=@target_cpu_default@
> +with_multilib_list=@with_multilib_list@
>  OBJC_BOEHM_GC=@objc_boehm_gc@
>  extra_modes_file=@extra_modes_file@
>  extra_opt_files=@extra_opt_files@
> diff --git a/gcc/config.gcc b/gcc/config.gcc
> index af948b5e203f6b4f53dfca38e9d02d060d00c97b..d8098ed3cefacd00cb10590db1ec86d48e9fcdbc 100644
> --- a/gcc/config.gcc
> +++ b/gcc/config.gcc
> @@ -3787,15 +3787,25 @@ case "${target}" in
>  			default)
>  				;;
>  			*)
> -				echo "Error: --with-multilib-list=${with_multilib_list} not supported." 1>&2
> -				exit 1
> +				for arm_multilib in ${arm_multilibs}; do
> +					case ${arm_multilib} in
> +					armv6-m | armv7-m | armv7e-m | armv7-r | armv8-m.base | armv8-m.main)
> +						tmake_profile_file="arm/t-baremetal"
> +						;;
> +					*)
> +						echo "Error: --with-multilib-list=${with_multilib_list} not supported." 1>&2
> +						exit 1
> +						;;
> +					esac
> +				done
>  				;;
>  			esac
>  
>  			if test "x${tmake_profile_file}" != x ; then
> -				# arm/t-aprofile is only designed to work
> -				# without any with-cpu, with-arch, with-mode,
> -				# with-fpu or with-float options.
> +				# arm/t-aprofile and arm/t-baremetal are only
> +				# designed to work without any with-cpu,
> +				# with-arch, with-mode, with-fpu or with-float
> +				# options.
>  				if test "x$with_arch" != x \
>  				    || test "x$with_cpu" != x \
>  				    || test "x$with_float" != x \
> diff --git a/gcc/config/arm/t-baremetal b/gcc/config/arm/t-baremetal
> new file mode 100644
> index 0000000000000000000000000000000000000000..ffd29815e6ec22c747e77747ed9b69e0ae21b63a
> --- /dev/null
> +++ b/gcc/config/arm/t-baremetal
> @@ -0,0 +1,130 @@
> +# A set of predefined MULTILIB which can be used for different ARM targets.
> +# Via the configure option --with-multilib-list, user can customize the
> +# final MULTILIB implementation.
> +
> +comma := ,
> +
> +with_multilib_list := $(subst $(comma), ,$(with_multilib_list))))
> +
> +MULTILIB_OPTIONS   = mthumb/marm
> +MULTILIB_DIRNAMES  = thumb arm
> +MULTILIB_OPTIONS  += march=armv6s-m/march=armv7-m/march=armv7e-m/march=armv7/march=armv8-m.base/march=armv8-m.main
> +MULTILIB_DIRNAMES += armv6-m armv7-m armv7e-m armv7-ar armv8-m.base armv8-m.main
> +MULTILIB_OPTIONS  += mfloat-abi=softfp/mfloat-abi=hard
> +MULTILIB_DIRNAMES += softfp fpu
> +MULTILIB_OPTIONS  += mfpu=fpv5-sp-d16/mfpu=fpv5-d16/mfpu=fpv4-sp-d16/mfpu=vfpv3-d16
> +MULTILIB_DIRNAMES += fpv5-sp-d16 fpv5-d16 fpv4-sp-d16 vfpv3-d16
> +
> +MULTILIB_MATCHES   = march?armv6s-m=mcpu?cortex-m0
> +MULTILIB_MATCHES  += march?armv6s-m=mcpu?cortex-m0.small-multiply
> +MULTILIB_MATCHES  += march?armv6s-m=mcpu?cortex-m0plus
> +MULTILIB_MATCHES  += march?armv6s-m=mcpu?cortex-m0plus.small-multiply
> +MULTILIB_MATCHES  += march?armv6s-m=mcpu?cortex-m1
> +MULTILIB_MATCHES  += march?armv6s-m=mcpu?cortex-m1.small-multiply
> +MULTILIB_MATCHES  += march?armv6s-m=march?armv6-m
> +MULTILIB_MATCHES  += march?armv7-m=mcpu?cortex-m3
> +MULTILIB_MATCHES  += march?armv7e-m=mcpu?cortex-m4
> +MULTILIB_MATCHES  += march?armv7e-m=mcpu?cortex-m7
> +MULTILIB_MATCHES  += march?armv7e-m=mcpu?marvell-pj4
> +MULTILIB_MATCHES  += march?armv7=march?armv7-r
> +MULTILIB_MATCHES  += march?armv7=march?armv7-a
> +MULTILIB_MATCHES  += march?armv7=march?armv8-a
> +MULTILIB_MATCHES  += march?armv7=mcpu?cortex-r4
> +MULTILIB_MATCHES  += march?armv7=mcpu?cortex-r4f
> +MULTILIB_MATCHES  += march?armv7=mcpu?cortex-r5
> +MULTILIB_MATCHES  += march?armv7=mcpu?cortex-r7
> +MULTILIB_MATCHES  += march?armv7=mcpu?generic-armv7-a
> +MULTILIB_MATCHES  += march?armv7=mcpu?cortex-a5
> +MULTILIB_MATCHES  += march?armv7=mcpu?cortex-a7
> +MULTILIB_MATCHES  += march?armv7=mcpu?cortex-a8
> +MULTILIB_MATCHES  += march?armv7=mcpu?cortex-a9
> +MULTILIB_MATCHES  += march?armv7=mcpu?cortex-a12
> +MULTILIB_MATCHES  += march?armv7=mcpu?cortex-a15
> +MULTILIB_MATCHES  += march?armv7=mcpu?cortex-a17
> +MULTILIB_MATCHES  += march?armv7=mcpu?cortex-a15.cortex-a7
> +MULTILIB_MATCHES  += march?armv7=mcpu?cortex-a17.cortex-a7
> +MULTILIB_MATCHES  += march?armv7=mcpu?cortex-a53
> +MULTILIB_MATCHES  += march?armv7=mcpu?cortex-a57
> +MULTILIB_MATCHES  += march?armv7=mcpu?cortex-a72
> +MULTILIB_MATCHES  += march?armv7=mcpu?exynos-m1
> +MULTILIB_MATCHES  += march?armv7=mcpu?xgene1
> +MULTILIB_MATCHES  += march?armv7=mcpu?cortex-a57.cortex-a53
> +MULTILIB_MATCHES  += march?armv7=mcpu?cortex-a72.cortex-a53
> +MULTILIB_MATCHES  += mfpu?vfpv3-d16=mfpu?vfpv3
> +MULTILIB_MATCHES  += mfpu?vfpv3-d16=mfpu?vfpv3-fp16
> +MULTILIB_MATCHES  += mfpu?vfpv3-d16=mfpu?vfpv3-d16-fp16
> +MULTILIB_MATCHES  += mfpu?vfpv3-d16=mfpu?vfpv3xd
> +MULTILIB_MATCHES  += mfpu?vfpv3-d16=mfpu?vfpv3xd-fp16
> +MULTILIB_MATCHES  += mfpu?vfpv3-d16=mfpu?vfpv4
> +MULTILIB_MATCHES  += mfpu?vfpv3-d16=mfpu?vfpv4-d16
> +MULTILIB_MATCHES  += mfpu?vfpv3-d16=mfpu?neon
> +MULTILIB_MATCHES  += mfpu?vfpv3-d16=mfpu?neon-fp16
> +MULTILIB_MATCHES  += mfpu?vfpv3-d16=mfpu?neon-vfpv4
> +
> +MULTILIB_EXCEPTIONS =
> +MULTILIB_REUSE =
> +
> +MULTILIB_REQUIRED  = mthumb
> +MULTILIB_REQUIRED += marm
> +MULTILIB_REQUIRED += mfloat-abi=hard
> +
> +MULTILIB_OSDIRNAMES  = mthumb=!thumb
> +MULTILIB_OSDIRNAMES += marm=!arm
> +MULTILIB_OSDIRNAMES += mfloat-abi.hard=!fpu
> +
> +ifneq (,$(findstring armv6-m,$(with_multilib_list)))
> +MULTILIB_REQUIRED   += mthumb/march=armv6s-m
> +MULTILIB_OSDIRNAMES += mthumb/march.armv6s-m=!armv6-m
> +endif
> +
> +ifneq (,$(findstring armv8-m.base,$(with_multilib_list)))
> +MULTILIB_REQUIRED   += mthumb/march=armv8-m.base
> +MULTILIB_OSDIRNAMES += mthumb/march.armv8-m.base=!armv8-m.base
> +endif
> +
> +ifneq (,$(findstring armv7-m,$(with_multilib_list)))
> +MULTILIB_REQUIRED   += mthumb/march=armv7-m
> +MULTILIB_OSDIRNAMES += mthumb/march.armv7-m=!armv7-m
> +endif
> +
> +ifneq (,$(findstring armv7e-m,$(with_multilib_list)))
> +MULTILIB_REQUIRED   += mthumb/march=armv7e-m
> +MULTILIB_REQUIRED   += mthumb/march=armv7e-m/mfloat-abi=softfp/mfpu=fpv4-sp-d16
> +MULTILIB_REQUIRED   += mthumb/march=armv7e-m/mfloat-abi=hard/mfpu=fpv4-sp-d16
> +MULTILIB_REQUIRED   += mthumb/march=armv7e-m/mfloat-abi=softfp/mfpu=fpv5-d16
> +MULTILIB_REQUIRED   += mthumb/march=armv7e-m/mfloat-abi=hard/mfpu=fpv5-d16
> +MULTILIB_REQUIRED   += mthumb/march=armv7e-m/mfloat-abi=softfp/mfpu=fpv5-sp-d16
> +MULTILIB_REQUIRED   += mthumb/march=armv7e-m/mfloat-abi=hard/mfpu=fpv5-sp-d16
> +MULTILIB_OSDIRNAMES += mthumb/march.armv7e-m=!armv7e-m
> +MULTILIB_OSDIRNAMES += mthumb/march.armv7e-m/mfloat-abi.hard/mfpu.fpv4-sp-d16=!armv7e-m/fpu
> +MULTILIB_OSDIRNAMES += mthumb/march.armv7e-m/mfloat-abi.softfp/mfpu.fpv4-sp-d16=!armv7e-m/softfp
> +MULTILIB_OSDIRNAMES += mthumb/march.armv7e-m/mfloat-abi.hard/mfpu.fpv5-d16=!armv7e-m/fpu/fpv5-d16
> +MULTILIB_OSDIRNAMES += mthumb/march.armv7e-m/mfloat-abi.softfp/mfpu.fpv5-d16=!armv7e-m/softfp/fpv5-d16
> +MULTILIB_OSDIRNAMES += mthumb/march.armv7e-m/mfloat-abi.hard/mfpu.fpv5-sp-d16=!armv7e-m/fpu/fpv5-sp-d16
> +MULTILIB_OSDIRNAMES += mthumb/march.armv7e-m/mfloat-abi.softfp/mfpu.fpv5-sp-d16=!armv7e-m/softfp/fpv5-sp-d16
> +endif
> +
> +ifneq (,$(findstring armv8-m.main,$(with_multilib_list)))
> +MULTILIB_REQUIRED   += mthumb/march=armv8-m.main
> +MULTILIB_REQUIRED   += mthumb/march=armv8-m.main/mfloat-abi=softfp/mfpu=fpv5-d16
> +MULTILIB_REQUIRED   += mthumb/march=armv8-m.main/mfloat-abi=hard/mfpu=fpv5-d16
> +MULTILIB_REQUIRED   += mthumb/march=armv8-m.main/mfloat-abi=softfp/mfpu=fpv5-sp-d16
> +MULTILIB_REQUIRED   += mthumb/march=armv8-m.main/mfloat-abi=hard/mfpu=fpv5-sp-d16
> +MULTILIB_OSDIRNAMES += mthumb/march.armv8-m.main=!armv8-m.main
> +MULTILIB_OSDIRNAMES += mthumb/march.armv8-m.main/mfloat-abi.hard/mfpu.fpv5-d16=!armv8-m.main/fpu/fpv5-d16
> +MULTILIB_OSDIRNAMES += mthumb/march.armv8-m.main/mfloat-abi.softfp/mfpu.fpv5-d16=!armv8-m.main/softfp/fpv5-d16
> +MULTILIB_OSDIRNAMES += mthumb/march.armv8-m.main/mfloat-abi.hard/mfpu.fpv5-sp-d16=!armv8-m.main/fpu/fpv5-sp-d16
> +MULTILIB_OSDIRNAMES += mthumb/march.armv8-m.main/mfloat-abi.softfp/mfpu.fpv5-sp-d16=!armv8-m.main/softfp/fpv5-sp-d16
> +endif
> +
> +ifneq (,$(filter armv7 armv7-r armv7-a,$(with_multilib_list)))
> +MULTILIB_REQUIRED   += mthumb/march=armv7
> +MULTILIB_REQUIRED   += mthumb/march=armv7/mfloat-abi=softfp/mfpu=vfpv3-d16
> +MULTILIB_REQUIRED   += mthumb/march=armv7/mfloat-abi=hard/mfpu=vfpv3-d16
> +MULTILIB_OSDIRNAMES += mthumb/march.armv7=!armv7-ar/thumb
> +MULTILIB_OSDIRNAMES += mthumb/march.armv7/mfloat-abi.hard/mfpu.vfpv3-d16=!armv7-ar/thumb/fpu
> +MULTILIB_OSDIRNAMES += mthumb/march.armv7/mfloat-abi.softfp/mfpu.vfpv3-d16=!armv7-ar/thumb/softfp
> +MULTILIB_REUSE      += mthumb/march.armv7=marm/march.armv7
> +MULTILIB_REUSE      += mthumb/march.armv7/mfloat-abi.softfp/mfpu.vfpv3-d16=marm/march.armv7/mfloat-abi.softfp/mfpu.vfpv3-d16
> +MULTILIB_REUSE      += mthumb/march.armv7/mfloat-abi.hard/mfpu.vfpv3-d16=marm/march.armv7/mfloat-abi.hard/mfpu.vfpv3-d16
> +endif
> diff --git a/gcc/configure b/gcc/configure
> index 23f92c3ceeb4c2e171f0cf7f83346b7575e134c0..e55125cfb6e6a79e2ed3c274e05d9d420a220d62 100755
> --- a/gcc/configure
> +++ b/gcc/configure
> @@ -767,6 +767,7 @@ LN
>  LN_S
>  AWK
>  SET_MAKE
> +with_multilib_list
>  accel_dir_suffix
>  real_target_noncanonical
>  enable_as_accelerator
> @@ -7730,6 +7731,7 @@ else
>  fi
>  
>  
> +
>  # -------------------------
>  # Checks for other programs
>  # -------------------------
> diff --git a/gcc/configure.ac b/gcc/configure.ac
> index a2caf298d3302a2be3bfebd192101a94df7d1b65..408f772578cd5ef65310a26f6d65c3a82f3533a8 100644
> --- a/gcc/configure.ac
> +++ b/gcc/configure.ac
> @@ -960,6 +960,7 @@ AC_ARG_WITH(multilib-list,
>  [AS_HELP_STRING([--with-multilib-list], [select multilibs (AArch64, SH and x86-64 only)])],
>  :,
>  with_multilib_list=default)
> +AC_SUBST(with_multilib_list)
>  
>  # -------------------------
>  # Checks for other programs
> diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
> index 50d6133794874c6b5ec7e2b2c947c991fadbb3a4..c6d65b177696bbf897dc0dcc7dc25ea3777ac6fa 100644
> --- a/gcc/doc/install.texi
> +++ b/gcc/doc/install.texi
> @@ -1106,14 +1106,23 @@ Currently only implemented for arm*-*-*, sh*-*-* and x86-64-*-linux*.
>  
>  @table @code
>  @item arm*-*-*
> -@var{list} is either @code{default} or @code{aprofile}.  Specifying
> -@code{default} is equivalent to omitting this option while specifying
> -@code{aprofile} builds multilibs for each combination of ISA (@code{-marm} or
> -@code{-mthumb}), architecture (@code{-march=armv7-a}, @code{-march=armv7ve},
> -or @code{-march=armv8-a}), FPU available (none, @code{-mfpu=vfpv3-d16},
> -@code{neon}, @code{vfpv4-d16}, @code{neon-vfpv4} or @code{neon-fp-armv8}
> -depending on architecture) and floating-point ABI (@code{-mfloat-abi=softfp}
> -or @code{-mfloat-abi=hard}).
> +@var{list} is one of:
> +
> +@itemize @bullet
> + @item @code{default}
> + @item @code{aprofile}
> + @item any combination of @code{armv6-m}, @code{armv7-m}, @code{armv7e-m},
> + @code{armv7-r}, @code{armv8-m.base} and @code{armv8-m.main}
> +@end itemize
> +
> +Specifying @code{default} is equivalent to omitting this option while
> +specifying @code{aprofile} builds multilibs for each combination of ISA
> +(@code{-marm} or @code{-mthumb}), architecture (@code{-march=armv7-a},
> +@code{-march=armv7ve}, or @code{-march=armv8-a}), FPU available (none,
> +@code{-mfpu=vfpv3-d16}, @code{neon}, @code{vfpv4-d16}, @code{neon-vfpv4} or
> +@code{neon-fp-armv8} depending on architecture) and floating-point ABI
> +(@code{-mfloat-abi=softfp} or @code{-mfloat-abi=hard}).  The last option
> +specifies a list of bare-metal multilibs that must be built.
>  
>  @item sh*-*-*
>  @var{list} is a comma separated list of CPU names.  These must be of the
> 
> 
> Is this ok for trunk?
> 
> Best regards,
> 
> Thomas
> 
>> -----Original Message-----
>> From: gcc-patches-owner@gcc.gnu.org [mailto:gcc-patches-
>> owner@gcc.gnu.org] On Behalf Of Ramana Radhakrishnan
>> Sent: Wednesday, November 04, 2015 3:47 PM
>> To: Jasmin J.
>> Cc: gcc-patches
>> Subject: Re: [PATCH] Add support for ARM embedded multilibs
>>
>> On Wed, Nov 4, 2015 at 12:29 AM, Jasmin J. <jasmin@anw.at> wrote:
>>
>>>
>>
>> Thank you for your patch - In this case before you make any more
>> changes to this patch - comparing your patch and Terry's patch here
>> https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00729.html shows no
>> real
>> differences, I would like to ask if  you have a copyright assignment
>> on file with the FSF - Please also read
>> https://gcc.gnu.org/contribute.html for more context on this.
>>
>> How was your patch tested  - see for example how I added t-aprofile to
>> the backend and the kind of testing it underwent - I would prefer
>> something like that to be done for all the cpus listed in t-rmprofile
>> (https://gcc.gnu.org/ml/gcc-patches/2013-10/msg00659.html).
>>
>>> Ported from svn://gcc.gnu.org/svn/gcc/branches/ARM/embedded-
>> 4_9-branch
>>>
>>>  * config.gcc (--with-multilib-list): Accept arm embedded cores.
>>>  * configure.ac (with_multilib_list): Export for being used in arm
>>>    embedded multilib fragment.
>>
>> This is already being used in config.gcc - why do you need this
>> additional hunk ?
>>
>>>  * configure: Regenerated.
>>>  * Makefile.in (with_multilib_list): Import for being used in
>>>    multilib fragment.
>>
>> Again why ?
>>
>>>  * config/arm/t-rmprofile: New multilib fragment for arm embedded
>>>    cores.
>>
>> New file is sufficient here in the Changelog entry.
>>
>>
>> The t-rmprofile file will need updating to newer values for -mcpu and
>> march as well as comments up top to explain what multilibs are being
>> built .
>>
>> Ramana
> 
> 
> 
>From 1e349eeaecc7b39e86c470fe844f93ab4ae921b2 Mon Sep 17 00:00:00 2001
From: Jasmin Jessich <jasmin@anw.at>
Date: Thu, 3 Mar 2016 23:54:03 +0100
Subject: [PATCH] Add multilib support for bare-metal ARM architectures

Based on svn://gcc.gnu.org/svn/gcc/branches/ARM/embedded-5-branch
commit r231749 and r231750 from
Thomas Preud'homme  <thomas.preudhomme@arm.com>

Thomas did export with_multilib_list and used it in the Makefile. I
changed it to using TM_MULTILIB_CONFIG instead, which is the preferred
GCC pattern.
Fixed error message "You cannot use any of ..."
Additionally, I commented out armv8-m.base and armv8-m.main, because this
is currently not available in GCC mainline and gcc 5.3.0 release.

gcc/
    * config.gcc: Handle bare-metal multilibs in --with-multilib-list option.
    * config/arm/t-baremetal: New file.
    * configure.ac: added comment for ARM in --with-multilib-list option.
    * configure: added comment for ARM in --with-multilib-list option.

Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Thomas Preud'homme <thomas.preudhomme@arm.com>
---
 gcc/config.gcc             |  24 +++++--
 gcc/config/arm/t-baremetal | 165 +++++++++++++++++++++++++++++++++++++++++++++
 gcc/configure              |   2 +-
 gcc/configure.ac           |   2 +-
 4 files changed, 185 insertions(+), 8 deletions(-)
 create mode 100644 gcc/config/arm/t-baremetal

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 6704126..295fa6f 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -3805,25 +3805,37 @@ case "${target}" in
 			default)
 				;;
 			*)
-				echo "Error: --with-multilib-list=${with_multilib_list} not supported." 1>&2
-				exit 1
+				for arm_multilib in ${arm_multilibs}; do
+					case ${arm_multilib} in
+					armv6-m | armv7-m | armv7e-m | armv7-r) # armv8-m.base | armv8-m.main)
+						tmake_profile_file="arm/t-baremetal"
+                        TM_MULTILIB_CONFIG="${TM_MULTILIB_CONFIG},${arm_multilib}"
+						;;
+					*)
+						echo "Error: --with-multilib-list=${with_multilib_list}: '${arm_multilib}' not supported." 1>&2
+						exit 1
+						;;
+					esac
+				done
 				;;
 			esac
 
 			if test "x${tmake_profile_file}" != x ; then
-				# arm/t-aprofile is only designed to work
-				# without any with-cpu, with-arch, with-mode,
-				# with-fpu or with-float options.
+				# arm/t-aprofile and arm/t-baremetal are only
+				# designed to work without any with-cpu,
+				# with-arch, with-mode, with-fpu or with-float
+				# options.
 				if test "x$with_arch" != x \
 				    || test "x$with_cpu" != x \
 				    || test "x$with_float" != x \
 				    || test "x$with_fpu" != x \
 				    || test "x$with_mode" != x ; then
-				    echo "Error: You cannot use any of --with-arch/cpu/fpu/float/mode with --with-multilib-list=${arm_multilib}" 1>&2
+				    echo "Error: You cannot use any of --with-arch/cpu/fpu/float/mode with --with-multilib-list=${with_multilib_list}" 1>&2
 				    exit 1
 				fi
 
 				tmake_file="${tmake_file} ${tmake_profile_file}"
+                TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's/^,//'`
 			fi
 		fi
 		;;
diff --git a/gcc/config/arm/t-baremetal b/gcc/config/arm/t-baremetal
new file mode 100644
index 0000000..6d98ea8
--- /dev/null
+++ b/gcc/config/arm/t-baremetal
@@ -0,0 +1,165 @@
+# Copyright (C) 2012-2016 Free Software Foundation, Inc.
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GCC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+# This is a target makefile fragment that attempts to get
+# multilibs built for ARM embedded CPU's. It should not be used in
+# conjunction with another make file fragment and assumes --with-arch,
+# --with-cpu, --with-fpu, --with-float, --with-mode have their default
+# values during the configure step. We enforce this during the
+# top-level configury.
+# Via the configure option --with-multilib-list, user can customize the
+# final MULTILIB implementation.
+# TM_MULTILIB_CONFIG is set in config.gcc .
+
+comma := ,
+
+tm_ml_conf := $(subst $(comma), ,$(TM_MULTILIB_CONFIG))
+
+# We have the following hierachy:
+#   ISA: A32 (.) or T32 (thumb)
+#   Architecture: ARMv6-M (armv6-m), ARMv7-M (armv7-m), ARMv7E-M (armv7e-m)
+#                 or ARMv7 (armv7-ar)
+#   Float-abi: Soft (.), softfp (softfp), or hard (fpu).
+#   FPU: VFPv5-SP-D16 (fpv5-sp-d16), VFPv5-D16 (fpv5-d16),
+#        VFPv4-SP-D16 (fpv4-sp-d16), VFPv3-D16 (vfpv3-d16),
+#        or None (.).
+
+MULTILIB_OPTIONS   = mthumb/marm
+MULTILIB_DIRNAMES  = thumb arm
+MULTILIB_OPTIONS  += march=armv6s-m/march=armv7-m/march=armv7e-m/march=armv7
+MULTILIB_DIRNAMES += armv6-m armv7-m armv7e-m armv7-ar
+# MULTILIB_OPTIONS  += march=armv8-m.base/march=armv8-m.main
+# MULTILIB_DIRNAMES += armv8-m.base armv8-m.main
+MULTILIB_OPTIONS  += mfloat-abi=softfp/mfloat-abi=hard
+MULTILIB_DIRNAMES += softfp fpu
+MULTILIB_OPTIONS  += mfpu=fpv5-sp-d16/mfpu=fpv5-d16/mfpu=fpv4-sp-d16/mfpu=vfpv3-d16
+MULTILIB_DIRNAMES += fpv5-sp-d16 fpv5-d16 fpv4-sp-d16 vfpv3-d16
+
+MULTILIB_MATCHES   = march?armv6s-m=mcpu?cortex-m0
+MULTILIB_MATCHES  += march?armv6s-m=mcpu?cortex-m0.small-multiply
+MULTILIB_MATCHES  += march?armv6s-m=mcpu?cortex-m0plus
+MULTILIB_MATCHES  += march?armv6s-m=mcpu?cortex-m0plus.small-multiply
+MULTILIB_MATCHES  += march?armv6s-m=mcpu?cortex-m1
+MULTILIB_MATCHES  += march?armv6s-m=mcpu?cortex-m1.small-multiply
+MULTILIB_MATCHES  += march?armv6s-m=march?armv6-m
+MULTILIB_MATCHES  += march?armv7-m=mcpu?cortex-m3
+MULTILIB_MATCHES  += march?armv7e-m=mcpu?cortex-m4
+MULTILIB_MATCHES  += march?armv7e-m=mcpu?cortex-m7
+MULTILIB_MATCHES  += march?armv7e-m=mcpu?marvell-pj4
+MULTILIB_MATCHES  += march?armv7=march?armv7-r
+MULTILIB_MATCHES  += march?armv7=march?armv7-a
+MULTILIB_MATCHES  += march?armv7=march?armv8-a
+MULTILIB_MATCHES  += march?armv7=mcpu?cortex-r4
+MULTILIB_MATCHES  += march?armv7=mcpu?cortex-r4f
+MULTILIB_MATCHES  += march?armv7=mcpu?cortex-r5
+MULTILIB_MATCHES  += march?armv7=mcpu?cortex-r7
+MULTILIB_MATCHES  += march?armv7=mcpu?generic-armv7-a
+MULTILIB_MATCHES  += march?armv7=mcpu?cortex-a5
+MULTILIB_MATCHES  += march?armv7=mcpu?cortex-a7
+MULTILIB_MATCHES  += march?armv7=mcpu?cortex-a8
+MULTILIB_MATCHES  += march?armv7=mcpu?cortex-a9
+MULTILIB_MATCHES  += march?armv7=mcpu?cortex-a12
+MULTILIB_MATCHES  += march?armv7=mcpu?cortex-a15
+MULTILIB_MATCHES  += march?armv7=mcpu?cortex-a17
+MULTILIB_MATCHES  += march?armv7=mcpu?cortex-a15.cortex-a7
+MULTILIB_MATCHES  += march?armv7=mcpu?cortex-a17.cortex-a7
+MULTILIB_MATCHES  += march?armv7=mcpu?cortex-a53
+MULTILIB_MATCHES  += march?armv7=mcpu?cortex-a57
+MULTILIB_MATCHES  += march?armv7=mcpu?cortex-a72
+MULTILIB_MATCHES  += march?armv7=mcpu?exynos-m1
+MULTILIB_MATCHES  += march?armv7=mcpu?xgene1
+MULTILIB_MATCHES  += march?armv7=mcpu?cortex-a57.cortex-a53
+MULTILIB_MATCHES  += march?armv7=mcpu?cortex-a72.cortex-a53
+MULTILIB_MATCHES  += mfpu?vfpv3-d16=mfpu?vfpv3
+MULTILIB_MATCHES  += mfpu?vfpv3-d16=mfpu?vfpv3-fp16
+MULTILIB_MATCHES  += mfpu?vfpv3-d16=mfpu?vfpv3-d16-fp16
+MULTILIB_MATCHES  += mfpu?vfpv3-d16=mfpu?vfpv3xd
+MULTILIB_MATCHES  += mfpu?vfpv3-d16=mfpu?vfpv3xd-fp16
+MULTILIB_MATCHES  += mfpu?vfpv3-d16=mfpu?vfpv4
+MULTILIB_MATCHES  += mfpu?vfpv3-d16=mfpu?vfpv4-d16
+MULTILIB_MATCHES  += mfpu?vfpv3-d16=mfpu?neon
+MULTILIB_MATCHES  += mfpu?vfpv3-d16=mfpu?neon-fp16
+MULTILIB_MATCHES  += mfpu?vfpv3-d16=mfpu?neon-vfpv4
+
+MULTILIB_EXCEPTIONS =
+MULTILIB_REUSE =
+
+MULTILIB_REQUIRED  = mthumb
+MULTILIB_REQUIRED += marm
+MULTILIB_REQUIRED += mfloat-abi=hard
+
+MULTILIB_OSDIRNAMES  = mthumb=!thumb
+MULTILIB_OSDIRNAMES += marm=!arm
+MULTILIB_OSDIRNAMES += mfloat-abi.hard=!fpu
+
+ifneq (,$(findstring armv6-m,$(tm_ml_conf)))
+MULTILIB_REQUIRED   += mthumb/march=armv6s-m
+MULTILIB_OSDIRNAMES += mthumb/march.armv6s-m=!armv6-m
+endif
+
+# ifneq (,$(findstring armv8-m.base,$(tm_ml_conf)))
+# MULTILIB_REQUIRED   += mthumb/march=armv8-m.base
+# MULTILIB_OSDIRNAMES += mthumb/march.armv8-m.base=!armv8-m.base
+# endif
+
+ifneq (,$(findstring armv7-m,$(tm_ml_conf)))
+MULTILIB_REQUIRED   += mthumb/march=armv7-m
+MULTILIB_OSDIRNAMES += mthumb/march.armv7-m=!armv7-m
+endif
+
+ifneq (,$(findstring armv7e-m,$(tm_ml_conf)))
+MULTILIB_REQUIRED   += mthumb/march=armv7e-m
+MULTILIB_REQUIRED   += mthumb/march=armv7e-m/mfloat-abi=softfp/mfpu=fpv4-sp-d16
+MULTILIB_REQUIRED   += mthumb/march=armv7e-m/mfloat-abi=hard/mfpu=fpv4-sp-d16
+MULTILIB_REQUIRED   += mthumb/march=armv7e-m/mfloat-abi=softfp/mfpu=fpv5-d16
+MULTILIB_REQUIRED   += mthumb/march=armv7e-m/mfloat-abi=hard/mfpu=fpv5-d16
+MULTILIB_REQUIRED   += mthumb/march=armv7e-m/mfloat-abi=softfp/mfpu=fpv5-sp-d16
+MULTILIB_REQUIRED   += mthumb/march=armv7e-m/mfloat-abi=hard/mfpu=fpv5-sp-d16
+MULTILIB_OSDIRNAMES += mthumb/march.armv7e-m=!armv7e-m
+MULTILIB_OSDIRNAMES += mthumb/march.armv7e-m/mfloat-abi.hard/mfpu.fpv4-sp-d16=!armv7e-m/fpu
+MULTILIB_OSDIRNAMES += mthumb/march.armv7e-m/mfloat-abi.softfp/mfpu.fpv4-sp-d16=!armv7e-m/softfp
+MULTILIB_OSDIRNAMES += mthumb/march.armv7e-m/mfloat-abi.hard/mfpu.fpv5-d16=!armv7e-m/fpu/fpv5-d16
+MULTILIB_OSDIRNAMES += mthumb/march.armv7e-m/mfloat-abi.softfp/mfpu.fpv5-d16=!armv7e-m/softfp/fpv5-d16
+MULTILIB_OSDIRNAMES += mthumb/march.armv7e-m/mfloat-abi.hard/mfpu.fpv5-sp-d16=!armv7e-m/fpu/fpv5-sp-d16
+MULTILIB_OSDIRNAMES += mthumb/march.armv7e-m/mfloat-abi.softfp/mfpu.fpv5-sp-d16=!armv7e-m/softfp/fpv5-sp-d16
+endif
+
+# ifneq (,$(findstring armv8-m.main,$(tm_ml_conf)))
+# MULTILIB_REQUIRED   += mthumb/march=armv8-m.main
+# MULTILIB_REQUIRED   += mthumb/march=armv8-m.main/mfloat-abi=softfp/mfpu=fpv5-d16
+# MULTILIB_REQUIRED   += mthumb/march=armv8-m.main/mfloat-abi=hard/mfpu=fpv5-d16
+# MULTILIB_REQUIRED   += mthumb/march=armv8-m.main/mfloat-abi=softfp/mfpu=fpv5-sp-d16
+# MULTILIB_REQUIRED   += mthumb/march=armv8-m.main/mfloat-abi=hard/mfpu=fpv5-sp-d16
+# MULTILIB_OSDIRNAMES += mthumb/march.armv8-m.main=!armv8-m.main
+# MULTILIB_OSDIRNAMES += mthumb/march.armv8-m.main/mfloat-abi.hard/mfpu.fpv5-d16=!armv8-m.main/fpu/fpv5-d16
+# MULTILIB_OSDIRNAMES += mthumb/march.armv8-m.main/mfloat-abi.softfp/mfpu.fpv5-d16=!armv8-m.main/softfp/fpv5-d16
+# MULTILIB_OSDIRNAMES += mthumb/march.armv8-m.main/mfloat-abi.hard/mfpu.fpv5-sp-d16=!armv8-m.main/fpu/fpv5-sp-d16
+# MULTILIB_OSDIRNAMES += mthumb/march.armv8-m.main/mfloat-abi.softfp/mfpu.fpv5-sp-d16=!armv8-m.main/softfp/fpv5-sp-d16
+# endif
+
+ifneq (,$(filter armv7 armv7-r armv7-a,$(tm_ml_conf)))
+MULTILIB_REQUIRED   += mthumb/march=armv7
+MULTILIB_REQUIRED   += mthumb/march=armv7/mfloat-abi=softfp/mfpu=vfpv3-d16
+MULTILIB_REQUIRED   += mthumb/march=armv7/mfloat-abi=hard/mfpu=vfpv3-d16
+MULTILIB_OSDIRNAMES += mthumb/march.armv7=!armv7-ar/thumb
+MULTILIB_OSDIRNAMES += mthumb/march.armv7/mfloat-abi.hard/mfpu.vfpv3-d16=!armv7-ar/thumb/fpu
+MULTILIB_OSDIRNAMES += mthumb/march.armv7/mfloat-abi.softfp/mfpu.vfpv3-d16=!armv7-ar/thumb/softfp
+MULTILIB_REUSE      += mthumb/march.armv7=marm/march.armv7
+MULTILIB_REUSE      += mthumb/march.armv7/mfloat-abi.softfp/mfpu.vfpv3-d16=marm/march.armv7/mfloat-abi.softfp/mfpu.vfpv3-d16
+MULTILIB_REUSE      += mthumb/march.armv7/mfloat-abi.hard/mfpu.vfpv3-d16=marm/march.armv7/mfloat-abi.hard/mfpu.vfpv3-d16
+endif
diff --git a/gcc/configure b/gcc/configure
index 1c6e340..3b06936 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -1713,7 +1713,7 @@ Optional Packages:
   --with-specs=SPECS      add SPECS to driver command-line processing
   --with-pkgversion=PKG   Use PKG in the version string in place of "GCC"
   --with-bugurl=URL       Direct users to URL to report a bug
-  --with-multilib-list    select multilibs (AArch64, SH and x86-64 only)
+  --with-multilib-list    select multilibs (AArch64, ARM, SH and x86-64 only)
   --with-gnu-ld           assume the C compiler uses GNU ld default=no
   --with-libiconv-prefix[=DIR]  search for libiconv in DIR/include and DIR/lib
   --without-libiconv-prefix     don't search for libiconv in includedir and libdir
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 6c1dcd9..b8dab56 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -978,7 +978,7 @@ if test x"$enable_hsa" = x1 ; then
 fi
 
 AC_ARG_WITH(multilib-list,
-[AS_HELP_STRING([--with-multilib-list], [select multilibs (AArch64, SH and x86-64 only)])],
+[AS_HELP_STRING([--with-multilib-list], [select multilibs (AArch64, ARM, SH and x86-64 only)])],
 :,
 with_multilib_list=default)
 
-- 
1.9.1

Attachment: test_arm_none_eabi.sh
Description: application/shellscript

Attachment: test_result.txt
Description: Text document


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