From patchwork Fri Sep 26 22:39:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Ellcey X-Patchwork-Id: 394000 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 D56451401F1 for ; Sat, 27 Sep 2014 08:39:33 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :date:to:cc:subject:mime-version:content-type :content-transfer-encoding:message-id; q=dns; s=default; b=HnMWm RJOjUKS9D5Zbq81DK4nGITtTsR6bJLqyAb8a3RWy9mt6SPJaszSMui142vB8eer9 K/Jv8KvKq2q9VTwzPXsmByzQx/R4l5UcCMimwruS/LFaqqLCEkYVQ0aj3eC0ny8J a4QYRPhWbo1IQi7Nm8NyTvUshMnlg4xiiBSeuI= 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:from :date:to:cc:subject:mime-version:content-type :content-transfer-encoding:message-id; s=default; bh=6B0urTYwa4g TIckzdll0Jo6NeN8=; b=oPeBcJsUw4DkrMdDXJNtUL+VbLSQZ/5YwML6aQh74NW Z5geIVDprdDalYK0lLtytp11qS6lyswerP5c0xwnIMMxT9itajyzZm0nYo72zqjy mkZ0OzCJoxoRUOay5lRuPA+IQLim3mygY6e2h0O6ESNqfgQqXZ5G756/fIouSkeE = Received: (qmail 10648 invoked by alias); 26 Sep 2014 22:39:27 -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 10615 invoked by uid 89); 26 Sep 2014 22:39:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mailapp01.imgtec.com Received: from mailapp01.imgtec.com (HELO mailapp01.imgtec.com) (195.59.15.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 26 Sep 2014 22:39:24 +0000 Received: from KLMAIL01.kl.imgtec.org (unknown [192.168.5.35]) by Websense Email Security Gateway with ESMTPS id B110E4D20AD10; Fri, 26 Sep 2014 23:39:15 +0100 (IST) Received: from hhmail02.hh.imgtec.org (10.100.10.20) by KLMAIL01.kl.imgtec.org (192.168.5.35) with Microsoft SMTP Server (TLS) id 14.3.195.1; Fri, 26 Sep 2014 23:39:19 +0100 Received: from BAMAIL02.ba.imgtec.org (10.20.40.28) by hhmail02.hh.imgtec.org (10.100.10.20) with Microsoft SMTP Server (TLS) id 14.3.195.1; Fri, 26 Sep 2014 23:39:19 +0100 Received: from ubuntu-sellcey.mips.com (192.168.65.53) by bamail02.ba.imgtec.org (10.20.40.28) with Microsoft SMTP Server id 14.3.174.1; Fri, 26 Sep 2014 15:39:16 -0700 Received: by ubuntu-sellcey.mips.com (sSMTP sendmail emulation); Fri, 26 Sep 2014 15:39:16 -0700 From: "Steve Ellcey " Date: Fri, 26 Sep 2014 15:39:16 -0700 To: , CC: , , Subject: [Patch, MIPS] Cleanup mips header files. User-Agent: Heirloom mailx 12.5 6/20/10 MIME-Version: 1.0 Message-ID: <057a8a56-4067-41bb-b806-e1280a0a69a2@BAMAIL02.ba.imgtec.org> I would like to do some cleanup on the mips configuration code, both to reduce the amount of duplicated code and to add better support for --with-arch, --with-endian, and --with-abi. As the first step in this work I would like to check in this patch that removes the linux64.h and gnu-user64.h header files and copies the needed pieces to linux.h and gnu-user.h. Right now these headers are used when building a mips64* target or if you use --enable-target=all, but there is no reason they can't be used for normal 32 bit mips targets too. Then the only thing has to be done differently for mips64* targets (or --enable-target=all) vs. mips 32 bit targets is to add the multilib makefile fragment (t-linux64). Most of the changes here are just moving macros from one file to another. The only real functional changes are with GNU_USER_TARGET_LINK_SPEC and LINUX_DRIVER_SELF_SPECS where we pass more explicit options to the linker and now have a single consistent definition of these macros for all mips targets instead of different ones for mips32 and mips64. I built multiple different mips*-*-linux-gnu targets to test this change but there are a lot of combinations and I couldn't build all of them. OK for checkin? Steve Ellcey sellcey@mips.com 2014-09-26 Steve Ellcey * config/mips/linux64.h: Remove. * config/mips/gnu-user64.h: Remove. * gcc.config (mips*-*-*): Remove references to linux64.h and gnu-user64.h * config/mips/gnu-user.h (GNU_USER_TARGET_LINK_SPEC): Replace with modified version from gnu-user64.h. (LINUX_DRIVER_SELF_SPECS): Update parts from gnu-user64.h. (LOCAL_LABEL_PREFIX): Copy from gnu-user64.h. * config/mips/linux.h (GNU_USER_LINK_EMULATION32): Copy from linux64.h. (GNU_USER_LINK_EMULATION64): Ditto. (GNU_USER_LINK_EMULATIONN32): Ditto. (GLIBC_DYNAMIC_LINKER32): Ditto. (GLIBC_DYNAMIC_LINKER64): Ditto. (GLIBC_DYNAMIC_LINKERN32): Ditto. (UCLIBC_DYNAMIC_LINKER32): Ditto. (UCLIBC_DYNAMIC_LINKER64): Ditto. (UCLIBC_DYNAMIC_LINKERN32): Ditto. (BIONIC_DYNAMIC_LINKERN32): Ditto. (GNU_USER_DYNAMIC_LINKERN32): Ditto. (GLIBC_DYNAMIC_LINKER): Delete. (UCLIBC_DYNAMIC_LINKER): Delete. diff --git a/gcc/config.gcc b/gcc/config.gcc index 0e50e9a..ce06656 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -1941,7 +1941,7 @@ mips*-*-netbsd*) # NetBSD/mips, either endian. extra_options="${extra_options} netbsd.opt netbsd-elf.opt" ;; mips*-mti-linux*) - tm_file="dbxelf.h elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/gnu-user64.h mips/linux64.h mips/linux-common.h mips/mti-linux.h" + tm_file="dbxelf.h elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/linux.h mips/linux-common.h mips/mti-linux.h" extra_options="${extra_options} linux-android.opt" tmake_file="${tmake_file} mips/t-mti-linux" tm_defines="${tm_defines} MIPS_ISA_DEFAULT=33 MIPS_ABI_DEFAULT=ABI_32" @@ -1949,7 +1949,7 @@ mips*-mti-linux*) gas=yes ;; mips64*-*-linux* | mipsisa64*-*-linux*) - tm_file="dbxelf.h elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/gnu-user64.h mips/linux64.h mips/linux-common.h" + tm_file="dbxelf.h elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/linux.h mips/linux-common.h" extra_options="${extra_options} linux-android.opt" tmake_file="${tmake_file} mips/t-linux64" tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_N32" @@ -1973,7 +1973,6 @@ mips*-*-linux*) # Linux MIPS, either endian. tm_file="dbxelf.h elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/linux.h" extra_options="${extra_options} linux-android.opt" if test x$enable_targets = xall; then - tm_file="${tm_file} mips/gnu-user64.h mips/linux64.h" tmake_file="${tmake_file} mips/t-linux64" fi tm_file="${tm_file} mips/linux-common.h" diff --git a/gcc/config/mips/gnu-user.h b/gcc/config/mips/gnu-user.h index 638d7f0..3bb2248 100644 --- a/gcc/config/mips/gnu-user.h +++ b/gcc/config/mips/gnu-user.h @@ -52,16 +52,20 @@ along with GCC; see the file COPYING3. If not see #undef MIPS_DEFAULT_GVALUE #define MIPS_DEFAULT_GVALUE 0 -/* Borrowed from sparc/linux.h */ #undef GNU_USER_TARGET_LINK_SPEC -#define GNU_USER_TARGET_LINK_SPEC \ - "%(endian_spec) \ - %{shared:-shared} \ +#define GNU_USER_TARGET_LINK_SPEC "\ +%{G*} %{EB} %{EL} %{!EB:%{!EL:%(endian_spec)}} %{mips*} \ +%{shared} \ %{!shared: \ %{!static: \ %{rdynamic:-export-dynamic} \ - -dynamic-linker " GNU_USER_DYNAMIC_LINKER "} \ - %{static:-static}}" + %{mabi=n32: -dynamic-linker " GNU_USER_DYNAMIC_LINKERN32 "} \ + %{mabi=64: -dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "} \ + %{mabi=32: -dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}} \ + %{static:-static}} \ +%{mabi=n32:-m" GNU_USER_LINK_EMULATIONN32 "} \ +%{mabi=64:-m" GNU_USER_LINK_EMULATION64 "} \ +%{mabi=32:-m" GNU_USER_LINK_EMULATION32 "}" #undef LINK_SPEC #define LINK_SPEC GNU_USER_TARGET_LINK_SPEC @@ -122,7 +126,9 @@ extern const char *host_detect_local_cpu (int argc, const char **argv); specs handling by removing a redundant option. */ \ "%{!mno-shared:%. */ -#define GLIBC_DYNAMIC_LINKER \ +#define GNU_USER_LINK_EMULATION32 "elf32%{EB:b}%{EL:l}tsmip" +#define GNU_USER_LINK_EMULATION64 "elf64%{EB:b}%{EL:l}tsmip" +#define GNU_USER_LINK_EMULATIONN32 "elf32%{EB:b}%{EL:l}tsmipn32" + +#define GLIBC_DYNAMIC_LINKER32 \ "%{mnan=2008:/lib/ld-linux-mipsn8.so.1;:/lib/ld.so.1}" +#define GLIBC_DYNAMIC_LINKER64 \ + "%{mnan=2008:/lib64/ld-linux-mipsn8.so.1;:/lib64/ld.so.1}" +#define GLIBC_DYNAMIC_LINKERN32 \ + "%{mnan=2008:/lib32/ld-linux-mipsn8.so.1;:/lib32/ld.so.1}" -#undef UCLIBC_DYNAMIC_LINKER -#define UCLIBC_DYNAMIC_LINKER \ +#undef UCLIBC_DYNAMIC_LINKER32 +#define UCLIBC_DYNAMIC_LINKER32 \ "%{mnan=2008:/lib/ld-uClibc-mipsn8.so.0;:/lib/ld-uClibc.so.0}" +#undef UCLIBC_DYNAMIC_LINKER64 +#define UCLIBC_DYNAMIC_LINKER64 \ + "%{mnan=2008:/lib/ld64-uClibc-mipsn8.so.0;:/lib/ld64-uClibc.so.0}" +#define UCLIBC_DYNAMIC_LINKERN32 \ + "%{mnan=2008:/lib32/ld-uClibc-mipsn8.so.0;:/lib32/ld-uClibc.so.0}" + +#define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32" +#define GNU_USER_DYNAMIC_LINKERN32 \ + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \ + BIONIC_DYNAMIC_LINKERN32)