unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Theodoros Foradis <theodoros.for@openmailbox.org>
To: guix-devel@gnu.org
Subject: [PATCH v2 2/4] gnu: Add arm-none-eabi-gcc-6 and patches.
Date: Tue, 20 Sep 2016 13:50:13 +0300	[thread overview]
Message-ID: <20160920105015.1783-3-theodoros.for@openmailbox.org> (raw)
In-Reply-To: <20160920105015.1783-1-theodoros.for@openmailbox.org>

* gnu/packages/embedded.scm (gcc-arm-none-eabi-6): New variable.
* gnu/packages/patches/gcc-arm-none-eabi-multilib.patch : New file.
* gnu/packages/patches/gcc-6-cross-environment-variables.patch : New file.
---
 gnu/packages/embedded.scm                          |  12 ++
 .../patches/gcc-6-arm-none-eabi-multilib.patch     | 201 +++++++++++++++++++++
 .../gcc-6-cross-environment-variables.patch        |  65 +++++++
 3 files changed, 278 insertions(+)
 create mode 100644 gnu/packages/patches/gcc-6-arm-none-eabi-multilib.patch
 create mode 100644 gnu/packages/patches/gcc-6-cross-environment-variables.patch

diff --git a/gnu/packages/embedded.scm b/gnu/packages/embedded.scm
index 8650817..56fbafb 100644
--- a/gnu/packages/embedded.scm
+++ b/gnu/packages/embedded.scm
@@ -117,3 +117,15 @@
              (search-path-specification
               (variable "CROSS_LIBRARY_PATH")
               (files '("arm-none-eabi/lib"))))))))
+
+(define-public gcc-arm-none-eabi-6
+  (package
+    (inherit gcc-arm-none-eabi-4.9)
+    (version (package-version gcc-6))
+    (source (origin (inherit (package-source gcc-6))
+                    (patches
+                     (append
+                      (origin-patches (package-source gcc-6))
+                      (cons
+                       (search-patch "gcc-6-cross-environment-variables.patch")
+                       (search-patches "gcc-6-arm-none-eabi-multilib.patch"))))))))
diff --git a/gnu/packages/patches/gcc-6-arm-none-eabi-multilib.patch b/gnu/packages/patches/gcc-6-arm-none-eabi-multilib.patch
new file mode 100644
index 0000000..442f52b
--- /dev/null
+++ b/gnu/packages/patches/gcc-6-arm-none-eabi-multilib.patch
@@ -0,0 +1,201 @@
+From Anatol Pomozov <anatol.pomozov@gmail.com>
+Taken from Arch Linux arm-none-eabi-gcc package.
+
+Modified version of ARM patch https://gcc.gnu.org/ml/gcc-patches/2012-05/msg00083/enable-with-multilib-list-for-arm.patch
+
+diff --git a/gcc/Makefile.in b/gcc/Makefile.in
+index 4ab7405..6e1ea2c 100644
+--- a/gcc/Makefile.in
++++ b/gcc/Makefile.in
+@@ -535,6 +535,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 cb08a5c..7bded02 100644
+--- a/gcc/config.gcc
++++ b/gcc/config.gcc
+@@ -1072,7 +1072,7 @@ arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtems*)
+ 	case ${target} in
+ 	arm*-*-eabi*)
+ 	  tm_file="$tm_file newlib-stdint.h"
+-	  tmake_file="${tmake_file} arm/t-bpabi"
++	  tmake_file="${tmake_file} arm/t-bpabi arm/t-mlibs"
+ 	  use_gcc_stdint=wrap
+ 	  ;;
+ 	arm*-*-rtems*)
+@@ -3684,42 +3684,6 @@ case "${target}" in
+ 			exit 1
+ 		fi
+ 
+-		# Add extra multilibs
+-		if test "x$with_multilib_list" != x; then
+-			arm_multilibs=`echo $with_multilib_list | sed -e 's/,/ /g'`
+-			for arm_multilib in ${arm_multilibs}; do
+-				case ${arm_multilib} in
+-				aprofile)
+-				# Note that arm/t-aprofile is a
+-				# stand-alone make file fragment to be
+-				# used only with itself.  We do not
+-				# specifically use the
+-				# TM_MULTILIB_OPTION framework because
+-				# this shorthand is more
+-				# pragmatic. Additionally it is 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=aprofile" 1>&2
+-					    exit 1
+-					fi
+-					tmake_file="${tmake_file} arm/t-aprofile"
+-					break
+-					;;
+-				default)
+-					;;
+-				*)
+-					echo "Error: --with-multilib-list=${with_multilib_list} not supported." 1>&2
+-					exit 1
+-					;;
+-				esac
+-			done
+-		fi
+ 		;;
+ 
+ 	fr*-*-*linux*)
+diff --git a/gcc/config/arm/t-mlibs b/gcc/config/arm/t-mlibs
+new file mode 100644
+index 0000000..5720cf7
+--- /dev/null
++++ b/gcc/config/arm/t-mlibs
+@@ -0,0 +1,89 @@
++# 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
++MULTILIB_DIRNAMES += armv6-m armv7-m armv7e-m armv7-ar
++MULTILIB_OPTIONS  += mfloat-abi=softfp/mfloat-abi=hard
++MULTILIB_DIRNAMES += softfp fpu
++MULTILIB_OPTIONS  += mfpu=fpv4-sp-d16/mfpu=vfpv3-d16
++MULTILIB_DIRNAMES += fpv4-sp-d16 vfpv3-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?armv7e-m=mcpu?cortex-m7
++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?fpv4-sp-d16=mfpu?fpv5-sp-d16
++MULTILIB_MATCHES  += mfpu?fpv4-sp-d16=mfpu?fpv5-d16
++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 (,$(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 9523773..24952e3 100755
+--- a/gcc/configure
++++ b/gcc/configure
+@@ -763,6 +763,7 @@ SET_MAKE
+ accel_dir_suffix
+ real_target_noncanonical
+ enable_as_accelerator
++with_multilib_list
+ REPORT_BUGS_TEXI
+ REPORT_BUGS_TO
+ PKGVERSION
+@@ -7462,6 +7463,7 @@ else
+ fi
+ 
+ 
++
+ # -------------------------
+ # Checks for other programs
+ # -------------------------
+diff --git a/gcc/configure.ac b/gcc/configure.ac
+index 68b0ee8..f8a1097 100644
+--- a/gcc/configure.ac
++++ b/gcc/configure.ac
+@@ -925,6 +925,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/gnu/packages/patches/gcc-6-cross-environment-variables.patch b/gnu/packages/patches/gcc-6-cross-environment-variables.patch
new file mode 100644
index 0000000..285e78f
--- /dev/null
+++ b/gnu/packages/patches/gcc-6-cross-environment-variables.patch
@@ -0,0 +1,65 @@
+Search path environment variables for cross-compilers.  See the discussion
+at <http://gcc.gnu.org/ml/gcc/2013-02/msg00124.html>.
+
+Note: Touch 'C_INCLUDE_PATH' et al. rather than 'CPATH', as discussed
+at <http://bugs.gnu.org/22186>.
+
+--- a/gcc/incpath.c
++++ b/gcc/incpath.c
+@@ -461,8 +461,8 @@ register_include_chains (cpp_reader *pfile, const char *sysroot,
+ 			 int stdinc, int cxx_stdinc, int verbose)
+ {
+   static const char *const lang_env_vars[] =
+-    { "C_INCLUDE_PATH", "CPLUS_INCLUDE_PATH",
+-      "OBJC_INCLUDE_PATH", "OBJCPLUS_INCLUDE_PATH" };
++    { "CROSS_C_INCLUDE_PATH", "CROSS_CPLUS_INCLUDE_PATH",
++      "CROSS_OBJC_INCLUDE_PATH", "CROSS_OBJCPLUS_INCLUDE_PATH" };
+   cpp_options *cpp_opts = cpp_get_options (pfile);
+   size_t idx = (cpp_opts->objc ? 2: 0);
+ 
+@@ -473,7 +473,7 @@ register_include_chains (cpp_reader *pfile, const char *sysroot,
+ 
+   /* CPATH and language-dependent environment variables may add to the
+      include chain.  */
+-  add_env_var_paths ("CPATH", BRACKET);
++  add_env_var_paths ("CROSS_CPATH", BRACKET);
+   add_env_var_paths (lang_env_vars[idx], SYSTEM);
+ 
+   target_c_incpath.extra_pre_includes (sysroot, iprefix, stdinc);
+diff --git a/gcc/system.h b/gcc/system.h
+index 42bc509..af3b9ad 100644
+--- a/gcc/system.h
++++ b/gcc/system.h
+@@ -1063,4 +1063,6 @@ helper_const_non_const_cast (const char *p)
+ /* Get definitions of HOST_WIDE_INT and HOST_WIDEST_INT.  */
+ #include "hwint.h"
+ 
++#define LIBRARY_PATH_ENV "CROSS_LIBRARY_PATH"
++
+ #endif /* ! GCC_SYSTEM_H */
+diff --git a/gcc/tlink.c b/gcc/tlink.c
+index bc358b8..ad6242f 100644
+--- a/gcc/tlink.c
++++ b/gcc/tlink.c
+@@ -458,7 +458,7 @@ recompile_files (void)
+   file *f;
+ 
+   putenv (xstrdup ("COMPILER_PATH="));
+-  putenv (xstrdup ("LIBRARY_PATH="));
++  putenv (xstrdup (LIBRARY_PATH_ENV "="));
+ 
+   while ((f = file_pop ()) != NULL)
+     {
+diff --git a/gcc/gcc.c b/gcc/gcc.c
+index 0f042b0..c23fb0b 100644
+--- a/gcc/gcc.c
++++ b/gcc/gcc.c
+@@ -4264,7 +4264,7 @@ process_command (unsigned int decoded_options_count,
+     }
+ 
+   temp = env.get (LIBRARY_PATH_ENV);
+-  if (temp && *cross_compile == '0')
++  if (temp)
+     {
+       const char *startp, *endp;
+       char *nstore = (char *) alloca (strlen (temp) + 3);
-- 
2.9.3

  parent reply	other threads:[~2016-09-20 10:51 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-18  6:35 [PATCH 0/3] Add GCC cross compiler for arm-none-eabi Ricardo Wurmus
2016-09-18  6:35 ` [PATCH 1/3] gnu: Add arm-none-eabi cross compiler Ricardo Wurmus
2016-09-21  8:34   ` Ludovic Courtès
2016-09-18  6:35 ` [PATCH 2/3] gnu: Add newlib-arm-none-eabi Ricardo Wurmus
2016-09-21  8:38   ` Ludovic Courtès
2016-09-18  6:35 ` [PATCH 3/3] gnu: Add newlib-nano-arm-none-eabi Ricardo Wurmus
2016-09-21  8:40   ` Ludovic Courtès
2016-10-02 18:47     ` Ricardo Wurmus
2016-09-19 20:23 ` [PATCH v2 0/4] Add GCC cross compiler for arm-none-eabi Theodoros Foradis
2016-09-19 20:23   ` [PATCH v2 1/4] gnu: Add arm-none-eabi cross compiler Theodoros Foradis
2016-09-19 20:23   ` [PATCH v2 2/4] gnu: Add arm-none-eabi-gcc-6 and patches Theodoros Foradis
2016-10-10 20:22     ` Ricardo Wurmus
2016-09-19 20:23   ` [PATCH v2 3/4] gnu: Add newlib-arm-none-eabi Theodoros Foradis
2016-09-19 20:23   ` [PATCH v2 4/4] gnu: Add arm-none-eabi-toolchain Theodoros Foradis
2016-09-27  9:03   ` [PATCH v2 0/4] Add GCC cross compiler for arm-none-eabi Ludovic Courtès
2016-09-29  9:24     ` Ricardo Wurmus
2016-09-29 17:39       ` Theodoros Foradis
2016-10-10 18:09       ` Theodoros Foradis
2016-10-10 18:23         ` Ricardo Wurmus
2016-10-11 15:50           ` theodoros.for
2016-10-16 10:01           ` Ricardo Wurmus
2016-10-23 17:01             ` Theodoros Foradis
2016-11-26  8:55               ` Ricardo Wurmus
2016-09-20 10:50 ` [PATCH v2 0/1] " Theodoros Foradis
2016-09-20 10:50   ` [PATCH v2 1/4] gnu: Add arm-none-eabi cross compiler Theodoros Foradis
2016-09-20 10:50   ` Theodoros Foradis [this message]
2016-09-20 10:50   ` [PATCH v2 3/4] gnu: Add newlib-arm-none-eabi Theodoros Foradis
2016-09-20 10:50   ` [PATCH v2 4/4] gnu: Add arm-none-eabi-toolchain Theodoros Foradis
2016-09-21  8:30 ` [PATCH 0/3] Add GCC cross compiler for arm-none-eabi Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160920105015.1783-3-theodoros.for@openmailbox.org \
    --to=theodoros.for@openmailbox.org \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).