[PATCH, ARM, 3/3] Add multilib support for bare-metal ARM architectures
Jasmin J.
jasmin@anw.at
Fri Apr 29 07:24:00 GMT 2016
Hi!
Ping!
Attached is a rebased version of my patch with a small change, which converts
some spaces to TABs.
> 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.
This is still a requirement.
BR
Jasmin
***************************************************************************
On 03/04/2016 01:19 AM, Jasmin J. wrote:
> 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
>>
>>
>>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Add-multilib-support-for-bare-metal-ARM-architecture.patch
Type: text/x-patch
Size: 12865 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20160429/ed10d5de/attachment.bin>
More information about the Gcc-patches
mailing list