diff mbox

Add support for ARM embedded multilibs

Message ID 56395178.8000006@anw.at
State New
Headers show

Commit Message

Jasmin J. Nov. 4, 2015, 12:29 a.m. UTC
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.
 * configure: Regenerated.
 * Makefile.in (with_multilib_list): Import for being used in
   multilib fragment.
 * config/arm/t-rmprofile: New multilib fragment for arm embedded
   cores.

Signed-off-by: Jasmin Jessich <jasmin@anw.at>
---
 gcc/ChangeLog              | 13 ++++++
 gcc/Makefile.in            |  1 +
 gcc/config.gcc             | 12 ++++++
 gcc/config/arm/t-rmprofile | 99 ++++++++++++++++++++++++++++++++++++++++++++++
 gcc/configure              |  6 ++-
 gcc/configure.ac           |  1 +
 6 files changed, 130 insertions(+), 2 deletions(-)
 create mode 100644 gcc/config/arm/t-rmprofile

Comments

Ramana Radhakrishnan Nov. 4, 2015, 7:47 a.m. UTC | #1
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
Jasmin J. Nov. 4, 2015, 8:43 a.m. UTC | #2
Hello Ramana!

> 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
As I wrote in the patch, it is a port from the embedded-4_9-branch and it
is exactly what Terry did. I didn't know this patch. I extracted it from
the branch.

All other stuff required to build a gcc for the ARM embedded CPUs are already
on gcc trunk. This last piece is missing to get rid of the embedded-X_X-branch!
I would love to see it in mainline GCC.

> I would like to ask if  you have a copyright assignment on file with the FSF
I will do that.

> How was your patch tested
The patch is old an doesn't contain any real GCC change, but support for the
library building process only. This was used since 15 months by many people
and I used it to build an ARM embedded compiler based on gcc-5-branch.

> see for example how I added t-aprofile to the backend and the kind of
> testing it underwent
I will look on that, if it is really required.

>>  * configure.ac (with_multilib_list): Export for being used in arm
>>    embedded multilib fragment.
>>  * Makefile.in (with_multilib_list): Import for being used in
>>    multilib fragment.
>
> This is already being used in config.gcc - why do you need this
> additional hunk ?
To be hones, I ported the patch and checked if it works. I will analyse it more
detailed, if this is really required.

> 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 .
Where can I find them?

BR
   Jasmin
Ramana Radhakrishnan Nov. 4, 2015, 9:43 a.m. UTC | #3
On 04/11/15 08:43, Jasmin J. wrote:
> Hello Ramana!
> 
>> 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
> As I wrote in the patch, it is a port from the embedded-4_9-branch and it
> is exactly what Terry did. I didn't know this patch. I extracted it from
> the branch.

> 
> All other stuff required to build a gcc for the ARM embedded CPUs are already
> on gcc trunk. This last piece is missing to get rid of the embedded-X_X-branch!
> I would love to see it in mainline GCC.

CC'ing Tejas as he now looks after this branch internally at ARM. There are usually features on the embedded-X_X-branch used to create releases that may not be on an FSF release branch.

> 
>> I would like to ask if  you have a copyright assignment on file with the FSF
> I will do that.

So, you don't have one ? In which case it may make more sense for Tejas to deal with this given he can handle it under ARM's copyright assignment. If you make changes to this without a copyright assignment on file and submit it, it may be difficult to review this from a copyright position.

> 
>> How was your patch tested
> The patch is old an doesn't contain any real GCC change, but support for the
> library building process only. This was used since 15 months by many people
> and I used it to build an ARM embedded compiler based on gcc-5-branch.

Changing the way in which you build GCC is a real change to GCC that affects many developers. Not testing your change by building and checking that it does what it says on the tin is unacceptable.

> 
>> see for example how I added t-aprofile to the backend and the kind of
>> testing it underwent
> I will look on that, if it is really required.
> 
>>>  * configure.ac (with_multilib_list): Export for being used in arm
>>>    embedded multilib fragment.
>>>  * Makefile.in (with_multilib_list): Import for being used in
>>>    multilib fragment.
>>
>> This is already being used in config.gcc - why do you need this
>> additional hunk ?
> To be hones, I ported the patch and checked if it works. I will analyse it more
> detailed, if this is really required.
> 
>> 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 .
> Where can I find them?

gcc/doc/invoke.texi should document the rest.. I think mapping all the remaining -mcpu=cortex-a* cores and -mcpu=cortex-m* cores in there would be a sensible first step.


regards
Ramana


> 
> BR
>    Jasmin
>
Jasmin J. Nov. 4, 2015, 7:31 p.m. UTC | #4
Hello Ramana!

> There are usually features on the embedded-X_X-branch used to create
> releases that may not be on an FSF release branch.
Not on the embedded-5 branch and as far as I analysed it, all changes of
embedded-4.9 branch are now at Trunk.

>> I would like to ask if  you have a copyright assignment on file with the
>> FSF
> So, you don't have one ? In which case it may make more sense for Tejas to
> deal with this given he can handle it under ARM's copyright assignment. If
> you make changes to this without a copyright assignment on file and submit
> it, it may be difficult to review this from a copyright position.
So shall I communicate with Tejas instead of gcc-patches?

On the other hand I just read
" Small changes can be accepted without a copyright disclaimer or a copyright
  assignment on file. "
And at the end, it is the same code as Terry's patch. But I will investigate
the things you mentioned in your first answer, if they are really required and
if no simplify the patch.

> Changing the way in which you build GCC is a real change to GCC that affects
> many developers.
Does it really? It is enabled only, if you use the "--with-multilib-list"
configure option. Without the option, gcc is build exactly the same.
Without the patch "--with-multilib-list" even to allowed for any ARM target.

> I think mapping all the remaining -mcpu=cortex-a* cores and -mcpu=cortex-m*
> cores in there would be a sensible first step.
THX for the hint.

BR
   Jasmin
diff mbox

Patch

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 38e21a3..7af5e3f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,16 @@ 
+2015-11-04  Jasmin Jessich  <jasmin@anw.at>
+
+	Add support for ARM embedded multilibs. 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.
+	* configure: Regenerated.
+	* Makefile.in (with_multilib_list): Import for being used in
+	  multilib fragment.
+	* config/arm/t-rmprofile: New multilib fragment for arm embedded
+	  cores.
+
 2015-11-03  Eric Botcazou  <ebotcazou@adacore.com>
 
 	* gimple-expr.c (useless_type_conversion_p): Reinstate type canonical
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 34d2356..5aff5de 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 4a7cbd2..8decf35 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -3796,6 +3796,18 @@  case "${target}" in
 					tmake_file="${tmake_file} arm/t-aprofile"
 					break
 					;;
+				armv6-m | armv7-m | armv7e-m | armv7-r | armv7-a)
+					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=${with_multilib_list}" 1>&2
+					    exit 1
+					fi
+					tmake_file="${tmake_file} arm/t-rmprofile"
+					break
+					;;
 				default)
 					;;
 				*)
diff --git a/gcc/config/arm/t-rmprofile b/gcc/config/arm/t-rmprofile
new file mode 100644
index 0000000..3939461
--- /dev/null
+++ b/gcc/config/arm/t-rmprofile
@@ -0,0 +1,99 @@ 
+# 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 := ,
+space :=
+space +=
+
+MULTILIB_OPTIONS   = mthumb/marm
+MULTILIB_DIRNAMES  = thumb arm
+MULTILIB_OPTIONS  += march=armv6s-m/march=armv7-m/march=armv7e-m/march=armv7/mcpu=cortex-m7
+MULTILIB_DIRNAMES += armv6-m armv7-m armv7e-m armv7-ar cortex-m7
+MULTILIB_OPTIONS  += mfloat-abi=softfp/mfloat-abi=hard
+MULTILIB_DIRNAMES += softfp fpu
+MULTILIB_OPTIONS  += mfpu=fpv4-sp-d16/mfpu=vfpv3-d16/mfpu=fpv5-sp-d16/mfpu=fpv5-d16
+MULTILIB_DIRNAMES += fpv4-sp-d16 vfpv3-d16 fpv5-sp-d16 fpv5-d16
+
+MULTILIB_MATCHES   = march?armv6s-m=mcpu?cortex-m0
+MULTILIB_MATCHES  += march?armv6s-m=mcpu?cortex-m0plus
+MULTILIB_MATCHES  += march?armv6s-m=mcpu?cortex-m1
+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?armv7=march?armv7-r
+MULTILIB_MATCHES  += march?armv7=march?armv7-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?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-a15
+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,$(subst $(comma),$(space),$(with_multilib_list))))
+MULTILIB_REQUIRED   += mthumb/march=armv6s-m
+MULTILIB_OSDIRNAMES += mthumb/march.armv6s-m=!armv6-m
+endif
+
+ifneq (,$(findstring armv7-m,$(subst $(comma),$(space),$(with_multilib_list))))
+MULTILIB_REQUIRED   += mthumb/march=armv7-m
+MULTILIB_OSDIRNAMES += mthumb/march.armv7-m=!armv7-m
+endif
+
+ifneq (,$(findstring armv7e-m,$(subst $(comma),$(space),$(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_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
+endif
+
+ifneq (,$(findstring cortex-m7,$(subst $(comma),$(space),$(with_multilib_list))))
+MULTILIB_REQUIRED   += mthumb/mcpu=cortex-m7
+MULTILIB_REQUIRED   += mthumb/mcpu=cortex-m7/mfloat-abi=softfp/mfpu=fpv5-sp-d16
+MULTILIB_REQUIRED   += mthumb/mcpu=cortex-m7/mfloat-abi=hard/mfpu=fpv5-sp-d16
+MULTILIB_REQUIRED   += mthumb/mcpu=cortex-m7/mfloat-abi=softfp/mfpu=fpv5-d16
+MULTILIB_REQUIRED   += mthumb/mcpu=cortex-m7/mfloat-abi=hard/mfpu=fpv5-d16
+MULTILIB_OSDIRNAMES += mthumb/mcpu.cortex-m7=!cortex-m7
+MULTILIB_OSDIRNAMES += mthumb/mcpu.cortex-m7/mfloat-abi.hard/mfpu.fpv5-sp-d16=!cortex-m7/fpu/fpv5-sp-d16
+MULTILIB_OSDIRNAMES += mthumb/mcpu.cortex-m7/mfloat-abi.softfp/mfpu.fpv5-sp-d16=!cortex-m7/softfp/fpv5-sp-d16
+MULTILIB_OSDIRNAMES += mthumb/mcpu.cortex-m7/mfloat-abi.hard/mfpu.fpv5-d16=!cortex-m7/fpu/fpv5-d16
+MULTILIB_OSDIRNAMES += mthumb/mcpu.cortex-m7/mfloat-abi.softfp/mfpu.fpv5-d16=!cortex-m7/softfp/fpv5-d16
+endif
+
+ifneq (,$(filter armv7 armv7-r armv7-a,$(subst $(comma),$(space),$(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 92bda6c..8ced7ae 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
@@ -7729,6 +7730,7 @@  else
 fi
 
 
+
 # -------------------------
 # Checks for other programs
 # -------------------------
@@ -18405,7 +18407,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18408 "configure"
+#line 18410 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -18511,7 +18513,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18514 "configure"
+#line 18516 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 7e22267..7a04162 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