* [PATCH #3] mips*-kfreebsd-gnu support in GAS
@ 2010-12-14 17:05 Robert Millan
2010-12-18 11:15 ` Richard Sandiford
0 siblings, 1 reply; 4+ messages in thread
From: Robert Millan @ 2010-12-14 17:05 UTC (permalink / raw)
To: binutils
[-- Attachment #1: Type: text/plain, Size: 124 bytes --]
This patch adds mips*-kfreebsd-gnu (and mips*-freebsd)
support to GAS.
ChangeLog entry included with patch header.
[-- Attachment #2: gas_mips-kfreebsd-gnu.diff --]
[-- Type: text/x-patch, Size: 5048 bytes --]
2010-12-14 Robert Millan <rmh@gnu.org>
* config/tc-mips.h (TARGET_SUFFIX): New macro, adds a
"-freebsd" suffix to FreeBSD targets.
* config/te-tmips-freebsd.h: New file. Includes tc-mips.h
after defining TE_FreeBSD to enable FreeBSD version of
TARGET_SUFFIX().
* config/tc-mips.c (mips_target_format): Wrap traditional MIPS
targets around TARGET_SUFFIX().
* configure.in: Recognize mips-freebsd and mips-kfreebsd-gnu.
* configure.tgt: Likewise.
* configure: Regenerate.
diff -Nur binutils/gas/config/tc-mips.c binutils.gas/gas/config/tc-mips.c
--- binutils/gas/config/tc-mips.c 2010-12-10 15:25:04.000000000 +0100
+++ binutils.gas/gas/config/tc-mips.c 2010-12-14 17:09:54.000000000 +0100
@@ -1333,13 +1333,13 @@
/* This is traditional mips. */
return (target_big_endian
? (HAVE_64BIT_OBJECTS
- ? "elf64-tradbigmips"
+ ? TARGET_SUFFIX ("elf64-tradbigmips")
: (HAVE_NEWABI
- ? "elf32-ntradbigmips" : "elf32-tradbigmips"))
+ ? TARGET_SUFFIX ("elf32-ntradbigmips") : TARGET_SUFFIX ("elf32-tradbigmips")))
: (HAVE_64BIT_OBJECTS
- ? "elf64-tradlittlemips"
+ ? TARGET_SUFFIX ("elf64-tradlittlemips")
: (HAVE_NEWABI
- ? "elf32-ntradlittlemips" : "elf32-tradlittlemips")));
+ ? TARGET_SUFFIX ("elf32-ntradlittlemips") : TARGET_SUFFIX ("elf32-tradlittlemips"))));
#else
return (target_big_endian
? (HAVE_64BIT_OBJECTS
diff -Nur binutils/gas/config/tc-mips.h binutils.gas/gas/config/tc-mips.h
--- binutils/gas/config/tc-mips.h 2010-12-10 15:25:05.000000000 +0100
+++ binutils.gas/gas/config/tc-mips.h 2010-12-14 17:09:54.000000000 +0100
@@ -35,6 +35,12 @@
#define TARGET_ARCH bfd_arch_mips
+#ifdef TE_FreeBSD
+#define TARGET_SUFFIX(tgt) tgt "-freebsd"
+#else
+#define TARGET_SUFFIX(tgt) tgt
+#endif
+
#define WORKING_DOT_WORD 1
#define OLD_FLOAT_READS
#define REPEAT_CONS_EXPRESSIONS
diff -Nur binutils/gas/config/te-tmips-freebsd.h binutils.gas/gas/config/te-tmips-freebsd.h
--- binutils/gas/config/te-tmips-freebsd.h 1970-01-01 01:00:00.000000000 +0100
+++ binutils.gas/gas/config/te-tmips-freebsd.h 2010-12-14 17:09:54.000000000 +0100
@@ -0,0 +1,27 @@
+/* te-tmips-freebsd.h -- Traditional MIPS / FreeBSD target environment declarations.
+ Copyright 2000, 2005, 2007 Free Software Foundation, Inc.
+
+ This file is part of GAS, the GNU Assembler.
+
+ GAS 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.
+
+ GAS 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 GAS; see the file COPYING. If not, write to the Free
+ Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
+ 02110-1301, USA. */
+
+/* Target environment for FreeBSD. It is the same as the generic
+ target, except that it arranges via the TE_FreeBSD define to
+ suppress the use of "/" as a comment character. Some code in the
+ FreeBSD kernel uses "/" to mean division. (What a concept!) */
+#define TE_FreeBSD 1
+
+#include "te-tmips.h"
diff -Nur binutils/gas/configure.in binutils.gas/gas/configure.in
--- binutils/gas/configure.in 2010-11-19 03:32:00.000000000 +0100
+++ binutils.gas/gas/configure.in 2010-12-14 17:12:29.000000000 +0100
@@ -250,10 +250,10 @@
esac
# Decide which ABI to target by default.
case ${target} in
- mips64*-linux* | mips-sgi-irix6*)
+ mips64*-linux* | mips-sgi-irix6* | mips64*-freebsd* | mips64*-kfreebsd*-gnu)
mips_default_abi=N32_ABI
;;
- mips*-linux*)
+ mips*-linux* | mips*-freebsd* | mips*-kfreebsd*-gnu)
mips_default_abi=O32_ABI
;;
mips64*-openbsd*)
@@ -401,7 +401,8 @@
case ${generic_target}-${fmt} in
mips-*-irix5*-*) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;;
- mips*-*-linux*-*) case "$endian" in
+ mips*-*-linux*-* | mips*-*-freebsd* | mips*-*-kfreebsd*-gnu)
+ case "$endian" in
big) emulation="mipsbelf mipslelf mipself" ;;
*) emulation="mipslelf mipsbelf mipself" ;;
esac ;;
diff -Nur binutils/gas/configure.tgt binutils.gas/gas/configure.tgt
--- binutils/gas/configure.tgt 2010-11-30 02:14:08.000000000 +0100
+++ binutils.gas/gas/configure.tgt 2010-12-14 17:13:09.000000000 +0100
@@ -290,6 +290,8 @@
mips-*-lnews*) fmt=ecoff em=lnews ;;
mips-*-riscos*) fmt=ecoff ;;
mips*-*-linux*) fmt=elf em=tmips ;;
+ mips*-*-freebsd* | mips*-*-kfreebsd*-gnu)
+ fmt=elf em=tmips-freebsd ;;
mips-*-sysv4*MP* | mips-*-gnu*) fmt=elf em=tmips ;;
mips*-sde-elf*) fmt=elf em=tmips ;;
mips-*-sysv*) fmt=ecoff ;;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH #3] mips*-kfreebsd-gnu support in GAS
2010-12-14 17:05 [PATCH #3] mips*-kfreebsd-gnu support in GAS Robert Millan
@ 2010-12-18 11:15 ` Richard Sandiford
2010-12-18 11:29 ` Richard Sandiford
2010-12-20 6:31 ` Robert Millan
0 siblings, 2 replies; 4+ messages in thread
From: Richard Sandiford @ 2010-12-18 11:15 UTC (permalink / raw)
To: Robert Millan; +Cc: binutils
Robert Millan <rmh@gnu.org> writes:
> diff -Nur binutils/gas/config/tc-mips.c binutils.gas/gas/config/tc-mips.c
> --- binutils/gas/config/tc-mips.c 2010-12-10 15:25:04.000000000 +0100
> +++ binutils.gas/gas/config/tc-mips.c 2010-12-14 17:09:54.000000000 +0100
> @@ -1333,13 +1333,13 @@
> /* This is traditional mips. */
> return (target_big_endian
> ? (HAVE_64BIT_OBJECTS
> - ? "elf64-tradbigmips"
> + ? TARGET_SUFFIX ("elf64-tradbigmips")
> : (HAVE_NEWABI
> - ? "elf32-ntradbigmips" : "elf32-tradbigmips"))
> + ? TARGET_SUFFIX ("elf32-ntradbigmips") : TARGET_SUFFIX ("elf32-tradbigmips")))
> : (HAVE_64BIT_OBJECTS
> - ? "elf64-tradlittlemips"
> + ? TARGET_SUFFIX ("elf64-tradlittlemips")
> : (HAVE_NEWABI
> - ? "elf32-ntradlittlemips" : "elf32-tradlittlemips")));
> + ? TARGET_SUFFIX ("elf32-ntradlittlemips") : TARGET_SUFFIX ("elf32-tradlittlemips"))));
Watch the long lines (limit is 80 characters). However, rather than
do this just for the TE_TMIPS case, and have...
> diff -Nur binutils/gas/config/te-tmips-freebsd.h binutils.gas/gas/config/te-tmips-freebsd.h
> --- binutils/gas/config/te-tmips-freebsd.h 1970-01-01 01:00:00.000000000 +0100
> +++ binutils.gas/gas/config/te-tmips-freebsd.h 2010-12-14 17:09:54.000000000 +0100
> @@ -0,0 +1,27 @@
> +/* te-tmips-freebsd.h -- Traditional MIPS / FreeBSD target environment declarations.
> + Copyright 2000, 2005, 2007 Free Software Foundation, Inc.
> +
> + This file is part of GAS, the GNU Assembler.
> +
> + GAS 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.
> +
> + GAS 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 GAS; see the file COPYING. If not, write to the Free
> + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
> + 02110-1301, USA. */
> +
> +/* Target environment for FreeBSD. It is the same as the generic
> + target, except that it arranges via the TE_FreeBSD define to
> + suppress the use of "/" as a comment character. Some code in the
> + FreeBSD kernel uses "/" to mean division. (What a concept!) */
> +#define TE_FreeBSD 1
> +
> +#include "te-tmips.h"
...this extra file, I think it would be cleaner to have:
#if defined (TE_FreeBSD)
#define ELF_TARGET(PREFIX, ENDIAN) PREFIX "trad" ENDIAN "mips-freebsd"
#if defined (TE_TMIPS)
#define ELF_TARGET(PREFIX, ENDIAN) PREFIX "trad" ENDIAN "mips"
#else
#define ELF_TARGET(PREFIX, ENDIAN) PREFIX ENDIAN "mips"
#endif
in tc-mips.c. The configure scripts could then just use the ordinary
te_freebsd file. mips_target_format would look like this:
return (target_big_endian
? (HAVE_64BIT_OBJECTS
? ELF_TARGET ("elf64-", "big")
: HAVE_NEWABI
? ELF_TARGET ("elf32-n", "big")
: ELF_TARGET ("elf32-", "big"))
: (HAVE_64BIT_OBJECTS
? ELF_TARGET ("elf64-", "little")
: HAVE_NEWABI
? ELF_TARGET ("elf32-n", "little")
: ELF_TARGET ("elf32-", "little")));
and support_64bit_objects would look like this:
list = bfd_target_list ();
for (l = list; *l != NULL; l++)
if (strcmp (*l, ELF_TARGET ("elf64-", "big")) == 0
|| strcmp (*l, ELF_TARGET ("elf64-", "little")) == 0)
break;
(all untested).
Richard
PS. Sorry for the delay in reviewing this stuff, been very busy...
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH #3] mips*-kfreebsd-gnu support in GAS
2010-12-18 11:15 ` Richard Sandiford
@ 2010-12-18 11:29 ` Richard Sandiford
2010-12-20 6:31 ` Robert Millan
1 sibling, 0 replies; 4+ messages in thread
From: Richard Sandiford @ 2010-12-18 11:29 UTC (permalink / raw)
To: Robert Millan; +Cc: binutils
Richard Sandiford <rdsandiford@googlemail.com> writes:
> ...this extra file, I think it would be cleaner to have:
>
> #if defined (TE_FreeBSD)
> #define ELF_TARGET(PREFIX, ENDIAN) PREFIX "trad" ENDIAN "mips-freebsd"
> #if defined (TE_TMIPS)
> #define ELF_TARGET(PREFIX, ENDIAN) PREFIX "trad" ENDIAN "mips"
> #else
> #define ELF_TARGET(PREFIX, ENDIAN) PREFIX ENDIAN "mips"
> #endif
er, clearly that was supposed to be:
#elif defined (TE_TMIPS)
Richard
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH #3] mips*-kfreebsd-gnu support in GAS
2010-12-18 11:15 ` Richard Sandiford
2010-12-18 11:29 ` Richard Sandiford
@ 2010-12-20 6:31 ` Robert Millan
1 sibling, 0 replies; 4+ messages in thread
From: Robert Millan @ 2010-12-20 6:31 UTC (permalink / raw)
To: binutils, rdsandiford
[-- Attachment #1: Type: text/plain, Size: 494 bytes --]
El 18/12/10 11:44:29, en/na Richard Sandiford va escriure:
>
> Watch the long lines (limit is 80 characters). However, rather than
> do this just for the TE_TMIPS case, and have...
>
> [...]
>
> ...this extra file, I think it would be cleaner to have:
>
> [...]
>
> in tc-mips.c. The configure scripts could then just use the ordinary
> te_freebsd file. mips_target_format would look like this:
>
> [...]
Done, here's a new patch with the adjustments you requested.
[-- Attachment #2: gas_mips-kfreebsd-gnu.diff --]
[-- Type: text/x-patch, Size: 4232 bytes --]
2010-12-19 Robert Millan <rmh@gnu.org>
mips-(freebsd|kfreebsd-gnu) support.
* config/tc-mips.c (ELF_TARGET): New macro. Generates target
names accordingly to whether TE_FreeBSD and whether TE_TMIPS
are defined.
(mips_target_format): Refactor code using ELF_TARGET().
(support_64bit_objects): Likewise.
* configure.in: Recognize mips-freebsd and mips-kfreebsd-gnu.
* configure.tgt: Likewise.
* configure: Regenerate.
diff -Nur binutils.old//gas/config/tc-mips.c binutils/gas/config/tc-mips.c
--- binutils.old//gas/config/tc-mips.c 2010-12-18 21:24:35.000000000 +0100
+++ binutils/gas/config/tc-mips.c 2010-12-19 14:45:04.000000000 +0100
@@ -1313,6 +1313,14 @@
/* The default target format to use. */
+#if defined (TE_FreeBSD)
+#define ELF_TARGET(PREFIX, ENDIAN) PREFIX "trad" ENDIAN "mips-freebsd"
+#elif defined (TE_TMIPS)
+#define ELF_TARGET(PREFIX, ENDIAN) PREFIX "trad" ENDIAN "mips"
+#else
+#define ELF_TARGET(PREFIX, ENDIAN) PREFIX ENDIAN "mips"
+#endif
+
const char *
mips_target_format (void)
{
@@ -1329,28 +1337,17 @@
? "elf32-bigmips-vxworks"
: "elf32-littlemips-vxworks");
#endif
-#ifdef TE_TMIPS
- /* This is traditional mips. */
- return (target_big_endian
- ? (HAVE_64BIT_OBJECTS
- ? "elf64-tradbigmips"
- : (HAVE_NEWABI
- ? "elf32-ntradbigmips" : "elf32-tradbigmips"))
- : (HAVE_64BIT_OBJECTS
- ? "elf64-tradlittlemips"
- : (HAVE_NEWABI
- ? "elf32-ntradlittlemips" : "elf32-tradlittlemips")));
-#else
return (target_big_endian
? (HAVE_64BIT_OBJECTS
- ? "elf64-bigmips"
+ ? ELF_TARGET ("elf64-", "big")
: (HAVE_NEWABI
- ? "elf32-nbigmips" : "elf32-bigmips"))
+ ? ELF_TARGET ("elf32-n", "big")
+ : ELF_TARGET ("elf32-", "big")))
: (HAVE_64BIT_OBJECTS
- ? "elf64-littlemips"
+ ? ELF_TARGET ("elf64-", "little")
: (HAVE_NEWABI
- ? "elf32-nlittlemips" : "elf32-littlemips")));
-#endif
+ ? ELF_TARGET ("elf32-n", "little")
+ : ELF_TARGET ("elf32-", "little"))));
default:
abort ();
return NULL;
@@ -11264,14 +11261,8 @@
list = bfd_target_list ();
for (l = list; *l != NULL; l++)
-#ifdef TE_TMIPS
- /* This is traditional mips */
- if (strcmp (*l, "elf64-tradbigmips") == 0
- || strcmp (*l, "elf64-tradlittlemips") == 0)
-#else
- if (strcmp (*l, "elf64-bigmips") == 0
- || strcmp (*l, "elf64-littlemips") == 0)
-#endif
+ if (strcmp (*l, ELF_TARGET ("elf64-", "big")) == 0
+ || strcmp (*l, ELF_TARGET ("elf64-", "little")) == 0)
break;
yes = (*l != NULL);
free (list);
diff -Nur binutils.old//gas/configure.in binutils/gas/configure.in
--- binutils.old//gas/configure.in 2010-11-19 03:32:00.000000000 +0100
+++ binutils/gas/configure.in 2010-12-19 14:20:35.000000000 +0100
@@ -250,10 +250,10 @@
esac
# Decide which ABI to target by default.
case ${target} in
- mips64*-linux* | mips-sgi-irix6*)
+ mips64*-linux* | mips-sgi-irix6* | mips64*-freebsd* | mips64*-kfreebsd*-gnu)
mips_default_abi=N32_ABI
;;
- mips*-linux*)
+ mips*-linux* | mips*-freebsd* | mips*-kfreebsd*-gnu)
mips_default_abi=O32_ABI
;;
mips64*-openbsd*)
@@ -401,7 +401,8 @@
case ${generic_target}-${fmt} in
mips-*-irix5*-*) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;;
- mips*-*-linux*-*) case "$endian" in
+ mips*-*-linux*-* | mips*-*-freebsd* | mips*-*-kfreebsd*-gnu)
+ case "$endian" in
big) emulation="mipsbelf mipslelf mipself" ;;
*) emulation="mipslelf mipsbelf mipself" ;;
esac ;;
diff -Nur binutils.old//gas/configure.tgt binutils/gas/configure.tgt
--- binutils.old//gas/configure.tgt 2010-11-30 02:14:08.000000000 +0100
+++ binutils/gas/configure.tgt 2010-12-19 14:38:56.000000000 +0100
@@ -290,6 +290,8 @@
mips-*-lnews*) fmt=ecoff em=lnews ;;
mips-*-riscos*) fmt=ecoff ;;
mips*-*-linux*) fmt=elf em=tmips ;;
+ mips*-*-freebsd* | mips*-*-kfreebsd*-gnu)
+ fmt=elf em=freebsd ;;
mips-*-sysv4*MP* | mips-*-gnu*) fmt=elf em=tmips ;;
mips*-sde-elf*) fmt=elf em=tmips ;;
mips-*-sysv*) fmt=ecoff ;;
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-12-19 18:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-14 17:05 [PATCH #3] mips*-kfreebsd-gnu support in GAS Robert Millan
2010-12-18 11:15 ` Richard Sandiford
2010-12-18 11:29 ` Richard Sandiford
2010-12-20 6:31 ` Robert Millan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).