From patchwork Sat Jan 22 22:04:41 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Millan X-Patchwork-Id: 80029 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]) by ozlabs.org (Postfix) with SMTP id A0DB9B7114 for ; Sun, 23 Jan 2011 09:05:02 +1100 (EST) Received: (qmail 13002 invoked by alias); 22 Jan 2011 22:05:00 -0000 Received: (qmail 12993 invoked by uid 22791); 22 Jan 2011 22:04:59 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-iy0-f175.google.com (HELO mail-iy0-f175.google.com) (209.85.210.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 22 Jan 2011 22:04:43 +0000 Received: by iyj18 with SMTP id 18so2976386iyj.20 for ; Sat, 22 Jan 2011 14:04:42 -0800 (PST) MIME-Version: 1.0 Received: by 10.231.10.200 with SMTP id q8mr2637785ibq.122.1295733881936; Sat, 22 Jan 2011 14:04:41 -0800 (PST) Received: by 10.231.5.153 with HTTP; Sat, 22 Jan 2011 14:04:41 -0800 (PST) Date: Sat, 22 Jan 2011 23:04:41 +0100 Message-ID: Subject: [PATCH #4] Support for MIPS targets running GNU/kFreeBSD From: Robert Millan To: gcc-patches@gcc.gnu.org X-IsSubscribed: yes 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 This patch adds support for MIPS targets running GNU/kFreeBSD. It depends on my previous patch, sent in a message with title "Support for AMD64 targets running GNU/kFreeBSD". ChangeLog entry is in patch header. 2011-01-22 Robert Millan Support for MIPS targets running GNU/kFreeBSD. * config.gcc: Detect mips*-*-kfreebsd*-gnu. * config.host: Likewise. * config/mips/kfreebsd-gnu.h: New file (undefines MD_UNWIND_SUPPORT). * config/mips/linux.h: Restrict `-march=native' support to GNU/Linux. * config/mips/linux64.h (LINK_SPEC): Process emulation names through LINK_EMULATION(). === modified file 'gcc/config.gcc' --- gcc/config.gcc 2011-01-22 10:38:43 +0000 +++ gcc/config.gcc 2011-01-22 11:58:21 +0000 @@ -1816,20 +1816,25 @@ mips*-*-netbsd*) # NetBSD/mips, either tm_file="elfos.h ${tm_file} mips/elf.h netbsd.h netbsd-elf.h mips/netbsd.h" extra_options="${extra_options} netbsd.opt netbsd-elf.opt" ;; -mips64*-*-linux* | mipsisa64*-*-linux*) +mips64*-*-linux* | mipsisa64*-*-linux* | mips64*-*-kfreebsd*-gnu | mipsisa64*-*-kfreebsd*-gnu) tm_file="dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} mips/linux.h mips/linux64.h" tmake_file="${tmake_file} mips/t-linux64 mips/t-libgcc-mips16" tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_N32" + case ${target_os} in + kfreebsd*-gnu) + tm_file="${tm_file} kfreebsd-gnu.h mips/kfreebsd-gnu.h" + ;; + esac case ${target} in mips64el-st-linux-gnu) tm_file="${tm_file} mips/st.h" tmake_file="${tmake_file} mips/t-st" ;; - mips64octeon*-*-linux*) + mips64octeon*-*-*) tm_defines="${tm_defines} MIPS_CPU_STRING_DEFAULT=\\\"octeon\\\"" target_cpu_default=MASK_SOFT_FLOAT_ABI ;; - mipsisa64r2*-*-linux*) + mipsisa64r2*-*-*) tm_defines="${tm_defines} MIPS_ISA_DEFAULT=65" ;; esac @@ -1838,9 +1843,14 @@ mips64*-*-linux* | mipsisa64*-*-linux*) gas=yes test x$with_llsc != x || with_llsc=yes ;; -mips*-*-linux*) # Linux MIPS, either endian. +mips*-*-linux* | mips*-*-kfreebsd*-gnu) # GNU/* MIPS, either endian. tm_file="dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} mips/linux.h" tmake_file="${tmake_file} mips/t-libgcc-mips16" + case ${target_os} in + kfreebsd*-gnu) + tm_file="${tm_file} kfreebsd-gnu.h mips/kfreebsd-gnu.h" + ;; + esac case ${target} in mipsisa32r2*) tm_defines="${tm_defines} MIPS_ISA_DEFAULT=33" === added file 'gcc/config/mips/kfreebsd-gnu.h' --- gcc/config/mips/kfreebsd-gnu.h 1970-01-01 00:00:00 +0000 +++ gcc/config/mips/kfreebsd-gnu.h 2011-01-22 11:58:21 +0000 @@ -0,0 +1,22 @@ +/* Definitions for MIPS running kFreeBSD-based GNU systems with ELF format + Copyright (C) 2011 + Free Software Foundation, Inc. + Contributed by Robert Millan. + +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 +. */ + +#undef MD_UNWIND_SUPPORT === modified file 'gcc/config/mips/linux.h' --- gcc/config/mips/linux.h 2011-01-18 22:00:14 +0000 +++ gcc/config/mips/linux.h 2011-01-22 11:58:21 +0000 @@ -117,8 +117,8 @@ along with GCC; see the file COPYING3. #endif /* -march=native handling only makes sense with compiler running on - a MIPS chip. */ -#if defined(__mips__) + a MIPS chip (and for now, it is only supported on GNU/Linux). */ +#if defined(__mips__) && defined(__linux__) extern const char *host_detect_local_cpu (int argc, const char **argv); # define EXTRA_SPEC_FUNCTIONS \ { "local_cpu_detect", host_detect_local_cpu }, === modified file 'gcc/config/mips/linux64.h' --- gcc/config/mips/linux64.h 2011-01-18 22:00:14 +0000 +++ gcc/config/mips/linux64.h 2011-01-22 11:58:21 +0000 @@ -57,9 +57,9 @@ along with GCC; see the file COPYING3. %{mabi=64: -dynamic-linker " LINUX_DYNAMIC_LINKER64 "} \ %{mabi=32: -dynamic-linker " LINUX_DYNAMIC_LINKER32 "}} \ %{static:-static}} \ -%{mabi=n32:-melf32%{EB:b}%{EL:l}tsmipn32} \ -%{mabi=64:-melf64%{EB:b}%{EL:l}tsmip} \ -%{mabi=32:-melf32%{EB:b}%{EL:l}tsmip}" +%{mabi=n32:-m" LINK_EMULATION("elf32%{EB:b}%{EL:l}tsmipn32") "} \ +%{mabi=64:-m" LINK_EMULATION("elf64%{EB:b}%{EL:l}tsmip") "} \ +%{mabi=32:-m" LINK_EMULATION("elf32%{EB:b}%{EL:l}tsmip") "}" #undef LOCAL_LABEL_PREFIX #define LOCAL_LABEL_PREFIX (TARGET_OLDABI ? "$" : ".") === modified file 'libgcc/config.host' --- libgcc/config.host 2011-01-18 22:00:14 +0000 +++ libgcc/config.host 2011-01-22 11:58:21 +0000 @@ -409,11 +409,11 @@ mips-sgi-irix[56]*) ;; mips*-*-netbsd*) # NetBSD/mips, either endian. ;; -mips64*-*-linux*) +mips64*-*-linux* | mips64*-*-kfreebsd*-gnu) extra_parts="$extra_parts crtfastmath.o" tmake_file="{$tmake_file} mips/t-crtfm" ;; -mips*-*-linux*) # Linux MIPS, either endian. +mips*-*-linux* | mips*-*-kfreebsd*-gnu) # GNU/* MIPS, either endian. extra_parts="$extra_parts crtfastmath.o" tmake_file="{$tmake_file} mips/t-crtfm" ;;