This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] FreeBSD arm support, EABI.
- From: Richard Earnshaw <rearnsha at arm dot com>
- To: Andreas Tobler <andreast-list at fgznet dot ch>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 07 Nov 2014 13:45:48 +0000
- Subject: Re: [PATCH] FreeBSD arm support, EABI.
- Authentication-results: sourceware.org; auth=none
- References: <5456AC2C dot 1000901 at fgznet dot ch>
On 02/11/14 22:11, Andreas Tobler wrote:
> Hello all,
>
> this is a patch which brings support for arm*-*-freebsd* to trunk.
> The architectures supported are arm-*-*freebsd*, armv6-*-freebsd* and
> armv6hf-*-freebsd*.
> armv6 stands for ARM_ARCH == 6, arm stands for ARM_ARCH < 6.
>
> There is kernel development for armv8 aka. aarch64 ongoing but this is
> not covered here. This patch only covers 32-bit arm in a basic manner.
>
> The patch is built and tested against armv6, armv6hf and arm. The former
> two tests (lots of) were done on a WANDBOARD-QUAD, the latter on a
> MARVELL board with 256MB Ram and 200MHz cpu.... (around 72h+ for a build
> and test.....)
>
> Results for armv6hf are on the list. Only one entry but locally I ran
> several dozens runs...
>
> Once if this patch is accepted a few test suite additions will follow.
> (arm*-*-*eabi* -> arm_eabi)
>
> The patch itself is also prepared for arm*eb*-*-freebsd*, but I could
> not test since I lack the HW.
>
> I appreciate comments, questions and also an ack if this patch is ok for
> trunk.
>
> TIA,
>
> Andreas
>
> toplevel:
>
> 2014-11-02 Andreas Tobler <andreast@gcc.gnu.org>
>
> * configure.ac: Don't add ${libgcj} for arm*-*-freebsd*.
> * configure: Regenerate.
>
> gcc:
>
> 2014-11-02 Andreas Tobler <andreast@gcc.gnu.org>
>
> * config.gcc (arm*-*-freebsd*): New configuration.
> * config/arm/freebsd.h: New file.
> * config.host: A extras components for arm*-*-freebsd*.
> * config/arm/arm.c (arm_init_libfuncs): FreeBSD does not support 8 byte
> atomics for __ARM_ARCH__ < 6 yet.
> (arm_option_override): FreeBSD has not yet implemented unaligned access.
>
> libgcc:
>
> 2014-11-02 Andreas Tobler <andreast@gcc.gnu.org>
>
> * config.host (arm*-*-freebsd*): Add new configuration for
> arm*-*-freebsd*.
> * config/arm/freebsd-atomic.c: New file.
> * config/arm/t-freebsd: Likewise.
> * config/arm/unwind-arm.h: Add __FreeBSD__ to the list of 'PC-relative
> indirect' OS's.
>
> libstdc++:
>
> 2014-11-02 Andreas Tobler <andreast@gcc.gnu.org>
>
> * configure.host: Add arm*-*-freebsd* port_specific_symbol_files.
>
>
This mostly looks OK, but a couple of nits.
> Index: gcc/config/arm/arm.c
> ===================================================================
> --- gcc/config/arm/arm.c (revision 217020)
> +++ gcc/config/arm/arm.c (working copy)
> @@ -2202,7 +2202,11 @@
> {
> /* For Linux, we have access to kernel support for atomic operations. */
> if (arm_abi == ARM_ABI_AAPCS_LINUX)
> +#ifndef __FreeBSD__
> init_sync_libfuncs (2 * UNITS_PER_WORD);
> +#else
> + init_sync_libfuncs (UNITS_PER_WORD);
> +#endif
This would be better handled by some refactoring, so that we can
eliminate the conditionalized code in the main function. Define
something like MAX_SYNC_LIBFUNC_SIZE and then override it in the
FreeBSD-specific header.
> @@ -3036,6 +3040,9 @@
> warning (0, "target CPU does not support unaligned accesses");
> unaligned_access = 0;
> }
> +#ifdef __FreeBSD__
> + unaligned_access = 0;
> +#endif
>
This really should be fixed in the OS; you're not really supporting the
architecture properly if you don't allow this on v6 or later. In the
mean time, the code should be moved to SUBTARGET_OVERRIDE_OPTIONS.
> Index: gcc/config/arm/freebsd.h
> ===================================================================
> --- gcc/config/arm/freebsd.h (revision 0)
> +++ gcc/config/arm/freebsd.h (working copy)
> +
> +/* Use the AAPCS type for wchar_t, override the one from config/freebsd.h. */
> +#undef WCHAR_TYPE
> +#define WCHAR_TYPE (TARGET_AAPCS_BASED ? "unsigned int" : "long int")
I don't think you should really be targeting anything that is not AAPCS
based; so this should surely collapse to 'unsigned int'.