From patchwork Mon Oct 10 21:07:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Tobler X-Patchwork-Id: 680568 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3stCQV0d2qz9sBr for ; Tue, 11 Oct 2016 08:08:17 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=B0oUjNX+; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=rtUgk3slikKOnqPXH4JxpiOC41/QSSkz9cXzL3HnRJgo03h/FL ST2yGzd5uiSTOzWZKQPL95TYC08IwoWJuzX7ZF3wkzzfnbRXdd/Ywg8U9Ga9EbKZ kvcTC8M2KSpbBtJkQiL5TgjKghIN70O4rGD5unJIfA1aIe7neZxO+cm0A= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=adjlk7qMUw4nb7ViWcdZTN9AEJ8=; b=B0oUjNX+3h5HYngfuiZM wc6oBueEQl5sWVDIhGXl48LdIUQp36ytkTzibr2eqZB5RmK+taGVEccq8Do6TaUu 4u31dMw3CViy43ZfVzTBIBYZkmB2cKcvZHE5D4HwuMuDtYXn+e997wQ4NsAKgfMx RzfiHQgiu2OfjltLUki3yQ4= Received: (qmail 93119 invoked by alias); 10 Oct 2016 21:08:08 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 93102 invoked by uid 89); 10 Oct 2016 21:08:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL, BAYES_00, KAM_ASCII_DIVIDERS, RP_MATCHES_RCVD, SPF_PASS autolearn=no version=3.3.2 spammy=Down, !shared, H*UA:Mac, config.gcc X-HELO: smtp.fgznet.ch Received: from smtp.fgznet.ch (HELO smtp.fgznet.ch) (157.161.14.52) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 10 Oct 2016 21:07:58 +0000 Received: from [192.168.225.14] (dhclient-91-190-14-19.flashcable.ch [91.190.14.19]) (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by fgznet.ch (Postfix) with ESMTPSA id BE925C4CC2 for ; Mon, 10 Oct 2016 23:07:55 +0200 (CEST) To: GCC Patches From: Andreas Tobler Subject: [patch] aarch64-*-freebsd* support for gcc. Message-ID: Date: Mon, 10 Oct 2016 23:07:55 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 X-IsSubscribed: yes Hi all, the attached patch brings support for the aarch64-*-freebsd* target. Bootstraped and tested, results on the list. Not that many results due to board instabilities.... I lack a cavium ;) Ok for main? And if yes, how far can I backport? Down to 5.4? TIA, Andreas libgcc: 2016-10-10 Andreas Tobler * config.host: Add support for aarch64-*-freebsd*. gcc: 2016-10-10 Andreas Tobler * config.gcc: Add aarch64-*-freebsd* support. * config.host: Likewise. * config/aarch64/aarch64-freebsd.h: New file. * config/aarch64/t-aarch64-freebsd: Ditto. toplevel: 2016-10-10 Andreas Tobler * configure.ac: Add aarch64-*-freebsd*. * configure: Regenerate. Index: configure.ac =================================================================== --- configure.ac (revision 240948) +++ configure.ac (working copy) @@ -727,6 +727,9 @@ *-*-vxworks*) noconfigdirs="$noconfigdirs target-libffi" ;; + aarch64*-*-freebsd*) + noconfigdirs="$noconfigdirs target-libffi" + ;; alpha*-*-*vms*) noconfigdirs="$noconfigdirs target-libffi" ;; Index: gcc/config.gcc =================================================================== --- gcc/config.gcc (revision 240948) +++ gcc/config.gcc (working copy) @@ -937,6 +937,11 @@ done TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's/^,//'` ;; +aarch64*-*-freebsd*) + tm_file="${tm_file} dbxelf.h elfos.h ${fbsd_tm_file}" + tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-freebsd.h" + tmake_file="${tmake_file} aarch64/t-aarch64 aarch64/t-aarch64-freebsd" + ;; aarch64*-*-linux*) tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h" tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-linux.h" Index: gcc/config.host =================================================================== --- gcc/config.host (revision 240948) +++ gcc/config.host (working copy) @@ -99,7 +99,7 @@ esac case ${host} in - aarch64*-*-linux*) + aarch64*-*-freebsd* | aarch64*-*-linux*) case ${target} in aarch64*-*-*) host_extra_gcc_objs="driver-aarch64.o" Index: gcc/config/aarch64/aarch64-freebsd.h =================================================================== --- gcc/config/aarch64/aarch64-freebsd.h (nonexistent) +++ gcc/config/aarch64/aarch64-freebsd.h (working copy) @@ -0,0 +1,94 @@ +/* Definitions for AArch64 running FreeBSD + Copyright (C) 2016 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + GCC is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + . */ + +#ifndef GCC_AARCH64_FREEBSD_H +#define GCC_AARCH64_FREEBSD_H + +#undef SUBTARGET_CPP_SPEC +#define SUBTARGET_CPP_SPEC FBSD_CPP_SPEC + +#if TARGET_BIG_ENDIAN_DEFAULT +#define TARGET_LINKER_EMULATION "aarch64fbsdb" +#else +#define TARGET_LINKER_EMULATION "aarch64fbsd" +#endif + +#undef SUBTARGET_EXTRA_LINK_SPEC +#define SUBTARGET_EXTRA_LINK_SPEC " -m" TARGET_LINKER_EMULATION + +#undef FBSD_TARGET_LINK_SPEC +#define FBSD_TARGET_LINK_SPEC " \ + %{p:%nconsider using `-pg' instead of `-p' with gprof (1) } \ + %{v:-V} \ + %{assert*} %{R*} %{rpath*} %{defsym*} \ + %{shared:-Bshareable %{h*} %{soname*}} \ + %{symbolic:-Bsymbolic} \ + %{static:-Bstatic} \ + %{!static: \ + %{rdynamic:-export-dynamic} \ + %{!shared:-dynamic-linker " FBSD_DYNAMIC_LINKER " }} \ + -X" SUBTARGET_EXTRA_LINK_SPEC " \ + %{mbig-endian:-EB} %{mlittle-endian:-EL}" + +#if TARGET_FIX_ERR_A53_835769_DEFAULT +#define CA53_ERR_835769_SPEC \ + " %{!mno-fix-cortex-a53-835769:--fix-cortex-a53-835769}" +#else +#define CA53_ERR_835769_SPEC \ + " %{mfix-cortex-a53-835769:--fix-cortex-a53-835769}" +#endif + +#ifdef TARGET_FIX_ERR_A53_843419_DEFAULT +#define CA53_ERR_843419_SPEC \ + " %{!mno-fix-cortex-a53-843419:--fix-cortex-a53-843419}" +#else +#define CA53_ERR_843419_SPEC \ + " %{mfix-cortex-a53-843419:--fix-cortex-a53-843419}" +#endif + +#undef LINK_SPEC +#define LINK_SPEC FBSD_TARGET_LINK_SPEC \ + CA53_ERR_835769_SPEC \ + CA53_ERR_843419_SPEC + +#define GNU_USER_TARGET_MATHFILE_SPEC \ + "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}" + +#undef ENDFILE_SPEC +#define ENDFILE_SPEC \ + GNU_USER_TARGET_MATHFILE_SPEC " " \ + FBSD_ENDFILE_SPEC + +#undef TARGET_OS_CPP_BUILTINS +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + FBSD_TARGET_OS_CPP_BUILTINS (); \ + } \ + while (false) + +#define TARGET_ASM_FILE_END file_end_indicate_exec_stack + +/* Uninitialized common symbols in non-PIE executables, even with + strong definitions in dependent shared libraries, will resolve + to COPY relocated symbol in the executable. See PR65780. */ +#undef TARGET_BINDS_LOCAL_P +#define TARGET_BINDS_LOCAL_P default_binds_local_p_2 + +#endif /* GCC_AARCH64_FREEBSD_H */ Index: gcc/config/aarch64/t-aarch64-freebsd =================================================================== --- gcc/config/aarch64/t-aarch64-freebsd (nonexistent) +++ gcc/config/aarch64/t-aarch64-freebsd (working copy) @@ -0,0 +1,21 @@ +# Machine description for AArch64 architecture. +# Copyright (C) 2016 Free Software Foundation, Inc. +# +# This file is part of GCC. +# +# GCC is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GCC is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +LIB1ASMSRC = aarch64/lib1funcs.asm +LIB1ASMFUNCS = _aarch64_sync_cache_range Index: libgcc/config.host =================================================================== --- libgcc/config.host (revision 240948) +++ libgcc/config.host (working copy) @@ -331,6 +331,11 @@ tmake_file="${tmake_file} ${cpu_type}/t-aarch64" tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp t-crtfm" ;; +aarch64*-*-freebsd*) + extra_parts="$extra_parts crtfastmath.o" + tmake_file="${tmake_file} ${cpu_type}/t-aarch64" + tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp t-crtfm" + ;; aarch64*-*-linux*) extra_parts="$extra_parts crtfastmath.o" md_unwind_header=aarch64/linux-unwind.h