Re: [PATCH] disable __size_t macro on GNU/kFreeBSD

2012-02-12 Thread Robert Millan
El 12 de febrer de 2012 1:09, Gerald Pfeifer ger...@pfeifer.com ha escrit:
 Given that both Mike and me considered this patch on the obvious
 side, I now committed the following variation thereof on trunk.

Thanks!

-- 
Robert Millan


Re: [PATCH] disable __size_t macro on GNU/kFreeBSD

2012-02-11 Thread Robert Millan
El 6 de febrer de 2012 19:31, Mike Stump mikest...@comcast.net ha escrit:
 Looks obvious to me as well.  I'd say let's put it in...

 Is this patch approved, then?

 I've not seen anyone approve it yet.  I'm not a maintainer for that area, so, 
 I cannot.

Who can approve it?  Looking at the maintainers file it's not clear to
me which area does this belong to.

-- 
Robert Millan


Re: [PATCH] disable __size_t macro on GNU/kFreeBSD

2012-02-04 Thread Robert Millan
El 1 de febrer de 2012 1:06, Mike Stump mikest...@comcast.net ha escrit:
 On Jan 31, 2012, at 2:29 PM, Gerald Pfeifer wrote:
 On Sun, 29 Jan 2012, Robert Millan wrote:
 Please consider this patch to stddef.h. GNU/kFreeBSD has the same
 problem with __size_t as FreeBSD does, since it inherits many kernel
 headers from FreeBSD.

 The patch looks obvious to me, and I'll be happy to apply for
 Robert if approved.  Any taker?

 Looks obvious to me as well.  I'd say let's put it in...

Is this patch approved, then?

-- 
Robert Millan


[PATCH] disable __size_t macro on GNU/kFreeBSD

2012-01-28 Thread Robert Millan
Hi,

Please consider this patch to stddef.h. GNU/kFreeBSD has the same
problem with __size_t as FreeBSD does, since it inherits many kernel
headers from FreeBSD.

-- 
Robert Millan
2012-01-29  Robert Millan  r...@gnu.org

* ginclude/stddef.h [__FreeBSD_kernel__] (__size_t): Do not define.

Index: ginclude/stddef.h
===
--- ginclude/stddef.h   (revision 183670)
+++ ginclude/stddef.h   (working copy)
@@ -200,7 +200,7 @@
 #define ___int_size_t_h
 #define _GCC_SIZE_T
 #define _SIZET_
-#if defined (__FreeBSD__)  (__FreeBSD__ = 5)
+#if (defined (__FreeBSD__)  (__FreeBSD__ = 5)) || 
defined(__FreeBSD_kernel__)
 /* __size_t is a typedef on FreeBSD 5!, must not trash it. */
 #else
 #define __size_t


Re: PING: Re: [PATCH] small build fix

2012-01-16 Thread Robert Millan
El 27 de desembre de 2011 12:25, Robert Millan r...@gnu.org ha escrit:
 El 19 de desembre de 2011 21:04, Robert Millan r...@gnu.org ha escrit:
 This small patch fixes a build regression on GNU/kFreeBSD.

 Ping!

Ping again.  Please note that Gerald Pfeifer has volunteered to commit
the patch once it is approved.

-- 
Robert Millan
2011-12-19  Robert Millan  r...@gnu.org

Fix build regression on GNU/kFreeBSD.

* config/kfreebsd-gnu.h (GNU_USER_DYNAMIC_LINKERX32): New macro.

--- a/src/gcc/config/kfreebsd-gnu.h~2011-07-21 17:31:44.0 +0200
+++ b/src/gcc/config/kfreebsd-gnu.h 2011-12-19 20:20:26.961301396 +0100
@@ -33,3 +33,4 @@
 #define GNU_USER_DYNAMIC_LINKERGLIBC_DYNAMIC_LINKER
 #define GNU_USER_DYNAMIC_LINKER32  GLIBC_DYNAMIC_LINKER32
 #define GNU_USER_DYNAMIC_LINKER64  GLIBC_DYNAMIC_LINKER64
+#define GNU_USER_DYNAMIC_LINKERX32 GLIBC_DYNAMIC_LINKERX32


[PATCH] small build fix

2011-12-19 Thread Robert Millan
This small patch fixes a build regression on GNU/kFreeBSD.

-- 
Robert Millan
2011-12-19  Robert Millan  r...@gnu.org

	Fix build regression on GNU/kFreeBSD.

	* config/kfreebsd-gnu.h (GNU_USER_DYNAMIC_LINKERX32): New macro.

--- a/src/gcc/config/kfreebsd-gnu.h~	2011-07-21 17:31:44.0 +0200
+++ b/src/gcc/config/kfreebsd-gnu.h	2011-12-19 20:20:26.961301396 +0100
@@ -33,3 +33,4 @@
 #define GNU_USER_DYNAMIC_LINKERGLIBC_DYNAMIC_LINKER
 #define GNU_USER_DYNAMIC_LINKER32  GLIBC_DYNAMIC_LINKER32
 #define GNU_USER_DYNAMIC_LINKER64  GLIBC_DYNAMIC_LINKER64
+#define GNU_USER_DYNAMIC_LINKERX32 GLIBC_DYNAMIC_LINKERX32


Re: [PATCH] GNU/kFreeBSD systems running on MIPS

2011-08-17 Thread Robert Millan
Hi!

2011/7/26 Rainer Orth r...@cebitec.uni-bielefeld.de:
 Robert,

 2011/7/25 Richard Sandiford rdsandif...@googlemail.com:
 Robert Millan r...@gnu.org writes:
 This patch adds support for GNU/kFreeBSD systems running on MIPS.

 Looks good.  However, Rainer's in the middle of moving things from gcc/
 to libgcc/ -- where they belong -- and committing a new port now would
 interfere with that.  If it's OK, I'd like to hold off applying this
 until Rainer's finished his changes.
 I'm in the middle of moving shlib support (another day), need to rebase
 crtstuff and libgcc1, and finish libgcc2.

My patch still applies cleanly to current HEAD, has this migration
happened already?  If not, what's the current ETA?  I'll have almost
no spare time after this week, I'd like to sort this out before/during
the weekend if possible.

Thanks!

-- 
Robert Millan


Re: [PATCH] GNU/kFreeBSD systems running on MIPS

2011-07-26 Thread Robert Millan
2011/7/25 Richard Sandiford rdsandif...@googlemail.com:
 Robert Millan r...@gnu.org writes:
 This patch adds support for GNU/kFreeBSD systems running on MIPS.

 Looks good.  However, Rainer's in the middle of moving things from gcc/
 to libgcc/ -- where they belong -- and committing a new port now would
 interfere with that.  If it's OK, I'd like to hold off applying this
 until Rainer's finished his changes.

It's ok.  Could you give a rough estimate? (few days / weeks / months)

-- 
Robert Millan


Re: [PATCH] GNU/kFreeBSD systems running on MIPS

2011-07-26 Thread Robert Millan
2011/7/26 Rainer Orth r...@cebitec.uni-bielefeld.de:
 I'm in the middle of moving shlib support (another day), need to rebase
 crtstuff and libgcc1, and finish libgcc2.

 I hope to be ready within two or three weeks.

Ok then.  I'd appreciate if you can send me a reminder via private
mail when you've finished.

Best regards

-- 
Robert Millan


[PATCH] GNU/kFreeBSD systems running on MIPS

2011-07-21 Thread Robert Millan
This patch adds support for GNU/kFreeBSD systems running on MIPS.

-- 
Robert Millan
2011-07-22  Robert Millan  r...@gnu.org

	Support for GNU/kFreeBSD systems running on MIPS.

	* config.gcc: Detect mips*-*-kfreebsd*-gnu.
	* config.host: Likewise.
	* config/mips/kfreebsd-gnu.h: New file.
	* config/mips/kfreebsd-gnu64.h: New file.
	* config/mips/gnu-user.h: Restrict `-march=native' support to GNU/Linux.

Index: libgcc/config.host
===
--- libgcc/config.host	(revision 176595)
+++ libgcc/config.host	(working copy)
@@ -478,6 +478,14 @@
 	tmake_file={$tmake_file} t-crtfm
 	md_unwind_header=mips/linux-unwind.h
 	;;
+mips64*-*-kfreebsd*-gnu)
+	extra_parts=$extra_parts crtfastmath.o
+	tmake_file={$tmake_file} t-crtfm
+	;;
+mips*-*-kfreebsd*-gnu)			# GNU/kFreeBSD MIPS, either endian.
+	extra_parts=$extra_parts crtfastmath.o
+	tmake_file={$tmake_file} t-crtfm
+	;;
 mips*-*-openbsd*)
 	;;
 mipsisa32-*-elf* | mipsisa32el-*-elf*)
Index: gcc/config.gcc
===
--- gcc/config.gcc	(revision 176595)
+++ gcc/config.gcc	(working copy)
@@ -1819,20 +1819,28 @@
 	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*)
-	tm_file=dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/gnu-user64.h mips/linux64.h
+mips64*-*-linux* | mipsisa64*-*-linux* | mips64*-*-kfreebsd*-gnu | mipsisa64*-*-kfreebsd*-gnu)
+	tm_file=dbxelf.h elfos.h gnu-user.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/gnu-user64.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
+		linux*)
+			tm_file=${tm_file} linux.h mips/linux64.h
+			;;
+		kfreebsd*-gnu)
+			tm_file=${tm_file} kfreebsd-gnu.h mips/kfreebsd-gnu64.h
+			;;
+	esac
 	case ${target} in
-		mips64el-st-linux-gnu)
+		mips64el-st-*)
 			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
@@ -1841,11 +1849,27 @@
 	gas=yes
 	test x$with_llsc != x || with_llsc=yes
 	;;
-mips*-*-linux*)# Linux MIPS, either endian.
-tm_file=dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/linux.h
+mips*-*-linux* | mips*-*-kfreebsd*-gnu)			# GNU/* MIPS, either endian.
+tm_file=dbxelf.h elfos.h gnu-user.h glibc-stdint.h ${tm_file} mips/gnu-user.h
 	tmake_file=${tmake_file} mips/t-libgcc-mips16
+	case ${target_os} in
+		linux*)
+			tm_file=${tm_file} linux.h mips/linux.h
+			;;
+		kfreebsd*-gnu)
+			tm_file=${tm_file} kfreebsd-gnu.h mips/kfreebsd-gnu.h
+			;;
+	esac
 	if test x$enable_targets = xall; then
-		tm_file=${tm_file} mips/gnu-user64.h mips/linux64.h
+		tm_file=${tm_file} mips/gnu-user64.h
+		case ${target_os} in
+			linux*)
+tm_file=${tm_file} mips/linux64.h
+;;
+			kfreebsd*-gnu)
+tm_file=${tm_file} mips/kfreebsd-gnu64.h
+;;
+		esac
 		tmake_file=${tmake_file} mips/t-linux64
 		tm_defines=${tm_defines} MIPS_ABI_DEFAULT=ABI_32
 	fi
Index: gcc/config/mips/gnu-user.h
===
--- gcc/config/mips/gnu-user.h	(revision 176595)
+++ gcc/config/mips/gnu-user.h	(working copy)
@@ -106,8 +106,8 @@
 #endif
 
 /* -march=native handling only makes sense with compiler running on
-   a MIPS chip.  */
-#if defined(__mips__)
+   a MIPS chip.  Also, for now only Linux targets are supported.  */
+#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 },
Index: gcc/config/mips/kfreebsd-gnu64.h
===
--- gcc/config/mips/kfreebsd-gnu64.h	(revision 0)
+++ gcc/config/mips/kfreebsd-gnu64.h	(revision 0)
@@ -0,0 +1,31 @@
+/* Definitions for MIPS running kFreeBSD-based GNU systems with ELF format
+   using n32/64 abi.
+   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

[PATCH] split mips/gnu-user.h from mips/linux.h

2011-07-19 Thread Robert Millan
Hi!

This patch splits those bits from:

config/mips/linux.h
config/mips/linux64.h

which are applicable to GNU userland, into:

config/mips/gnu-user.h
config/mips/gnu-user64

respectively.  It is analogous to the split that was performed for
config/i386/* by Joseph Myers in r172271.

I've verified that my patch doesn't cause any regression (resulting
gcc/xgcc is identical both for mips-*-linux and mips64*-linux).

-- 
Robert Millan
2011-07-19  Robert Millan  r...@gnu.org

	* config/mips/gnu-user.h: Copy from linux.h.  Update comments.
	(GLIBC_DYNAMIC_LINKER): Remove.

	* config/mips/gnu-user64.h: Copy from linux64.h.  Update comments.
	(GLIBC_DYNAMIC_LINKER32, GLIBC_DYNAMIC_LINKER64)
	(GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32)
	(BIONIC_DYNAMIC_LINKERN32, GNU_USER_DYNAMIC_LINKERN32): Remove.
	(LINK_SPEC): Use GNU_USER_DYNAMIC_LINKER32,
	GNU_USER_DYNAMIC_LINKER64 and GNU_USER_LINK_EMULATIONN32.

	* config/mips/linux.h: Remove everything except for ...
	(GLIBC_DYNAMIC_LINKER): ... this macro.

	* config/mips/linux64.h: Remove everything except for ...
	(GLIBC_DYNAMIC_LINKER32, GLIBC_DYNAMIC_LINKER64)
	(GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32)
	(BIONIC_DYNAMIC_LINKERN32): ... these macros.
	(GNU_USER_LINK_EMULATION32, GNU_USER_LINK_EMULATION64)
	(GNU_USER_LINK_EMULATIONN32): New macros.

	* config.gcc (mips64*-*-linux* | mipsisa64*-*-linux* |
	mips-*-linux*): Use the new headers.

Index: gcc/config.gcc
===
--- gcc/config.gcc	(revision 176425)
+++ gcc/config.gcc	(working copy)
@@ -1820,7 +1820,7 @@
 	extra_options=${extra_options} netbsd.opt netbsd-elf.opt
 	;;
 mips64*-*-linux* | mipsisa64*-*-linux*)
-	tm_file=dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} mips/linux.h mips/linux64.h
+	tm_file=dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/gnu-user64.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} in
@@ -1842,7 +1842,7 @@
 	test x$with_llsc != x || with_llsc=yes
 	;;
 mips*-*-linux*)# Linux MIPS, either endian.
-tm_file=dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} mips/linux.h
+tm_file=dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/linux.h
 	tmake_file=${tmake_file} mips/t-libgcc-mips16
 	if test x$enable_targets = xall; then
 		tm_file=${tm_file} mips/linux64.h
Index: gcc/config/mips/linux.h
===
--- gcc/config/mips/linux.h	(revision 176425)
+++ gcc/config/mips/linux.h	(working copy)
@@ -1,6 +1,5 @@
 /* Definitions for MIPS running Linux-based GNU systems with ELF format.
-   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
-   2007, 2008, 2010, 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -18,125 +17,4 @@
 along with GCC; see the file COPYING3.  If not see
 http://www.gnu.org/licenses/.  */
 
-#undef WCHAR_TYPE
-#define WCHAR_TYPE int
-
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE 32
-
-#undef ASM_DECLARE_OBJECT_NAME
-#define ASM_DECLARE_OBJECT_NAME mips_declare_object_name
-
-/* If we don't set MASK_ABICALLS, we can't default to PIC.  */
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT MASK_ABICALLS
-
-#define TARGET_OS_CPP_BUILTINS()\
-  do {\
-GNU_USER_TARGET_OS_CPP_BUILTINS();\
-/* The GNU C++ standard library requires this.  */		\
-if (c_dialect_cxx ())	\
-  builtin_define (_GNU_SOURCE);\
-  } while (0)
-
-#undef SUBTARGET_CPP_SPEC
-#define SUBTARGET_CPP_SPEC %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}
-
-/* A standard GNU/Linux mapping.  On most targets, it is included in
-   CC1_SPEC itself by config/linux.h, but mips.h overrides CC1_SPEC
-   and provides this hook instead.  */
-#undef SUBTARGET_CC1_SPEC
-#define SUBTARGET_CC1_SPEC %{profile:-p}
-
-/* From iris5.h */
-/* -G is incompatible with -KPIC which is the default, so only allow objects
-   in the small data section if the user explicitly asks for it.  */
-#undef MIPS_DEFAULT_GVALUE
-#define MIPS_DEFAULT_GVALUE 0
-
 #define GLIBC_DYNAMIC_LINKER /lib/ld.so.1
-
-/* Borrowed from sparc/linux.h */
-#undef LINK_SPEC
-#define LINK_SPEC \
- %(endian_spec) \
-  %{shared:-shared} \
-  %{!shared: \
-%{!static: \
-  %{rdynamic:-export-dynamic} \
-  -dynamic-linker  GNU_USER_DYNAMIC_LINKER } \
-  %{static:-static}}
-
-#undef SUBTARGET_ASM_SPEC
-#define SUBTARGET_ASM_SPEC \
-  %{!mno-abicalls:%{mplt:-call_nonpic;:-KPIC}}
-
-/* The MIPS assembler has different syntax for .set. We set it to
-   .dummy to trap any errors.  */
-#undef SET_ASM_OP
-#define SET_ASM_OP \t.dummy\t
-
-#undef ASM_OUTPUT_DEF
-#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2)\
- do {	\
-	fputc ( '\t', FILE);		\
-	assemble_name (FILE, LABEL1

Re: [PATCH] split mips/gnu-user.h from mips/linux.h

2011-07-19 Thread Robert Millan
Hi Richard,

Thanks for committing!  Just one small note:

2011/7/19 Richard Sandiford rdsandif...@googlemail.com:
 needs to deal with linux64.h as well.  I also kept the copyright notice
 the same on linux.h (even though it's only a one-liner now).

 Applied with those changes, thanks.

It's probably harmless, but with this change if --enable-targets=all
is used, then mips/gnu-user.h is included twice.  The second one can
be removed.

-- 
Robert Millan


PING^4 APPROVED patch for AMD64 targets running GNU/kFreeBSD, anyone?

2011-06-14 Thread Robert Millan
This patch for AMD64 targets running GNU/kFreeBSD has been approved
already, would anyone be so kind to commit it?  I'm afraid I don't have
write perms currently.

See: http://gcc.gnu.org/ml/gcc-patches/2011-06/msg00884.html

Thank you very much :-)

2011/6/10 Richard Henderson r...@redhat.com:
 On 06/10/2011 01:59 PM, Robert Millan wrote:
 2011-06-02  Robert Millan  r...@gnu.org

   * config/i386/kfreebsd-gnu.h: Resync with `config/i386/linux.h'.
   * config/kfreebsd-gnu.h (GNU_USER_DYNAMIC_LINKER): Resync with
   `config/linux.h'.

   * config/i386/kfreebsd-gnu64.h: New file.
   * config.gcc (x86_64-*-kfreebsd*-gnu): Replace `i386/kfreebsd-gnu.h'
   with `i386/kfreebsd-gnu64.h'.

   * config/i386/linux64.h (GNU_USER_LINK_EMULATION32)
   (GNU_USER_LINK_EMULATION64): New macros.
   * config/i386/gnu-user64.h (LINK_SPEC): Rely on
   `GNU_USER_LINK_EMULATION32' and `GNU_USER_LINK_EMULATION64' instead
   of hardcoding `elf_i386' and `elf_x86_64'.

 Ok.


 r~


-- 
Robert Millan
2011-06-02  Robert Millan  r...@gnu.org

* config/i386/kfreebsd-gnu.h: Resync with `config/i386/linux.h'.
* config/kfreebsd-gnu.h (GNU_USER_DYNAMIC_LINKER): Resync with
`config/linux.h'.

* config/i386/kfreebsd-gnu64.h: New file.
* config.gcc (x86_64-*-kfreebsd*-gnu): Replace `i386/kfreebsd-gnu.h'
with `i386/kfreebsd-gnu64.h'.

* config/i386/linux64.h (GNU_USER_LINK_EMULATION32)
(GNU_USER_LINK_EMULATION64): New macros.
* config/i386/gnu-user64.h (LINK_SPEC): Rely on
`GNU_USER_LINK_EMULATION32' and `GNU_USER_LINK_EMULATION64' instead
of hardcoding `elf_i386' and `elf_x86_64'.

Index: gcc/config/i386/kfreebsd-gnu64.h
===
--- gcc/config/i386/kfreebsd-gnu64.h(revision 0)
+++ gcc/config/i386/kfreebsd-gnu64.h(revision 0)
@@ -0,0 +1,26 @@
+/* Definitions for AMD x86-64 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
+http://www.gnu.org/licenses/.  */
+
+#define GNU_USER_LINK_EMULATION32 elf_i386_fbsd
+#define GNU_USER_LINK_EMULATION64 elf_x86_64_fbsd
+
+#define GLIBC_DYNAMIC_LINKER32 /lib/ld.so.1
+#define GLIBC_DYNAMIC_LINKER64 /lib/ld-kfreebsd-x86-64.so.1
Index: gcc/config/i386/kfreebsd-gnu.h
===
--- gcc/config/i386/kfreebsd-gnu.h  (revision 174566)
+++ gcc/config/i386/kfreebsd-gnu.h  (working copy)
@@ -1,5 +1,5 @@
 /* Definitions for Intel 386 running kFreeBSD-based GNU systems with ELF format
-   Copyright (C) 2004, 2007, 2011
+   Copyright (C) 2011
Free Software Foundation, Inc.
Contributed by Robert Millan.
 
@@ -19,11 +19,5 @@
 along with GCC; see the file COPYING3.  If not see
 http://www.gnu.org/licenses/.  */
 
-#undef GNU_USER_LINK_EMULATION
 #define GNU_USER_LINK_EMULATION elf_i386_fbsd
-
-#undef GNU_USER_DYNAMIC_LINKER32
-#define GNU_USER_DYNAMIC_LINKER32 /lib/ld.so.1
-
-#undef GNU_USER_DYNAMIC_LINKER64
-#define GNU_USER_DYNAMIC_LINKER64 /lib/ld-kfreebsd-x86-64.so.1
+#define GLIBC_DYNAMIC_LINKER /lib/ld.so.1
Index: gcc/config/i386/linux64.h
===
--- gcc/config/i386/linux64.h   (revision 174566)
+++ gcc/config/i386/linux64.h   (working copy)
@@ -24,6 +24,9 @@
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 http://www.gnu.org/licenses/.  */
 
+#define GNU_USER_LINK_EMULATION32 elf_i386
+#define GNU_USER_LINK_EMULATION64 elf_x86_64
+
 #define GLIBC_DYNAMIC_LINKER32 /lib/ld-linux.so.2
 #define GLIBC_DYNAMIC_LINKER64 /lib64/ld-linux-x86-64.so.2
 
Index: gcc/config/i386/gnu-user64.h
===
--- gcc/config/i386/gnu-user64.h(revision 174566)
+++ gcc/config/i386/gnu-user64.h(working copy)
@@ -69,7 +69,8 @@
  %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}
 
 #undef LINK_SPEC
-#define LINK_SPEC %{ SPEC_64 :-m elf_x86_64} %{ SPEC_32 :-m elf_i386} \
+#define LINK_SPEC %{ SPEC_64 :-m  GNU_USER_LINK_EMULATION64 } \
+   %{ SPEC_32 :-m  GNU_USER_LINK_EMULATION32 } \
   %{shared:-shared} \
   %{!shared: \
 %{!static: \
Index: gcc/config/kfreebsd-gnu.h

PING^4 APPROVED patch for AMD64 targets running GNU/kFreeBSD, anyone?

2011-06-14 Thread Robert Millan
This patch for AMD64 targets running GNU/kFreeBSD has been approved
already, would anyone be so kind to commit it?  I'm afraid I don't have
write perms currently.

See: http://gcc.gnu.org/ml/gcc-patches/2011-06/msg00884.html

Thank you very much :-)

2011/6/10 Richard Henderson r...@redhat.com:
 On 06/10/2011 01:59 PM, Robert Millan wrote:
 2011-06-02  Robert Millan  r...@gnu.org

   * config/i386/kfreebsd-gnu.h: Resync with `config/i386/linux.h'.
   * config/kfreebsd-gnu.h (GNU_USER_DYNAMIC_LINKER): Resync with
   `config/linux.h'.

   * config/i386/kfreebsd-gnu64.h: New file.
   * config.gcc (x86_64-*-kfreebsd*-gnu): Replace `i386/kfreebsd-gnu.h'
   with `i386/kfreebsd-gnu64.h'.

   * config/i386/linux64.h (GNU_USER_LINK_EMULATION32)
   (GNU_USER_LINK_EMULATION64): New macros.
   * config/i386/gnu-user64.h (LINK_SPEC): Rely on
   `GNU_USER_LINK_EMULATION32' and `GNU_USER_LINK_EMULATION64' instead
   of hardcoding `elf_i386' and `elf_x86_64'.

 Ok.


 r~


-- 
Robert Millan
2011-06-02  Robert Millan  r...@gnu.org

* config/i386/kfreebsd-gnu.h: Resync with `config/i386/linux.h'.
* config/kfreebsd-gnu.h (GNU_USER_DYNAMIC_LINKER): Resync with
`config/linux.h'.

* config/i386/kfreebsd-gnu64.h: New file.
* config.gcc (x86_64-*-kfreebsd*-gnu): Replace `i386/kfreebsd-gnu.h'
with `i386/kfreebsd-gnu64.h'.

* config/i386/linux64.h (GNU_USER_LINK_EMULATION32)
(GNU_USER_LINK_EMULATION64): New macros.
* config/i386/gnu-user64.h (LINK_SPEC): Rely on
`GNU_USER_LINK_EMULATION32' and `GNU_USER_LINK_EMULATION64' instead
of hardcoding `elf_i386' and `elf_x86_64'.

Index: gcc/config/i386/kfreebsd-gnu64.h
===
--- gcc/config/i386/kfreebsd-gnu64.h(revision 0)
+++ gcc/config/i386/kfreebsd-gnu64.h(revision 0)
@@ -0,0 +1,26 @@
+/* Definitions for AMD x86-64 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
+http://www.gnu.org/licenses/.  */
+
+#define GNU_USER_LINK_EMULATION32 elf_i386_fbsd
+#define GNU_USER_LINK_EMULATION64 elf_x86_64_fbsd
+
+#define GLIBC_DYNAMIC_LINKER32 /lib/ld.so.1
+#define GLIBC_DYNAMIC_LINKER64 /lib/ld-kfreebsd-x86-64.so.1
Index: gcc/config/i386/kfreebsd-gnu.h
===
--- gcc/config/i386/kfreebsd-gnu.h  (revision 174566)
+++ gcc/config/i386/kfreebsd-gnu.h  (working copy)
@@ -1,5 +1,5 @@
 /* Definitions for Intel 386 running kFreeBSD-based GNU systems with ELF format
-   Copyright (C) 2004, 2007, 2011
+   Copyright (C) 2011
Free Software Foundation, Inc.
Contributed by Robert Millan.
 
@@ -19,11 +19,5 @@
 along with GCC; see the file COPYING3.  If not see
 http://www.gnu.org/licenses/.  */
 
-#undef GNU_USER_LINK_EMULATION
 #define GNU_USER_LINK_EMULATION elf_i386_fbsd
-
-#undef GNU_USER_DYNAMIC_LINKER32
-#define GNU_USER_DYNAMIC_LINKER32 /lib/ld.so.1
-
-#undef GNU_USER_DYNAMIC_LINKER64
-#define GNU_USER_DYNAMIC_LINKER64 /lib/ld-kfreebsd-x86-64.so.1
+#define GLIBC_DYNAMIC_LINKER /lib/ld.so.1
Index: gcc/config/i386/linux64.h
===
--- gcc/config/i386/linux64.h   (revision 174566)
+++ gcc/config/i386/linux64.h   (working copy)
@@ -24,6 +24,9 @@
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 http://www.gnu.org/licenses/.  */
 
+#define GNU_USER_LINK_EMULATION32 elf_i386
+#define GNU_USER_LINK_EMULATION64 elf_x86_64
+
 #define GLIBC_DYNAMIC_LINKER32 /lib/ld-linux.so.2
 #define GLIBC_DYNAMIC_LINKER64 /lib64/ld-linux-x86-64.so.2
 
Index: gcc/config/i386/gnu-user64.h
===
--- gcc/config/i386/gnu-user64.h(revision 174566)
+++ gcc/config/i386/gnu-user64.h(working copy)
@@ -69,7 +69,8 @@
  %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}
 
 #undef LINK_SPEC
-#define LINK_SPEC %{ SPEC_64 :-m elf_x86_64} %{ SPEC_32 :-m elf_i386} \
+#define LINK_SPEC %{ SPEC_64 :-m  GNU_USER_LINK_EMULATION64 } \
+   %{ SPEC_32 :-m  GNU_USER_LINK_EMULATION32 } \
   %{shared:-shared} \
   %{!shared: \
 %{!static: \
Index: gcc/config/kfreebsd-gnu.h

PING^3 [PATCH] Support for AMD64 targets running GNU/kFreeBSD

2011-06-10 Thread Robert Millan
Please someone look at this if you have time.  The patch is very small now.

2011/6/3 Robert Millan r...@gnu.org:
 Actually, please consider this patch instead.  It's the same but fixes a
 mistake in ld.so pathname.

 2011/6/2 Robert Millan r...@gnu.org:
 Hi,

 2011/5/21 Joseph S. Myers jos...@codesourcery.com:
 Please send a patch against *current trunk* and CC *relevant target
 architecture maintainers*.  linux*.h headers are no longer used on
 non-Linux targets (since my 2011-04-28 patch - on which I CC:ed you) so
 this patch version is no longer appropriate.  I think you'll want to make
 gnu-user64.h use GNU_USER_LINK_EMULATION32 and GNU_USER_LINK_EMULATION64
 similarly to how gnu-user.h uses GNU_USER_LINK_EMULATION.

 Thanks for the tip.  Here's an update to current trunk.

 --
 Robert Millan




 --
 Robert Millan




-- 
Robert Millan
2011-06-02  Robert Millan  r...@gnu.org

* config/i386/kfreebsd-gnu.h: Resync with `config/i386/linux.h'.
* config/kfreebsd-gnu.h (GNU_USER_DYNAMIC_LINKER): Resync with
`config/linux.h'.

* config/i386/kfreebsd-gnu64.h: New file.
* config.gcc (x86_64-*-kfreebsd*-gnu): Replace `i386/kfreebsd-gnu.h'
with `i386/kfreebsd-gnu64.h'.

* config/i386/linux64.h (GNU_USER_LINK_EMULATION32)
(GNU_USER_LINK_EMULATION64): New macros.
* config/i386/gnu-user64.h (LINK_SPEC): Rely on
`GNU_USER_LINK_EMULATION32' and `GNU_USER_LINK_EMULATION64' instead
of hardcoding `elf_i386' and `elf_x86_64'.

Index: gcc/config/i386/kfreebsd-gnu64.h
===
--- gcc/config/i386/kfreebsd-gnu64.h(revision 0)
+++ gcc/config/i386/kfreebsd-gnu64.h(revision 0)
@@ -0,0 +1,26 @@
+/* Definitions for AMD x86-64 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
+http://www.gnu.org/licenses/.  */
+
+#define GNU_USER_LINK_EMULATION32 elf_i386_fbsd
+#define GNU_USER_LINK_EMULATION64 elf_x86_64_fbsd
+
+#define GLIBC_DYNAMIC_LINKER32 /lib/ld.so.1
+#define GLIBC_DYNAMIC_LINKER64 /lib/ld-kfreebsd-x86-64.so.1
Index: gcc/config/i386/kfreebsd-gnu.h
===
--- gcc/config/i386/kfreebsd-gnu.h  (revision 174566)
+++ gcc/config/i386/kfreebsd-gnu.h  (working copy)
@@ -1,5 +1,5 @@
 /* Definitions for Intel 386 running kFreeBSD-based GNU systems with ELF format
-   Copyright (C) 2004, 2007, 2011
+   Copyright (C) 2011
Free Software Foundation, Inc.
Contributed by Robert Millan.
 
@@ -19,11 +19,5 @@
 along with GCC; see the file COPYING3.  If not see
 http://www.gnu.org/licenses/.  */
 
-#undef GNU_USER_LINK_EMULATION
 #define GNU_USER_LINK_EMULATION elf_i386_fbsd
-
-#undef GNU_USER_DYNAMIC_LINKER32
-#define GNU_USER_DYNAMIC_LINKER32 /lib/ld.so.1
-
-#undef GNU_USER_DYNAMIC_LINKER64
-#define GNU_USER_DYNAMIC_LINKER64 /lib/ld-kfreebsd-x86-64.so.1
+#define GLIBC_DYNAMIC_LINKER /lib/ld.so.1
Index: gcc/config/i386/linux64.h
===
--- gcc/config/i386/linux64.h   (revision 174566)
+++ gcc/config/i386/linux64.h   (working copy)
@@ -24,6 +24,9 @@
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 http://www.gnu.org/licenses/.  */
 
+#define GNU_USER_LINK_EMULATION32 elf_i386
+#define GNU_USER_LINK_EMULATION64 elf_x86_64
+
 #define GLIBC_DYNAMIC_LINKER32 /lib/ld-linux.so.2
 #define GLIBC_DYNAMIC_LINKER64 /lib64/ld-linux-x86-64.so.2
 
Index: gcc/config/i386/gnu-user64.h
===
--- gcc/config/i386/gnu-user64.h(revision 174566)
+++ gcc/config/i386/gnu-user64.h(working copy)
@@ -69,7 +69,8 @@
  %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}
 
 #undef LINK_SPEC
-#define LINK_SPEC %{ SPEC_64 :-m elf_x86_64} %{ SPEC_32 :-m elf_i386} \
+#define LINK_SPEC %{ SPEC_64 :-m  GNU_USER_LINK_EMULATION64 } \
+   %{ SPEC_32 :-m  GNU_USER_LINK_EMULATION32 } \
   %{shared:-shared} \
   %{!shared: \
 %{!static: \
Index: gcc/config/kfreebsd-gnu.h
===
--- gcc/config/kfreebsd-gnu.h   (revision 174566)
+++ gcc/config/kfreebsd-gnu.h   (working copy)
@@ -19,7 +19,6 @@
 along with GCC; see the file

Re: PING^3 [PATCH] Support for AMD64 targets running GNU/kFreeBSD

2011-06-10 Thread Robert Millan
2011/6/10 Richard Henderson r...@redhat.com:
 On 06/10/2011 01:59 PM, Robert Millan wrote:
 2011-06-02  Robert Millan  r...@gnu.org

       * config/i386/kfreebsd-gnu.h: Resync with `config/i386/linux.h'.
       * config/kfreebsd-gnu.h (GNU_USER_DYNAMIC_LINKER): Resync with
       `config/linux.h'.

       * config/i386/kfreebsd-gnu64.h: New file.
       * config.gcc (x86_64-*-kfreebsd*-gnu): Replace `i386/kfreebsd-gnu.h'
       with `i386/kfreebsd-gnu64.h'.

       * config/i386/linux64.h (GNU_USER_LINK_EMULATION32)
       (GNU_USER_LINK_EMULATION64): New macros.
       * config/i386/gnu-user64.h (LINK_SPEC): Rely on
       `GNU_USER_LINK_EMULATION32' and `GNU_USER_LINK_EMULATION64' instead
       of hardcoding `elf_i386' and `elf_x86_64'.

 Ok.

Thanks.  Please could you commit?  I don't have write-after-approval perms.

-- 
Robert Millan


Re: PING^2 [PATCH] Support for AMD64 targets running GNU/kFreeBSD

2011-06-03 Thread Robert Millan
Actually, please consider this patch instead.  It's the same but fixes a
mistake in ld.so pathname.

2011/6/2 Robert Millan r...@gnu.org:
 Hi,

 2011/5/21 Joseph S. Myers jos...@codesourcery.com:
 Please send a patch against *current trunk* and CC *relevant target
 architecture maintainers*.  linux*.h headers are no longer used on
 non-Linux targets (since my 2011-04-28 patch - on which I CC:ed you) so
 this patch version is no longer appropriate.  I think you'll want to make
 gnu-user64.h use GNU_USER_LINK_EMULATION32 and GNU_USER_LINK_EMULATION64
 similarly to how gnu-user.h uses GNU_USER_LINK_EMULATION.

 Thanks for the tip.  Here's an update to current trunk.

 --
 Robert Millan




-- 
Robert Millan
2011-06-02  Robert Millan  r...@gnu.org

* config/i386/kfreebsd-gnu.h: Resync with `config/i386/linux.h'.
* config/kfreebsd-gnu.h (GNU_USER_DYNAMIC_LINKER): Resync with
`config/linux.h'.

* config/i386/kfreebsd-gnu64.h: New file.
* config.gcc (x86_64-*-kfreebsd*-gnu): Replace `i386/kfreebsd-gnu.h'
with `i386/kfreebsd-gnu64.h'.

* config/i386/linux64.h (GNU_USER_LINK_EMULATION32)
(GNU_USER_LINK_EMULATION64): New macros.
* config/i386/gnu-user64.h (LINK_SPEC): Rely on
`GNU_USER_LINK_EMULATION32' and `GNU_USER_LINK_EMULATION64' instead
of hardcoding `elf_i386' and `elf_x86_64'.

Index: gcc/config/i386/kfreebsd-gnu64.h
===
--- gcc/config/i386/kfreebsd-gnu64.h(revision 0)
+++ gcc/config/i386/kfreebsd-gnu64.h(revision 0)
@@ -0,0 +1,26 @@
+/* Definitions for AMD x86-64 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
+http://www.gnu.org/licenses/.  */
+
+#define GNU_USER_LINK_EMULATION32 elf_i386_fbsd
+#define GNU_USER_LINK_EMULATION64 elf_x86_64_fbsd
+
+#define GLIBC_DYNAMIC_LINKER32 /lib/ld.so.1
+#define GLIBC_DYNAMIC_LINKER64 /lib/ld-kfreebsd-x86-64.so.1
Index: gcc/config/i386/kfreebsd-gnu.h
===
--- gcc/config/i386/kfreebsd-gnu.h  (revision 174566)
+++ gcc/config/i386/kfreebsd-gnu.h  (working copy)
@@ -1,5 +1,5 @@
 /* Definitions for Intel 386 running kFreeBSD-based GNU systems with ELF format
-   Copyright (C) 2004, 2007, 2011
+   Copyright (C) 2011
Free Software Foundation, Inc.
Contributed by Robert Millan.
 
@@ -19,11 +19,5 @@
 along with GCC; see the file COPYING3.  If not see
 http://www.gnu.org/licenses/.  */
 
-#undef GNU_USER_LINK_EMULATION
 #define GNU_USER_LINK_EMULATION elf_i386_fbsd
-
-#undef GNU_USER_DYNAMIC_LINKER32
-#define GNU_USER_DYNAMIC_LINKER32 /lib/ld.so.1
-
-#undef GNU_USER_DYNAMIC_LINKER64
-#define GNU_USER_DYNAMIC_LINKER64 /lib/ld-kfreebsd-x86-64.so.1
+#define GLIBC_DYNAMIC_LINKER /lib/ld.so.1
Index: gcc/config/i386/linux64.h
===
--- gcc/config/i386/linux64.h   (revision 174566)
+++ gcc/config/i386/linux64.h   (working copy)
@@ -24,6 +24,9 @@
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 http://www.gnu.org/licenses/.  */
 
+#define GNU_USER_LINK_EMULATION32 elf_i386
+#define GNU_USER_LINK_EMULATION64 elf_x86_64
+
 #define GLIBC_DYNAMIC_LINKER32 /lib/ld-linux.so.2
 #define GLIBC_DYNAMIC_LINKER64 /lib64/ld-linux-x86-64.so.2
 
Index: gcc/config/i386/gnu-user64.h
===
--- gcc/config/i386/gnu-user64.h(revision 174566)
+++ gcc/config/i386/gnu-user64.h(working copy)
@@ -69,7 +69,8 @@
  %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}
 
 #undef LINK_SPEC
-#define LINK_SPEC %{ SPEC_64 :-m elf_x86_64} %{ SPEC_32 :-m elf_i386} \
+#define LINK_SPEC %{ SPEC_64 :-m  GNU_USER_LINK_EMULATION64 } \
+   %{ SPEC_32 :-m  GNU_USER_LINK_EMULATION32 } \
   %{shared:-shared} \
   %{!shared: \
 %{!static: \
Index: gcc/config/kfreebsd-gnu.h
===
--- gcc/config/kfreebsd-gnu.h   (revision 174566)
+++ gcc/config/kfreebsd-gnu.h   (working copy)
@@ -19,7 +19,6 @@
 along with GCC; see the file COPYING3.  If not see
 http://www.gnu.org/licenses/.  */
 
-#undef GNU_USER_TARGET_OS_CPP_BUILTINS
 #define

Re: PING^2 [PATCH] Support for AMD64 targets running GNU/kFreeBSD

2011-06-02 Thread Robert Millan
Hi,

2011/5/21 Joseph S. Myers jos...@codesourcery.com:
 Please send a patch against *current trunk* and CC *relevant target
 architecture maintainers*.  linux*.h headers are no longer used on
 non-Linux targets (since my 2011-04-28 patch - on which I CC:ed you) so
 this patch version is no longer appropriate.  I think you'll want to make
 gnu-user64.h use GNU_USER_LINK_EMULATION32 and GNU_USER_LINK_EMULATION64
 similarly to how gnu-user.h uses GNU_USER_LINK_EMULATION.

Thanks for the tip.  Here's an update to current trunk.

-- 
Robert Millan
2011-06-02  Robert Millan  r...@gnu.org

* config/i386/kfreebsd-gnu.h: Resync with `config/i386/linux.h'.
* config/kfreebsd-gnu.h (GNU_USER_DYNAMIC_LINKER): Resync with
`config/linux.h'.

* config/i386/kfreebsd-gnu64.h: New file.
* config.gcc (x86_64-*-kfreebsd*-gnu): Replace `i386/kfreebsd-gnu.h'
with `i386/kfreebsd-gnu64.h'.

* config/i386/linux64.h (GNU_USER_LINK_EMULATION32)
(GNU_USER_LINK_EMULATION64): New macros.
* config/i386/gnu-user64.h (LINK_SPEC): Rely on
`GNU_USER_LINK_EMULATION32' and `GNU_USER_LINK_EMULATION64' instead
of hardcoding `elf_i386' and `elf_x86_64'.

Index: gcc/config/i386/kfreebsd-gnu64.h
===
--- gcc/config/i386/kfreebsd-gnu64.h(revision 0)
+++ gcc/config/i386/kfreebsd-gnu64.h(revision 0)
@@ -0,0 +1,26 @@
+/* Definitions for AMD x86-64 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
+http://www.gnu.org/licenses/.  */
+
+#define GNU_USER_LINK_EMULATION32 elf_i386_fbsd
+#define GNU_USER_LINK_EMULATION64 elf_x86_64_fbsd
+
+#define GLIBC_DYNAMIC_LINKER32 /lib/ld.so.1
+#define GLIBC_DYNAMIC_LINKER64 /lib64/ld-kfreebsd-x86-64.so.1
Index: gcc/config/i386/kfreebsd-gnu.h
===
--- gcc/config/i386/kfreebsd-gnu.h  (revision 174566)
+++ gcc/config/i386/kfreebsd-gnu.h  (working copy)
@@ -1,5 +1,5 @@
 /* Definitions for Intel 386 running kFreeBSD-based GNU systems with ELF format
-   Copyright (C) 2004, 2007, 2011
+   Copyright (C) 2011
Free Software Foundation, Inc.
Contributed by Robert Millan.
 
@@ -19,11 +19,5 @@
 along with GCC; see the file COPYING3.  If not see
 http://www.gnu.org/licenses/.  */
 
-#undef GNU_USER_LINK_EMULATION
 #define GNU_USER_LINK_EMULATION elf_i386_fbsd
-
-#undef GNU_USER_DYNAMIC_LINKER32
-#define GNU_USER_DYNAMIC_LINKER32 /lib/ld.so.1
-
-#undef GNU_USER_DYNAMIC_LINKER64
-#define GNU_USER_DYNAMIC_LINKER64 /lib/ld-kfreebsd-x86-64.so.1
+#define GLIBC_DYNAMIC_LINKER /lib/ld.so.1
Index: gcc/config/i386/linux64.h
===
--- gcc/config/i386/linux64.h   (revision 174566)
+++ gcc/config/i386/linux64.h   (working copy)
@@ -24,6 +24,9 @@
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 http://www.gnu.org/licenses/.  */
 
+#define GNU_USER_LINK_EMULATION32 elf_i386
+#define GNU_USER_LINK_EMULATION64 elf_x86_64
+
 #define GLIBC_DYNAMIC_LINKER32 /lib/ld-linux.so.2
 #define GLIBC_DYNAMIC_LINKER64 /lib64/ld-linux-x86-64.so.2
 
Index: gcc/config/i386/gnu-user64.h
===
--- gcc/config/i386/gnu-user64.h(revision 174566)
+++ gcc/config/i386/gnu-user64.h(working copy)
@@ -69,7 +69,8 @@
  %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}
 
 #undef LINK_SPEC
-#define LINK_SPEC %{ SPEC_64 :-m elf_x86_64} %{ SPEC_32 :-m elf_i386} \
+#define LINK_SPEC %{ SPEC_64 :-m  GNU_USER_LINK_EMULATION64 } \
+   %{ SPEC_32 :-m  GNU_USER_LINK_EMULATION32 } \
   %{shared:-shared} \
   %{!shared: \
 %{!static: \
Index: gcc/config/kfreebsd-gnu.h
===
--- gcc/config/kfreebsd-gnu.h   (revision 174566)
+++ gcc/config/kfreebsd-gnu.h   (working copy)
@@ -19,7 +19,6 @@
 along with GCC; see the file COPYING3.  If not see
 http://www.gnu.org/licenses/.  */
 
-#undef GNU_USER_TARGET_OS_CPP_BUILTINS
 #define GNU_USER_TARGET_OS_CPP_BUILTINS()  \
   do   \
 {  \
@@ -31,5 +30,6

PING^2 [PATCH] Support for AMD64 targets running GNU/kFreeBSD

2011-05-21 Thread Robert Millan
Please can this patch be considered? It's several months old (sent in
Jan 2011), and it is critical to use of GCC on GNU/kFreeBSD.

2011/1/26 Robert Millan r...@gnu.org:
 Ping!

 2011/1/18 Robert Millan r...@gnu.org:
 2011/1/14 Robert Millan r...@gnu.org:
 2011/1/12 Robert Millan r...@gnu.org:
 * The headers config/kfreebsd-gnu.h etc. override
  GLIBC_DYNAMIC_LINKER.  But the 64-bit configurations
  x86_64-*-kfreebsd*-gnu and x86_64-*-knetbsd*-gnu do not appear to
  use any header that would override GLIBC_DYNAMIC_LINKER32 and
  GLIBC_DYNAMIC_LINKER64, which are what LINK_SPEC in linux64.h
  actually uses.  Thus those configurations would use Linux-specific
  dynamic linker settings, which seems unlikely to be as intended.

 It's not as intended. On amd64 we use /lib/ld.so.1 and
 /lib/ld-kfreebsd-x86-64.so.1.

 It seems x86_64-kfreebsd-gnu has been broken for a while.  I
 just realized that I wrote a patch to fix this in 2006 [1], but
 somehow it was never merged in GCC (actually I'm not even
 sure I submitted it).

 In the meantime Debian GNU/kFreeBSD has been using this
 patch to build GCC on their kfreebsd-amd64 port.

 I can prepare an updated version of this patch (relative to
 trunk + your linux.h overhaul [2]).

 Here is it.

 --
 Robert Millan




 --
 Robert Millan




-- 
Robert Millan
2011-01-18  Robert Millan  r...@gnu.org

Support for AMD64 targets running GNU/kFreeBSD.

* config.gcc (tm_file): Include `i386/kfreebsd-gnu.h' on
x86_64-*-kfreebsd*-gnu.
* config/i386/kfreebsd-gnu.h
(GLIBC_DYNAMIC_LINKER32): If defined, redefine to /lib/ld.so.1.
(GLIBC_DYNAMIC_LINKER64): If defined, redefine to
/lib/ld-kfreebsd-x86-64.so.1.

* config/i386/linux.h (LINK_EMULATION): Redefine this macro
to a noop filter, which can be overriden by other headers.
* config/i386/linux64.h (LINK_SPEC): Process emulation names
through LINK_EMULATION().
* config/kfreebsd-gnu.h (LINK_EMULATION): Redefine to append
a _fbsd suffix.
* config/i386/kfreebsd-gnu.h (LINK_EMULATION): Remove macro
(superceded by the definition in config/kfreebsd-gnu.h).

Index: gcc/config.gcc
===
--- gcc/config.gcc  (revision 168952)
+++ gcc/config.gcc  (working copy)
@@ -1267,7 +1267,7 @@
case ${target} in
x86_64-*-linux*)
  default_gnu_indirect_function=glibc-2011 ;;
-   x86_64-*-kfreebsd*-gnu) tm_file=${tm_file} kfreebsd-gnu.h ;;
+   x86_64-*-kfreebsd*-gnu) tm_file=${tm_file} kfreebsd-gnu.h 
i386/kfreebsd-gnu.h ;;
x86_64-*-knetbsd*-gnu) tm_file=${tm_file} knetbsd-gnu.h ;;
esac
tmake_file=${tmake_file} i386/t-linux64 i386/t-crtstuff i386/t-crtpc 
i386/t-crtfm t-dfprules
Index: gcc/config/i386/linux.h
===
--- gcc/config/i386/linux.h (revision 168952)
+++ gcc/config/i386/linux.h (working copy)
@@ -91,7 +91,7 @@
done.  */
 
 /* These macros may be overridden in k*bsd-gnu.h and i386/k*bsd-gnu.h. */
-#define LINK_EMULATION elf_i386
+#define LINK_EMULATION(em) em
 #define GLIBC_DYNAMIC_LINKER /lib/ld-linux.so.2
 
 #undef  ASM_SPEC
@@ -100,7 +100,7 @@
 
 #undef  SUBTARGET_EXTRA_SPECS
 #define SUBTARGET_EXTRA_SPECS \
-  { link_emulation, LINK_EMULATION },\
+  { link_emulation, LINK_EMULATION(elf_i386) },\
   { dynamic_linker, LINUX_DYNAMIC_LINKER }
 
 #undef LINK_SPEC
Index: gcc/config/i386/kfreebsd-gnu.h
===
--- gcc/config/i386/kfreebsd-gnu.h  (revision 168952)
+++ gcc/config/i386/kfreebsd-gnu.h  (working copy)
@@ -19,7 +19,15 @@
 along with GCC; see the file COPYING3.  If not see
 http://www.gnu.org/licenses/.  */
 
-#undef LINK_EMULATION
-#define LINK_EMULATION elf_i386_fbsd
+#ifdef GLIBC_DYNAMIC_LINKER32
+#undef GLIBC_DYNAMIC_LINKER32
+#define GLIBC_DYNAMIC_LINKER32 /lib/ld.so.1
+#endif
+
+#ifdef GLIBC_DYNAMIC_LINKER64
+#undef GLIBC_DYNAMIC_LINKER64
+#define GLIBC_DYNAMIC_LINKER64 /lib/ld-kfreebsd-x86-64.so.1
+#endif
+
 #undef REG_NAME
 #define REG_NAME(reg) sc_ ## reg
Index: gcc/config/i386/linux64.h
===
--- gcc/config/i386/linux64.h   (revision 168952)
+++ gcc/config/i386/linux64.h   (working copy)
@@ -75,7 +75,8 @@
  %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}
 
 #undef LINK_SPEC
-#define LINK_SPEC %{ SPEC_64 :-m elf_x86_64} %{ SPEC_32 :-m elf_i386} \
+#define LINK_SPEC %{ SPEC_64 :-m  LINK_EMULATION(elf_x86_64) } \
+  %{ SPEC_32 :-m  LINK_EMULATION(elf_i386) } \
   %{shared:-shared} \
   %{!shared: \
 %{!static: \
Index: gcc/config/kfreebsd-gnu.h
===
--- gcc/config/kfreebsd-gnu.h   (revision 168952)
+++ gcc/config/kfreebsd-gnu.h   (working copy)
@@ -35,3 +35,6 @@
 #undef GLIBC_DYNAMIC_LINKER
 #define

Re: PING^2 [PATCH] Support for AMD64 targets running GNU/kFreeBSD

2011-03-31 Thread Robert Millan
Ping^2

2011/1/26 Robert Millan r...@gnu.org:
 Ping!

 2011/1/18 Robert Millan r...@gnu.org:
 2011/1/14 Robert Millan r...@gnu.org:
 2011/1/12 Robert Millan r...@gnu.org:
 * The headers config/kfreebsd-gnu.h etc. override
  GLIBC_DYNAMIC_LINKER.  But the 64-bit configurations
  x86_64-*-kfreebsd*-gnu and x86_64-*-knetbsd*-gnu do not appear to
  use any header that would override GLIBC_DYNAMIC_LINKER32 and
  GLIBC_DYNAMIC_LINKER64, which are what LINK_SPEC in linux64.h
  actually uses.  Thus those configurations would use Linux-specific
  dynamic linker settings, which seems unlikely to be as intended.

 It's not as intended. On amd64 we use /lib/ld.so.1 and
 /lib/ld-kfreebsd-x86-64.so.1.

 It seems x86_64-kfreebsd-gnu has been broken for a while.  I
 just realized that I wrote a patch to fix this in 2006 [1], but
 somehow it was never merged in GCC (actually I'm not even
 sure I submitted it).

 In the meantime Debian GNU/kFreeBSD has been using this
 patch to build GCC on their kfreebsd-amd64 port.

 I can prepare an updated version of this patch (relative to
 trunk + your linux.h overhaul [2]).

 Here is it.

 --
 Robert Millan




 --
 Robert Millan




-- 
Robert Millan
2011-01-18  Robert Millan  r...@gnu.org

Support for AMD64 targets running GNU/kFreeBSD.

* config.gcc (tm_file): Include `i386/kfreebsd-gnu.h' on
x86_64-*-kfreebsd*-gnu.
* config/i386/kfreebsd-gnu.h
(GLIBC_DYNAMIC_LINKER32): If defined, redefine to /lib/ld.so.1.
(GLIBC_DYNAMIC_LINKER64): If defined, redefine to
/lib/ld-kfreebsd-x86-64.so.1.

* config/i386/linux.h (LINK_EMULATION): Redefine this macro
to a noop filter, which can be overriden by other headers.
* config/i386/linux64.h (LINK_SPEC): Process emulation names
through LINK_EMULATION().
* config/kfreebsd-gnu.h (LINK_EMULATION): Redefine to append
a _fbsd suffix.
* config/i386/kfreebsd-gnu.h (LINK_EMULATION): Remove macro
(superceded by the definition in config/kfreebsd-gnu.h).

Index: gcc/config.gcc
===
--- gcc/config.gcc  (revision 168952)
+++ gcc/config.gcc  (working copy)
@@ -1267,7 +1267,7 @@
case ${target} in
x86_64-*-linux*)
  default_gnu_indirect_function=glibc-2011 ;;
-   x86_64-*-kfreebsd*-gnu) tm_file=${tm_file} kfreebsd-gnu.h ;;
+   x86_64-*-kfreebsd*-gnu) tm_file=${tm_file} kfreebsd-gnu.h 
i386/kfreebsd-gnu.h ;;
x86_64-*-knetbsd*-gnu) tm_file=${tm_file} knetbsd-gnu.h ;;
esac
tmake_file=${tmake_file} i386/t-linux64 i386/t-crtstuff i386/t-crtpc 
i386/t-crtfm t-dfprules
Index: gcc/config/i386/linux.h
===
--- gcc/config/i386/linux.h (revision 168952)
+++ gcc/config/i386/linux.h (working copy)
@@ -91,7 +91,7 @@
done.  */
 
 /* These macros may be overridden in k*bsd-gnu.h and i386/k*bsd-gnu.h. */
-#define LINK_EMULATION elf_i386
+#define LINK_EMULATION(em) em
 #define GLIBC_DYNAMIC_LINKER /lib/ld-linux.so.2
 
 #undef  ASM_SPEC
@@ -100,7 +100,7 @@
 
 #undef  SUBTARGET_EXTRA_SPECS
 #define SUBTARGET_EXTRA_SPECS \
-  { link_emulation, LINK_EMULATION },\
+  { link_emulation, LINK_EMULATION(elf_i386) },\
   { dynamic_linker, LINUX_DYNAMIC_LINKER }
 
 #undef LINK_SPEC
Index: gcc/config/i386/kfreebsd-gnu.h
===
--- gcc/config/i386/kfreebsd-gnu.h  (revision 168952)
+++ gcc/config/i386/kfreebsd-gnu.h  (working copy)
@@ -19,7 +19,15 @@
 along with GCC; see the file COPYING3.  If not see
 http://www.gnu.org/licenses/.  */
 
-#undef LINK_EMULATION
-#define LINK_EMULATION elf_i386_fbsd
+#ifdef GLIBC_DYNAMIC_LINKER32
+#undef GLIBC_DYNAMIC_LINKER32
+#define GLIBC_DYNAMIC_LINKER32 /lib/ld.so.1
+#endif
+
+#ifdef GLIBC_DYNAMIC_LINKER64
+#undef GLIBC_DYNAMIC_LINKER64
+#define GLIBC_DYNAMIC_LINKER64 /lib/ld-kfreebsd-x86-64.so.1
+#endif
+
 #undef REG_NAME
 #define REG_NAME(reg) sc_ ## reg
Index: gcc/config/i386/linux64.h
===
--- gcc/config/i386/linux64.h   (revision 168952)
+++ gcc/config/i386/linux64.h   (working copy)
@@ -75,7 +75,8 @@
  %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}
 
 #undef LINK_SPEC
-#define LINK_SPEC %{ SPEC_64 :-m elf_x86_64} %{ SPEC_32 :-m elf_i386} \
+#define LINK_SPEC %{ SPEC_64 :-m  LINK_EMULATION(elf_x86_64) } \
+  %{ SPEC_32 :-m  LINK_EMULATION(elf_i386) } \
   %{shared:-shared} \
   %{!shared: \
 %{!static: \
Index: gcc/config/kfreebsd-gnu.h
===
--- gcc/config/kfreebsd-gnu.h   (revision 168952)
+++ gcc/config/kfreebsd-gnu.h   (working copy)
@@ -35,3 +35,6 @@
 #undef GLIBC_DYNAMIC_LINKER
 #define GLIBC_DYNAMIC_LINKER /lib/ld.so.1
 #endif
+
+#undef LINK_EMULATION
+#define LINK_EMULATION(em) em _fbsd


Re: PING^2 [PATCH] Support for AMD64 targets running GNU/kFreeBSD

2011-03-31 Thread Robert Millan
Ping^2

2011/1/26 Robert Millan r...@gnu.org:
 Ping!

 2011/1/18 Robert Millan r...@gnu.org:
 2011/1/14 Robert Millan r...@gnu.org:
 2011/1/12 Robert Millan r...@gnu.org:
 * The headers config/kfreebsd-gnu.h etc. override
  GLIBC_DYNAMIC_LINKER.  But the 64-bit configurations
  x86_64-*-kfreebsd*-gnu and x86_64-*-knetbsd*-gnu do not appear to
  use any header that would override GLIBC_DYNAMIC_LINKER32 and
  GLIBC_DYNAMIC_LINKER64, which are what LINK_SPEC in linux64.h
  actually uses.  Thus those configurations would use Linux-specific
  dynamic linker settings, which seems unlikely to be as intended.

 It's not as intended. On amd64 we use /lib/ld.so.1 and
 /lib/ld-kfreebsd-x86-64.so.1.

 It seems x86_64-kfreebsd-gnu has been broken for a while.  I
 just realized that I wrote a patch to fix this in 2006 [1], but
 somehow it was never merged in GCC (actually I'm not even
 sure I submitted it).

 In the meantime Debian GNU/kFreeBSD has been using this
 patch to build GCC on their kfreebsd-amd64 port.

 I can prepare an updated version of this patch (relative to
 trunk + your linux.h overhaul [2]).

 Here is it.

 --
 Robert Millan




 --
 Robert Millan




-- 
Robert Millan
2011-01-18  Robert Millan  r...@gnu.org

Support for AMD64 targets running GNU/kFreeBSD.

* config.gcc (tm_file): Include `i386/kfreebsd-gnu.h' on
x86_64-*-kfreebsd*-gnu.
* config/i386/kfreebsd-gnu.h
(GLIBC_DYNAMIC_LINKER32): If defined, redefine to /lib/ld.so.1.
(GLIBC_DYNAMIC_LINKER64): If defined, redefine to
/lib/ld-kfreebsd-x86-64.so.1.

* config/i386/linux.h (LINK_EMULATION): Redefine this macro
to a noop filter, which can be overriden by other headers.
* config/i386/linux64.h (LINK_SPEC): Process emulation names
through LINK_EMULATION().
* config/kfreebsd-gnu.h (LINK_EMULATION): Redefine to append
a _fbsd suffix.
* config/i386/kfreebsd-gnu.h (LINK_EMULATION): Remove macro
(superceded by the definition in config/kfreebsd-gnu.h).

Index: gcc/config.gcc
===
--- gcc/config.gcc  (revision 168952)
+++ gcc/config.gcc  (working copy)
@@ -1267,7 +1267,7 @@
case ${target} in
x86_64-*-linux*)
  default_gnu_indirect_function=glibc-2011 ;;
-   x86_64-*-kfreebsd*-gnu) tm_file=${tm_file} kfreebsd-gnu.h ;;
+   x86_64-*-kfreebsd*-gnu) tm_file=${tm_file} kfreebsd-gnu.h 
i386/kfreebsd-gnu.h ;;
x86_64-*-knetbsd*-gnu) tm_file=${tm_file} knetbsd-gnu.h ;;
esac
tmake_file=${tmake_file} i386/t-linux64 i386/t-crtstuff i386/t-crtpc 
i386/t-crtfm t-dfprules
Index: gcc/config/i386/linux.h
===
--- gcc/config/i386/linux.h (revision 168952)
+++ gcc/config/i386/linux.h (working copy)
@@ -91,7 +91,7 @@
done.  */
 
 /* These macros may be overridden in k*bsd-gnu.h and i386/k*bsd-gnu.h. */
-#define LINK_EMULATION elf_i386
+#define LINK_EMULATION(em) em
 #define GLIBC_DYNAMIC_LINKER /lib/ld-linux.so.2
 
 #undef  ASM_SPEC
@@ -100,7 +100,7 @@
 
 #undef  SUBTARGET_EXTRA_SPECS
 #define SUBTARGET_EXTRA_SPECS \
-  { link_emulation, LINK_EMULATION },\
+  { link_emulation, LINK_EMULATION(elf_i386) },\
   { dynamic_linker, LINUX_DYNAMIC_LINKER }
 
 #undef LINK_SPEC
Index: gcc/config/i386/kfreebsd-gnu.h
===
--- gcc/config/i386/kfreebsd-gnu.h  (revision 168952)
+++ gcc/config/i386/kfreebsd-gnu.h  (working copy)
@@ -19,7 +19,15 @@
 along with GCC; see the file COPYING3.  If not see
 http://www.gnu.org/licenses/.  */
 
-#undef LINK_EMULATION
-#define LINK_EMULATION elf_i386_fbsd
+#ifdef GLIBC_DYNAMIC_LINKER32
+#undef GLIBC_DYNAMIC_LINKER32
+#define GLIBC_DYNAMIC_LINKER32 /lib/ld.so.1
+#endif
+
+#ifdef GLIBC_DYNAMIC_LINKER64
+#undef GLIBC_DYNAMIC_LINKER64
+#define GLIBC_DYNAMIC_LINKER64 /lib/ld-kfreebsd-x86-64.so.1
+#endif
+
 #undef REG_NAME
 #define REG_NAME(reg) sc_ ## reg
Index: gcc/config/i386/linux64.h
===
--- gcc/config/i386/linux64.h   (revision 168952)
+++ gcc/config/i386/linux64.h   (working copy)
@@ -75,7 +75,8 @@
  %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}
 
 #undef LINK_SPEC
-#define LINK_SPEC %{ SPEC_64 :-m elf_x86_64} %{ SPEC_32 :-m elf_i386} \
+#define LINK_SPEC %{ SPEC_64 :-m  LINK_EMULATION(elf_x86_64) } \
+  %{ SPEC_32 :-m  LINK_EMULATION(elf_i386) } \
   %{shared:-shared} \
   %{!shared: \
 %{!static: \
Index: gcc/config/kfreebsd-gnu.h
===
--- gcc/config/kfreebsd-gnu.h   (revision 168952)
+++ gcc/config/kfreebsd-gnu.h   (working copy)
@@ -35,3 +35,6 @@
 #undef GLIBC_DYNAMIC_LINKER
 #define GLIBC_DYNAMIC_LINKER /lib/ld.so.1
 #endif
+
+#undef LINK_EMULATION
+#define LINK_EMULATION(em) em _fbsd


[PATCH] Support for AMD64 targets running GNU/kFreeBSD

2011-01-18 Thread Robert Millan
2011/1/14 Robert Millan r...@gnu.org:
 2011/1/12 Robert Millan r...@gnu.org:
 * The headers config/kfreebsd-gnu.h etc. override
  GLIBC_DYNAMIC_LINKER.  But the 64-bit configurations
  x86_64-*-kfreebsd*-gnu and x86_64-*-knetbsd*-gnu do not appear to
  use any header that would override GLIBC_DYNAMIC_LINKER32 and
  GLIBC_DYNAMIC_LINKER64, which are what LINK_SPEC in linux64.h
  actually uses.  Thus those configurations would use Linux-specific
  dynamic linker settings, which seems unlikely to be as intended.

 It's not as intended. On amd64 we use /lib/ld.so.1 and
 /lib/ld-kfreebsd-x86-64.so.1.

 It seems x86_64-kfreebsd-gnu has been broken for a while.  I
 just realized that I wrote a patch to fix this in 2006 [1], but
 somehow it was never merged in GCC (actually I'm not even
 sure I submitted it).

 In the meantime Debian GNU/kFreeBSD has been using this
 patch to build GCC on their kfreebsd-amd64 port.

 I can prepare an updated version of this patch (relative to
 trunk + your linux.h overhaul [2]).

Here is it.

-- 
Robert Millan
2011-01-18  Robert Millan  r...@gnu.org

	Support for AMD64 targets running GNU/kFreeBSD.

	* config.gcc (tm_file): Include `i386/kfreebsd-gnu.h' on
	x86_64-*-kfreebsd*-gnu.
	* config/i386/kfreebsd-gnu.h
	(GLIBC_DYNAMIC_LINKER32): If defined, redefine to /lib/ld.so.1.
	(GLIBC_DYNAMIC_LINKER64): If defined, redefine to
	/lib/ld-kfreebsd-x86-64.so.1.

	* config/i386/linux.h (LINK_EMULATION): Redefine this macro
	to a noop filter, which can be overriden by other headers.
	* config/i386/linux64.h (LINK_SPEC): Process emulation names
	through LINK_EMULATION().
	* config/kfreebsd-gnu.h (LINK_EMULATION): Redefine to append
	a _fbsd suffix.
	* config/i386/kfreebsd-gnu.h (LINK_EMULATION): Remove macro
	(superceded by the definition in config/kfreebsd-gnu.h).

Index: gcc/config.gcc
===
--- gcc/config.gcc	(revision 168952)
+++ gcc/config.gcc	(working copy)
@@ -1267,7 +1267,7 @@
 	case ${target} in
 	x86_64-*-linux*)
 	  default_gnu_indirect_function=glibc-2011 ;;
-	x86_64-*-kfreebsd*-gnu) tm_file=${tm_file} kfreebsd-gnu.h ;;
+	x86_64-*-kfreebsd*-gnu) tm_file=${tm_file} kfreebsd-gnu.h i386/kfreebsd-gnu.h ;;
 	x86_64-*-knetbsd*-gnu) tm_file=${tm_file} knetbsd-gnu.h ;;
 	esac
 	tmake_file=${tmake_file} i386/t-linux64 i386/t-crtstuff i386/t-crtpc i386/t-crtfm t-dfprules
Index: gcc/config/i386/linux.h
===
--- gcc/config/i386/linux.h	(revision 168952)
+++ gcc/config/i386/linux.h	(working copy)
@@ -91,7 +91,7 @@
done.  */
 
 /* These macros may be overridden in k*bsd-gnu.h and i386/k*bsd-gnu.h. */
-#define LINK_EMULATION elf_i386
+#define LINK_EMULATION(em)	em
 #define GLIBC_DYNAMIC_LINKER /lib/ld-linux.so.2
 
 #undef  ASM_SPEC
@@ -100,7 +100,7 @@
 
 #undef  SUBTARGET_EXTRA_SPECS
 #define SUBTARGET_EXTRA_SPECS \
-  { link_emulation, LINK_EMULATION },\
+  { link_emulation, LINK_EMULATION(elf_i386) },\
   { dynamic_linker, LINUX_DYNAMIC_LINKER }
 
 #undef	LINK_SPEC
Index: gcc/config/i386/kfreebsd-gnu.h
===
--- gcc/config/i386/kfreebsd-gnu.h	(revision 168952)
+++ gcc/config/i386/kfreebsd-gnu.h	(working copy)
@@ -19,7 +19,15 @@
 along with GCC; see the file COPYING3.  If not see
 http://www.gnu.org/licenses/.  */
 
-#undef LINK_EMULATION
-#define LINK_EMULATION elf_i386_fbsd
+#ifdef GLIBC_DYNAMIC_LINKER32
+#undef GLIBC_DYNAMIC_LINKER32
+#define GLIBC_DYNAMIC_LINKER32 /lib/ld.so.1
+#endif
+
+#ifdef GLIBC_DYNAMIC_LINKER64
+#undef GLIBC_DYNAMIC_LINKER64
+#define GLIBC_DYNAMIC_LINKER64 /lib/ld-kfreebsd-x86-64.so.1
+#endif
+
 #undef REG_NAME
 #define REG_NAME(reg) sc_ ## reg
Index: gcc/config/i386/linux64.h
===
--- gcc/config/i386/linux64.h	(revision 168952)
+++ gcc/config/i386/linux64.h	(working copy)
@@ -75,7 +75,8 @@
  %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}
 
 #undef	LINK_SPEC
-#define LINK_SPEC %{ SPEC_64 :-m elf_x86_64} %{ SPEC_32 :-m elf_i386} \
+#define LINK_SPEC %{ SPEC_64 :-m  LINK_EMULATION(elf_x86_64) } \
+  %{ SPEC_32 :-m  LINK_EMULATION(elf_i386) } \
   %{shared:-shared} \
   %{!shared: \
 %{!static: \
Index: gcc/config/kfreebsd-gnu.h
===
--- gcc/config/kfreebsd-gnu.h	(revision 168952)
+++ gcc/config/kfreebsd-gnu.h	(working copy)
@@ -35,3 +35,6 @@
 #undef GLIBC_DYNAMIC_LINKER
 #define GLIBC_DYNAMIC_LINKER /lib/ld.so.1
 #endif
+
+#undef LINK_EMULATION
+#define LINK_EMULATION(em) em _fbsd


Re: kfreebsd-gnu etc. issues

2011-01-14 Thread Robert Millan
2011/1/12 Robert Millan r...@gnu.org:
 * The headers config/kfreebsd-gnu.h etc. override
  GLIBC_DYNAMIC_LINKER.  But the 64-bit configurations
  x86_64-*-kfreebsd*-gnu and x86_64-*-knetbsd*-gnu do not appear to
  use any header that would override GLIBC_DYNAMIC_LINKER32 and
  GLIBC_DYNAMIC_LINKER64, which are what LINK_SPEC in linux64.h
  actually uses.  Thus those configurations would use Linux-specific
  dynamic linker settings, which seems unlikely to be as intended.

 It's not as intended. On amd64 we use /lib/ld.so.1 and
 /lib/ld-kfreebsd-x86-64.so.1.

It seems x86_64-kfreebsd-gnu has been broken for a while.  I
just realized that I wrote a patch to fix this in 2006 [1], but
somehow it was never merged in GCC (actually I'm not even
sure I submitted it).

In the meantime Debian GNU/kFreeBSD has been using this
patch to build GCC on their kfreebsd-amd64 port.

I can prepare an updated version of this patch (relative to
trunk + your linux.h overhaul [2]).

[1] 
http://svn.debian.org/viewsvn/glibc-bsd/trunk/web/patches/upstream-only/gcc.diff?view=markuppathrev=1424

[2] http://gcc.gnu.org/ml/gcc-patches/2010-12/msg02055.html

-- 
Robert Millan


Re: kfreebsd-gnu etc. issues

2011-01-14 Thread Robert Millan
2011/1/12 Ian Lance Taylor i...@google.com:
 All that said, I see little harm in using a PT_GNU_STACK header on
 binaries even if the kernel does not fully support them.  Except for the
 small amount of wasted space in every .o file and every executable, but
 I lost that argument years ago.

Thanks Ian.  Seeing that there's so little harm in enabling it
gratuitously, I think it'd be best to assume that PT_GNU_STACK
is supported unless someone can prove otherwise.

-- 
Robert Millan


Re: kfreebsd-gnu etc. issues

2011-01-14 Thread Robert Millan
2011/1/12 Joseph S. Myers jos...@codesourcery.com:
 I don't understand this code, but what I can do is confirm that disabling
 linux-unwind.h doesn't cause any breakage.  Then we could disable it
 untill/unless someone more clued than me ports it to kFreeBSD.  Would
 this be ok?

 That makes sense to me.

Confirmed, linux-unwind.h can be removed.

 If disabled for non-Linux-kernel targets, the
 REG_NAME abstraction may as well be removed as not actually being useful
 at present.

Ack.  I'll send a patch for this.

-- 
Robert Millan


Re: kfreebsd-gnu etc. issues

2011-01-12 Thread Robert Millan
2011/1/12 Joseph S. Myers jos...@codesourcery.com:
 I don't think they are necessarily broken - and if they are, it is because
 of Linux-specific headers being used in non-Linux-specific code, not the
 other way round.

Actually, it's a different problem.  I'll just prepare a patch and
send it, it'll be obvious by reading the patch.

 So if you could clarify the answers to my questions regarding
 PT_GNU_STACK and signal frames for those targets (with or without fixing
 any bugs for those targets indicated by the answers to those questions),
 that would help determine the correct division of those headers.

Ok, I'll answer what I can in your previous mail.

-- 
Robert Millan


Re: Dumb idea for accelerating FOSS development

2011-01-12 Thread Robert Millan
2011/1/12 Bill Cox waywardg...@gmail.com:
    $ gcc myprog.c -lgit://github/~waywardgeek/sonic=0.1

You already have this, it's called FUSE. E.g.

$ sshfs $publicrepo $tmp
$ gcc myprog.c -I$tmp $tmp/sonic.c

If you want it to speak GIT protocol, just write a GIT
extension, etc.

-- 
Robert Millan


Re: kfreebsd-gnu etc. issues

2011-01-12 Thread Robert Millan
2011/1/1 Joseph S. Myers jos...@codesourcery.com:
 [...] I found
 several possible problems with the configurations for *-kfreebsd-gnu,
 *-knetbsd-gnu and *-kopensolaris-gnu.

Ok.  Unless indicated otherwise, my answers below apply to
*-kfreebsd-gnu, which is the only in these 3 systems that is
actively maintained.

For the other two I wouldn't worry about either guessing or
leaving them as-is.  If minor breakage happens it's unlikely
to bother anyone.

 * The headers config/kfreebsd-gnu.h etc. override
  GLIBC_DYNAMIC_LINKER.  But the 64-bit configurations
  x86_64-*-kfreebsd*-gnu and x86_64-*-knetbsd*-gnu do not appear to
  use any header that would override GLIBC_DYNAMIC_LINKER32 and
  GLIBC_DYNAMIC_LINKER64, which are what LINK_SPEC in linux64.h
  actually uses.  Thus those configurations would use Linux-specific
  dynamic linker settings, which seems unlikely to be as intended.

It's not as intended. On amd64 we use /lib/ld.so.1 and
/lib/ld-kfreebsd-x86-64.so.1.

 * These configurations use file_end_indicate_exec_stack to use the
  PT_GNU_STACK convention.  While some of the implementation of this
  is in the GNU linker and glibc, it also requires kernel support for
  correct operation.  Do all these kernels support this convention, or
  should this code actually be disabled for them in GCC and glibc?

I'm not familiar with PT_GNU_STACK.  Does a working
_dl_make_stack_executable() in glibc [1] indicate it's supported?

[1] 
http://svn.debian.org/viewsvn/glibc-bsd/trunk/glibc-ports/kfreebsd/dl-execstack.c?revision=1685view=markup

 * The kfreebsd-gnu and knetbsd-gnu configurations use linux-unwind.h
  (kopensolaris-gnu disables this).  They define REG_NAME to adapt
  linux-unwind.h to their system headers.  But linux-unwind.h also
  contains hardcoded checks for the particular instructions, complete
  with hardcoded Linux syscall numbers, in Linux signal trampolines.

I'm sorry.  It seems this would be my fault (I introduced this with
the first kfreebsd-gnu port).

  Do the FreeBSD and NetBSD kernels really use identical instructions?

Definitely not.  But it's strange we didn't notice, we've been using
it for several years.

  Does this code do anything useful on those systems?  If it's useful
  (possibly with some fixes) then linux-unwind.h ought to be renamed;

The only thing I know for sure is that those 2 syscalls don't work. Is
there any possibility that linux-unwind.h is useful for GNU/kFreeBSD
in its current state?

I don't understand this code, but what I can do is confirm that disabling
linux-unwind.h doesn't cause any breakage.  Then we could disable it
untill/unless someone more clued than me ports it to kFreeBSD.  Would
this be ok?

 * A minor point: TARGET_VERSION, referring to Linux, is not overridden
  by these configurations.

Perhaps a common (or a fallback) string mentioning GNU and/or glibc
would fit.  But where's this displayed anyway?

-- 
Robert Millan


Re: kfreebsd-gnu etc. issues

2011-01-11 Thread Robert Millan
Hi Joseph

I'll look at more detail at the other problems, but first it
seems that non-Linux GNU targets are currently broken
because many declarations that are not Linux-specific
have been added to the Linux-specific sections of
config.gcc.

Should I wait untill your patch is merged to fix this?

Btw, your patch overhauls linux.h but not i386/linux64.h
which is in the same situation as you described.

-- 
Robert Millan


Re: kfreebsd-gnu etc. issues

2011-01-02 Thread Robert Millan
Hi Joseph,

2011/1/1 Joseph S. Myers jos...@codesourcery.com:
 I'm trying to stop non-Linux GCC targets from using config/linux.h and
 other headers whose names indicate they relate to the Linux kernel,
 separating GNU-userspace and Linux-kernel configuration more cleanly.
 http://gcc.gnu.org/ml/gcc-patches/2010-12/msg02055.html is the
 initial patch in this series, and in the course of working on the
 corresponding changes for i386/linux.h and i386/linux64.h

Thank you for doing this.  As the person who introduced this
kind of use, I intended to propose something along these
lines myself, but never got the time to do it.

 I found
 several possible problems with the configurations for *-kfreebsd-gnu,
 *-knetbsd-gnu and *-kopensolaris-gnu.

 [...]

I can't review these problems right now, but I'll have a bit more
time in 1 or 2 weeks.  I'll get back to you.

-- 
Robert Millan


Re: RFC: Add 32bit x86-64 support to binutils

2010-12-30 Thread Robert Millan
Hi folks,

I had this unsubmitted patch in my local filesystem.  It makes Linux
detect ELF32 AMD64 binaries and sets a flag to restrict them to
32-bit address space.

It's not rocket science but can save you some work in case you
haven't implemented this already.

Best regards

-- 
Robert Millan
diff -Nur linux-2.6-2.6.26-libre2.old/arch/x86/kernel/sys_x86_64.c 
linux-2.6-2.6.26-libre2/arch/x86/kernel/sys_x86_64.c
--- linux-2.6-2.6.26-libre2.old/arch/x86/kernel/sys_x86_64.c2008-07-13 
23:51:29.0 +0200
+++ linux-2.6-2.6.26-libre2/arch/x86/kernel/sys_x86_64.c2009-05-29 
22:57:41.0 +0200
@@ -48,7 +48,7 @@
 static void find_start_end(unsigned long flags, unsigned long *begin,
   unsigned long *end)
 {
-   if (!test_thread_flag(TIF_IA32)  (flags  MAP_32BIT)) {
+   if ((!test_thread_flag(TIF_IA32)  (flags  MAP_32BIT)) || 
test_thread_flag(TIF_AMD32)) {
unsigned long new_begin;
/* This is usually used needed to map code in small
   model, so it needs to be in the first 31bit. Limit
@@ -94,7 +94,7 @@
(!vma || addr + len = vma-vm_start))
return addr;
}
-   if (((flags  MAP_32BIT) || test_thread_flag(TIF_IA32))
+   if (((flags  MAP_32BIT) || test_thread_flag(TIF_IA32) || 
test_thread_flag(TIF_AMD32))
 len = mm-cached_hole_size) {
mm-cached_hole_size = 0;
mm-free_area_cache = begin;
@@ -150,8 +150,8 @@
if (flags  MAP_FIXED)
return addr;
 
-   /* for MAP_32BIT mappings we force the legact mmap base */
-   if (!test_thread_flag(TIF_IA32)  (flags  MAP_32BIT))
+   /* for MAP_32BIT mappings we force the legacy mmap base */
+   if ((!test_thread_flag(TIF_IA32)  (flags  MAP_32BIT)) || 
test_thread_flag(TIF_AMD32))
goto bottomup;
 
/* requesting a specific address */
@@ -232,5 +232,7 @@
up_read(uts_sem);
if (personality(current-personality) == PER_LINUX32) 
err |= copy_to_user(name-machine, i686, 5); 
+   else if (test_thread_flag(TIF_AMD32))
+   err |= copy_to_user(name-machine, amd32, 6);
return err ? -EFAULT : 0;
 }
diff -Nur linux-2.6-2.6.26-libre2.old/arch/x86/mm/mmap.c 
linux-2.6-2.6.26-libre2/arch/x86/mm/mmap.c
--- linux-2.6-2.6.26-libre2.old/arch/x86/mm/mmap.c  2008-07-13 
23:51:29.0 +0200
+++ linux-2.6-2.6.26-libre2/arch/x86/mm/mmap.c  2009-05-26 14:30:53.0 
+0200
@@ -53,6 +53,15 @@
return 0;
 }
 
+static int mmap_is_32bit(void)
+{
+   if (mmap_is_ia32 ())
+   return 1;
+   if (test_thread_flag(TIF_AMD32))
+   return 1;
+   return 0;
+}
+
 static int mmap_is_legacy(void)
 {
if (current-personality  ADDR_COMPAT_LAYOUT)
@@ -73,7 +82,7 @@
* 28 bits of randomness in 64bit mmaps, 40 address space bits
*/
if (current-flags  PF_RANDOMIZE) {
-   if (mmap_is_ia32())
+   if (mmap_is_32bit())
rnd = (long)get_random_int() % (18);
else
rnd = (long)(get_random_int() % (128));
diff -Nur linux-2.6-2.6.26-libre2.old/fs/binfmt_elf_amd32.c 
linux-2.6-2.6.26-libre2/fs/binfmt_elf_amd32.c
--- linux-2.6-2.6.26-libre2.old/fs/binfmt_elf_amd32.c   1970-01-01 
01:00:00.0 +0100
+++ linux-2.6-2.6.26-libre2/fs/binfmt_elf_amd32.c   2009-05-26 
14:26:24.0 +0200
@@ -0,0 +1,46 @@
+/*
+ *  Support for loading AMD32 binaries
+ *  Copyright (C) 2009  Robert Millan
+ *
+ *  This program 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 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 this program.  If not, see http://www.gnu.org/licenses/.
+ */
+
+#include linux/elfcore-compat.h
+
+#undef ELF_CLASS
+#defineELF_CLASS   ELFCLASS32
+
+#undef elfhdr
+#define elfhdr elf32_hdr
+#undef elf_phdr
+#define elf_phdr   elf32_phdr
+#undef elf_note
+#define elf_note   elf32_note
+#undef elf_addr_t
+#define elf_addr_t Elf32_Addr
+
+#undef ELF_PLATFORM
+#defineELF_PLATFORM(amd32)
+
+#undef elf_check_arch
+#defineelf_check_arch(x)   ((x)-e_machine == EM_X86_64  
(x)-e_ident[EI_CLASS] == ELFCLASS32)
+
+#undef SET_PERSONALITY
+#define SET_PERSONALITY(ex, ibcs2) do { set_personality_64bit(); 
set_thread_flag(TIF_AMD32); current-personality |= force_personality32; } 
while (0)
+
+/* Use

Re: RFC: Add 32bit x86-64 support to binutils

2010-12-30 Thread Robert Millan
2010/12/30 H.J. Lu hjl.to...@gmail.com:
 I also have a patch for gcc 4.4 which works on simple codes.

 H.J.
 On Thu, Dec 30, 2010 at 1:31 PM, H. Peter Anvin h...@zytor.com wrote:
 We do have a slightly more extensive patch already implemented.

Could you make those patches available somewhere?  It'd be
interesting to play with them.

Btw, I recommend against 8-byte longs.  In the tests I did in
2009, I recall glibc source was extremely unhappy due to
sizeof(long)==sizeof(void *) assumptions.

-- 
Robert Millan


Re: RFC: Add 32bit x86-64 support to binutils

2010-12-30 Thread Robert Millan
2010/12/30 Richard Guenther richard.guent...@gmail.com:
 Would be nice if LFS would be mandatory on the new ABI, thus
 off_t being 64bits.

Please do also consider time_t.

-- 
Robert Millan


please disable email forwarding

2008-09-14 Thread Robert Millan

Hi,

Please disable email forwarding for my account [EMAIL PROTECTED] (it is being
forwarded to [EMAIL PROTECTED]).

Thanks

-- 
Robert Millan

  The DRM opt-in fallacy: Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all.


Re: GSoC ideas

2008-03-30 Thread Robert Millan

Hi Ian,

On Sat, Mar 29, 2008 at 07:28:19PM -0700, Ian Lance Taylor wrote:
 Robert Millan [EMAIL PROTECTED] writes:
 
  I know it's a bit late, but I just thought that it'd be really nice if GCC
  had a C# frontend.  I don't have time to do this myself right now (although
  I'm willing to work on it in the future if noone beats me to it), but maybe
  someone would pick it if it enters GSoC.
 
  My motivation for this is technical but also political (using the GPLv3 to 
  put
  a stop to the patent-encumberance issues surrounding Mono).
 
  Are proposals welcome?  If you like, I can ellaborate on it and add it to 
  the
  wiki page.
 
 Proposals for gcc extensions are always welcome.  A C# frontend would
 be interesting, though there might be some patent considerations.

That's where I think it gets interesting.  If Microsoft or its partners came to
distribute it, they would be implicitly issuing a public grant of the patents
covering it (as per GPL section 11).

 However, I think a C# frontend would be too much work for one student
 during the summer.

Do you think it can be broken down?  My understanding of compilers is very
narrow (although I expect to improve it at some point).

Maybe a subset of the syntax could be defined by a set of test cases?

-- 
Robert Millan

GPLv2 I know my rights; I want my phone call!
DRM What use is a phone call… if you are unable to speak?
(as seen on /.)


Re: GSoC ideas

2008-03-30 Thread Robert Millan
On Sun, Mar 30, 2008 at 08:47:05AM -0600, Tom Tromey wrote:
  Robert == Robert Millan [EMAIL PROTECTED] writes:
 
 Robert I know it's a bit late, but I just thought that it'd be really
 Robert nice if GCC had a C# frontend.
 
 FWIW there is an incomplete CIL front end on a branch.  See:
 
 http://gcc.gnu.org/projects/cli.html
 
 Based on experience with gcj I would say that it is just fine to write
 a front end this way, and do C#-CIL translation in a separate
 program.
 
 I agree with Ian that this is too big for a SoC project.

I'll check that up, thanks for the pointers.

-- 
Robert Millan

GPLv2 I know my rights; I want my phone call!
DRM What use is a phone call… if you are unable to speak?
(as seen on /.)


GSoC ideas

2008-03-29 Thread Robert Millan

Hi,

I know it's a bit late, but I just thought that it'd be really nice if GCC
had a C# frontend.  I don't have time to do this myself right now (although
I'm willing to work on it in the future if noone beats me to it), but maybe
someone would pick it if it enters GSoC.

My motivation for this is technical but also political (using the GPLv3 to put
a stop to the patent-encumberance issues surrounding Mono).

Are proposals welcome?  If you like, I can ellaborate on it and add it to the
wiki page.

Thanks

-- 
Robert Millan

GPLv2 I know my rights; I want my phone call!
DRM What use is a phone call… if you are unable to speak?
(as seen on /.)