Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Oct 2014 16:24:03 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r273827 - in stable/10: lib/libc/arm/aeabi lib/msun/arm sys/arm/arm sys/arm/include
Message-ID:  <201410291624.s9TGO39Z024101@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Wed Oct 29 16:24:02 2014
New Revision: 273827
URL: https://svnweb.freebsd.org/changeset/base/273827

Log:
  MFC r269956:
  
   From https://sourceware.org/ml/newlib/2014/msg00113.html
   By Richard Earnshaw at ARM
   >
   >GCC has for a number of years provides a set of pre-defined macros for
   >use with determining the ISA and features of the target during
   >pre-processing.  However, the design was always somewhat cumbersome in
   >that each new architecture revision created a new define and then
   >removed the previous one.  This meant that it was necessary to keep
   >updating the support code simply to recognise a new architecture being
   >added.
   >
   >The ACLE specification (ARM C Language Extentions)
   >(http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.set.swdev/index.html)
   >provides a much more suitable interface and GCC has supported this
   >since gcc-4.8.
   >
   >This patch makes use of the ACLE pre-defines to map to the internal
   >feature definitions.  To support older versions of GCC a compatibility
   >header is provided that maps the traditional pre-defines onto the new
   >ACLE ones.
  
   Stop using __FreeBSD_ARCH_armv6__ and switch to __ARM_ARCH >= 6 in the
   couple of places in tree. clang already implements ACLE. Add a define
   that says we implement version 1.1, even though the implementation
   isn't quite complete.

Added:
  stable/10/sys/arm/include/acle-compat.h
     - copied unchanged from r269956, head/sys/arm/include/acle-compat.h
Modified:
  stable/10/lib/libc/arm/aeabi/aeabi_vfp.h
  stable/10/lib/msun/arm/fenv.c
  stable/10/sys/arm/arm/disassem.c
  stable/10/sys/arm/include/param.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libc/arm/aeabi/aeabi_vfp.h
==============================================================================
--- stable/10/lib/libc/arm/aeabi/aeabi_vfp.h	Wed Oct 29 16:20:49 2014	(r273826)
+++ stable/10/lib/libc/arm/aeabi/aeabi_vfp.h	Wed Oct 29 16:24:02 2014	(r273827)
@@ -30,6 +30,8 @@
 #ifndef AEABI_VFP_H
 #define	AEABI_VFP_H
 
+#include <machine/acle-compat.h>
+
 /*
  * ASM helper macros. These allow the functions to be changed depending on
  * the endian-ness we are building for.
@@ -49,7 +51,7 @@
  * point falue. They will load the data from an ARM to a VFP register(s),
  * or from a VFP to an ARM register
  */
-#ifdef __ARMEB__
+#ifdef __ARM_BIG_ENDIAN
 #define	LOAD_DREG(vreg, reg0, reg1)   vmov vreg, reg1, reg0
 #define	UNLOAD_DREG(reg0, reg1, vreg) vmov reg1, reg0, vreg
 #else
@@ -65,7 +67,7 @@
  * C Helper macros
  */
 
-#if defined(__FreeBSD_ARCH_armv6__) || (defined(__ARM_ARCH) && __ARM_ARCH >= 6)
+#if __ARM_ARCH >= 6
 /*
  * Generate a function that will either call into the VFP implementation,
  * or the soft float version for a given __aeabi_* helper. The function

Modified: stable/10/lib/msun/arm/fenv.c
==============================================================================
--- stable/10/lib/msun/arm/fenv.c	Wed Oct 29 16:20:49 2014	(r273826)
+++ stable/10/lib/msun/arm/fenv.c	Wed Oct 29 16:24:02 2014	(r273827)
@@ -30,7 +30,9 @@
 #define	__fenv_static
 #include "fenv.h"
 
-#if defined(__FreeBSD_ARCH_armv6__) || (defined(__ARM_ARCH) && __ARM_ARCH >= 6)
+#include <machine/acle-compat.h>
+
+#if __ARM_ARCH >= 6
 #define FENV_ARMv6
 #endif
 

Modified: stable/10/sys/arm/arm/disassem.c
==============================================================================
--- stable/10/sys/arm/arm/disassem.c	Wed Oct 29 16:20:49 2014	(r273826)
+++ stable/10/sys/arm/arm/disassem.c	Wed Oct 29 16:24:02 2014	(r273827)
@@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/systm.h>
 #include <machine/disassem.h>
 #include <machine/armreg.h>
+#include <machine/acle-compat.h>
 #include <ddb/ddb.h>
 
 /*
@@ -130,7 +131,7 @@ static const struct arm32_insn arm32_i[]
     { 0x0c500000, 0x04100000, "ldr",	"daW" },
     { 0x0c500000, 0x04400000, "strb",	"daW" },
     { 0x0c500000, 0x04500000, "ldrb",	"daW" },
-#if defined(__FreeBSD_ARCH_armv6__)  || (defined(__ARM_ARCH) && __ARM_ARCH >= 6)
+#if __ARM_ARCH >= 6
     { 0xffffffff, 0xf57ff01f, "clrex",	"c" },
     { 0x0ff00ff0, 0x01800f90, "strex",	"dmo" },
     { 0x0ff00fff, 0x01900f9f, "ldrex",	"do" },

Copied: stable/10/sys/arm/include/acle-compat.h (from r269956, head/sys/arm/include/acle-compat.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/10/sys/arm/include/acle-compat.h	Wed Oct 29 16:24:02 2014	(r273827, copy of r269956, head/sys/arm/include/acle-compat.h)
@@ -0,0 +1,185 @@
+/*
+ * Copyright (c) 2014 ARM Ltd
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the company may not be used to endorse or promote
+ *    products derived from this software without specific prior written
+ *    permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef __ARM_ARCH
+
+/* ACLE standardises a set of pre-defines that describe the ARM architecture.
+   These were mostly implemented in GCC around GCC-4.8; older versions
+   have no, or only partial support.  To provide a level of backwards
+   compatibility we try to work out what the definitions should be, given
+   the older pre-defines that GCC did produce.  This isn't complete, but
+   it should be enough for use by routines that depend on this header.  */
+
+/* No need to handle ARMv8, GCC had ACLE support before that.  */
+
+#define __ARM_ACLE 101
+
+# ifdef __ARM_ARCH_7__
+/* The common subset of ARMv7 in all profiles.  */
+#  define __ARM_ARCH 7
+#  define __ARM_ARCH_ISA_THUMB 2
+#  define __ARM_FEATURE_CLZ
+#  define __ARM_FEATURE_LDREX 7
+#  define __ARM_FEATURE_UNALIGNED
+# endif
+
+# if defined (__ARM_ARCH_7A__) || defined (__ARM_ARCH_7R__)
+#  define __ARM_ARCH 7
+#  define __ARM_ARCH_ISA_THUMB 2
+#  define __ARM_ARCH_ISA_ARM
+#  define __ARM_FEATURE_CLZ
+#  define __ARM_FEATURE_SIMD32
+#  define __ARM_FEATURE_DSP
+#  define __ARM_FEATURE_QBIT
+#  define __ARM_FEATURE_SAT
+#  define __ARM_FEATURE_LDREX 15
+#  define __ARM_FEATURE_UNALIGNED
+#  ifdef __ARM_ARCH_7A__
+#   define __ARM_ARCH_PROFILE 'A'
+#  else
+#   define __ARM_ARCH_PROFILE 'R'
+#  endif
+# endif
+
+# ifdef __ARM_ARCH_7EM__
+#  define __ARM_ARCH 7
+#  define __ARM_ARCH_ISA_THUMB 2
+#  define __ARM_FEATURE_CLZ
+#  define __ARM_FEATURE_SIMD32
+#  define __ARM_FEATURE_DSP
+#  define __ARM_FEATURE_QBIT
+#  define __ARM_FEATURE_SAT
+#  define __ARM_FEATURE_LDREX 7
+#  define __ARM_FEATURE_UNALIGNED
+#  define __ARM_ARCH_PROFILE 'M'
+# endif
+
+# ifdef __ARM_ARCH_7M__
+#  define __ARM_ARCH 7
+#  define __ARM_ARCH_ISA_THUMB 2
+#  define __ARM_FEATURE_CLZ
+#  define __ARM_FEATURE_QBIT
+#  define __ARM_FEATURE_SAT
+#  define __ARM_FEATURE_LDREX 7
+#  define __ARM_FEATURE_UNALIGNED
+#  define __ARM_ARCH_PROFILE 'M'
+# endif
+
+# ifdef __ARM_ARCH_6T2__
+#  define __ARM_ARCH 6
+#  define __ARM_ARCH_ISA_THUMB 2
+#  define __ARM_ARCH_ISA_ARM
+#  define __ARM_FEATURE_CLZ
+#  define __ARM_FEATURE_SIMD32
+#  define __ARM_FEATURE_DSP
+#  define __ARM_FEATURE_QBIT
+#  define __ARM_FEATURE_SAT
+#  define __ARM_FEATURE_LDREX 4
+#  define __ARM_FEATURE_UNALIGNED
+# endif
+
+# ifdef __ARM_ARCH_6M__
+#  define __ARM_ARCH 6
+#  define __ARM_ARCH_ISA_THUMB 1
+#  define __ARM_ARCH_PROFILE 'M'
+# endif
+
+# if defined (__ARM_ARCH_6__) || defined (__ARM_ARCH_6J__) \
+  || defined (__ARM_ARCH_6K__) || defined (__ARM_ARCH_6Z__) \
+  || defined (__ARM_ARCH_6ZK__)
+#  define __ARM_ARCH 6
+#  define __ARM_ARCH_ISA_THUMB 1
+#  define __ARM_ARCH_ISA_ARM
+#  define __ARM_FEATURE_CLZ
+#  define __ARM_FEATURE_SIMD32
+#  define __ARM_FEATURE_DSP
+#  define __ARM_FEATURE_QBIT
+#  define __ARM_FEATURE_SAT
+#  define __ARM_FEATURE_UNALIGNED
+#  ifndef __thumb__
+#   if defined (__ARM_ARCH_6K__) || defined (__ARM_ARCH_6ZK__)
+#    define __ARM_FEATURE_LDREX 15
+#   else
+#    define __ARM_FEATURE_LDREX 4
+#   endif
+#  endif
+# endif
+
+# if defined (__ARM_ARCH_5TE__) || defined (__ARM_ARCH_5E__)
+#  define __ARM_ARCH 5
+#  define __ARM_ARCH_ISA_ARM
+#  ifdef __ARM_ARCH_5TE__
+#   define __ARM_ARCH_ISA_THUMB 1
+#  endif
+#  define __ARM_FEATURE_CLZ
+#  define __ARM_FEATURE_DSP
+# endif
+
+# if defined (__ARM_ARCH_5T__) || defined (__ARM_ARCH_5__)
+#  define __ARM_ARCH 5
+#  define __ARM_ARCH_ISA_ARM
+#  ifdef __ARM_ARCH_5TE__
+#   define __ARM_ARCH_ISA_THUMB 1
+#  endif
+#  define __ARM_FEATURE_CLZ
+# endif
+
+# ifdef __ARM_ARCH_4T__
+#  define __ARM_ARCH 4
+#  define __ARM_ARCH_ISA_ARM
+#  define __ARM_ARCH_ISA_THUMB 1
+# endif
+
+# ifdef __ARM_ARCH_4__
+#  define __ARM_ARCH 4
+#  define __ARM_ARCH_ISA_ARM
+# endif
+
+# if defined (__ARM_ARCH_3__) || defined (__ARM_ARCH_3M__)
+#  define __ARM_ARCH 3
+#  define __ARM_ARCH_ISA_ARM
+# endif
+
+# ifdef __ARM_ARCH_2__
+#  define __ARM_ARCH 2
+#  define __ARM_ARCH_ISA_ARM
+# endif
+
+# ifdef __ARMEB__
+#  define __ARM_BIG_ENDIAN
+# endif
+
+/* If we still don't know what the target architecture is, then we're
+   probably not using GCC.  */
+# ifndef __ARM_ARCH
+#  error Unable to determine architecture version.
+# endif
+
+#endif /* __ARM_ARCH  */

Modified: stable/10/sys/arm/include/param.h
==============================================================================
--- stable/10/sys/arm/include/param.h	Wed Oct 29 16:20:49 2014	(r273826)
+++ stable/10/sys/arm/include/param.h	Wed Oct 29 16:24:02 2014	(r273827)
@@ -46,13 +46,14 @@
  */
 
 #include <machine/_align.h>
+#include <machine/acle-compat.h>
 
 #define STACKALIGNBYTES	(8 - 1)
 #define STACKALIGN(p)	((u_int)(p) & ~STACKALIGNBYTES)
 
 #define __PCI_REROUTE_INTERRUPT
 
-#if defined(__FreeBSD_ARCH_armv6__) || (defined(__ARM_ARCH) && __ARM_ARCH >= 6)
+#if __ARM_ARCH >= 6
 #define	_V6_SUFFIX "v6"
 #else
 #define	_V6_SUFFIX ""
@@ -64,7 +65,7 @@
 #define	_HF_SUFFIX ""
 #endif
 
-#ifdef __ARMEB__
+#ifdef __ARM_BIG_ENDIAN
 #define	_EB_SUFFIX "eb"
 #else
 #define	_EB_SUFFIX ""



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410291624.s9TGO39Z024101>