Hello!

Here is a patch to bring the target configuration for GNU/Hurd up to a
level so that GCC trunk is buildable for GNU/Hurd again (together with
other patches that are already available or are still to be written; see
my other posts).  This GCC does even ;-) produce working binaries.
Please discuss with the goal to have this eventually committed to the GCC
trunk.

No ChangeLog yet.

Index: gcc/config.gcc
===================================================================
--- gcc/config.gcc      (Revision 140963)
+++ gcc/config.gcc      (Arbeitskopie)
@@ -480,16 +480,28 @@
   esac
   fbsd_tm_file="${fbsd_tm_file} freebsd-spec.h freebsd.h"
   ;;
-*-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
-  # Must come before *-*-gnu* (because of *-*-linux-gnu* systems).
+*-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-gnu*)
   extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
-  extra_options="${extra_options} linux.opt"
   gas=yes
   gnu_ld=yes
   case ${enable_threads} in
     "" | yes | posix) thread_file='posix' ;;
   esac
   tmake_file="t-slibgcc-elf-ver t-linux"
+  case $target in
+    *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
+      :;;
+    *-*-gnu*)
+      tmake_file="$tmake_file t-gnu";;
+  esac
+  # glibc / uclibc switch.  uclibc isn't usable for GNU/Hurd and neither for
+  # GNU/k*BSD.
+  case $target in
+    *linux*)
+      extra_options="${extra_options} linux.opt";;
+    *)
+      tm_defines="$tm_defines OPTION_GLIBC=1";;
+  esac
   case ${target} in
     *-*-*uclibc*)
       tm_defines="${tm_defines} UCLIBC_DEFAULT=1"
@@ -502,30 +514,6 @@
   default_use_cxa_atexit=yes
   use_gcc_tgmath=no
   ;;
-*-*-gnu*)
-  # On the Hurd, the setup is just about the same on
-  # each different CPU.  The specific machines that we
-  # support are matched above and just set $cpu_type.
-  tm_file="${cpu_type}/gnu.h"
-  extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o"
-  # GNU tools are the only tools.
-  gas=yes
-  gnu_ld=yes
-  # These details are the same as for Linux.
-  # But here we need a little extra magic.
-  tmake_file="t-slibgcc-elf-ver t-linux t-gnu"
-  case ${target} in
-    alpha*)
-      tm_file="${cpu_type}/${cpu_type}.h alpha/elf.h alpha/linux.h 
alpha/linux-elf.h gnu.h ${tm_file}"
-      ;;
-    i[34567]86-*-*)
-      tm_file="${cpu_type}/${cpu_type}.h i386/unix.h i386/att.h dbxelf.h 
elfos.h svr4.h linux.h i386/linux.h gnu.h ${tm_file}"
-      ;;
-  esac
-  # Assume that glibc is being used and so __cxa_atexit is provided.
-  default_use_cxa_atexit=yes
-  use_gcc_tgmath=no
-  ;;
 *-*-netbsd*)
   tmake_file="t-slibgcc-elf-ver t-libc-ok t-netbsd t-libgcc-pic"
   gas=yes
@@ -618,6 +606,7 @@
        tmake_file="${tmake_file} alpha/t-crtfm alpha/t-alpha alpha/t-ieee 
alpha/t-linux"
        ;;
 alpha*-*-gnu*)
+       tm_file="$tm_file alpha/elf.h alpha/linux.h alpha/linux-elf.h gnu.h 
alpha/gnu.h"
        target_cpu_default="MASK_GAS"
        tmake_file="${tmake_file} alpha/t-crtfm alpha/t-alpha alpha/t-ieee"
        ;;
@@ -1085,7 +1075,7 @@
 i[34567]86-*-coff*)
        tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h dbxcoff.h 
i386/i386-coff.h"
        ;;
-i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu)
+i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | 
i[34567]86-*-gnu*)
                        # Intel 80386's running GNU/*
                        # with ELF format using glibc 2
        tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h 
linux.h"
@@ -1116,6 +1106,7 @@
                ;;
        i[34567]86-*-knetbsd*-gnu) tm_file="${tm_file} i386/linux.h 
knetbsd-gnu.h i386/knetbsd-gnu.h" ;;
        i[34567]86-*-kfreebsd*-gnu) tm_file="${tm_file} i386/linux.h 
kfreebsd-gnu.h i386/kfreebsd-gnu.h" ;;
+       i[34567]86-*-gnu*) tm_file="$tm_file i386/linux.h gnu.h i386/gnu.h";;
        esac
        tmake_file="${tmake_file} i386/t-crtstuff i386/t-crtpc i386/t-crtfm 
t-dfprules"
        ;;
@@ -1128,8 +1119,6 @@
        esac
        tmake_file="${tmake_file} i386/t-linux64 i386/t-crtstuff i386/t-crtpc 
i386/t-crtfm t-dfprules"
        ;;
-i[34567]86-*-gnu*)
-       ;;
 i[34567]86-pc-msdosdjgpp*)
        xm_file=i386/xm-djgpp.h
        tm_file="dbxcoff.h ${tm_file} i386/unix.h i386/bsd.h i386/gas.h 
i386/djgpp.h"
Index: gcc/config/i386/gnu.h
===================================================================
--- gcc/config/i386/gnu.h       (Revision 140963)
+++ gcc/config/i386/gnu.h       (Arbeitskopie)
@@ -1,30 +1,17 @@
 /* Configuration for an i386 running GNU with ELF as the target machine.  */
 
+#undef GLIBC_DYNAMIC_LINKER
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so"
+
 #undef TARGET_VERSION
 #define TARGET_VERSION fprintf (stderr, " (i386 GNU)");
 
-#undef TARGET_OS_CPP_BUILTINS /* config.gcc includes i386/linux.h.  */
-#define TARGET_OS_CPP_BUILTINS()               \
-  do                                           \
-    {                                          \
-       HURD_TARGET_OS_CPP_BUILTINS();          \
-    }                                          \
-  while (0)
-
 #undef CPP_SPEC
 #define CPP_SPEC "%{pthread:-D_REENTRANT} %{posix:-D_POSIX_SOURCE} 
%{bsd:-D_BSD_SOURCE}"
 
 #undef CC1_SPEC
 #define CC1_SPEC "%(cc1_cpu)"
 
-#undef LINK_SPEC
-#define LINK_SPEC "-m elf_i386 %{shared:-shared} \
-  %{!shared: \
-    %{!static: \
-      %{rdynamic:-export-dynamic} \
-      %{!dynamic-linker:-dynamic-linker /lib/ld.so}} \
-    %{static:-static}}"
-
 #undef STARTFILE_SPEC
 #if defined HAVE_LD_PIE
 #define STARTFILE_SPEC \
@@ -42,3 +29,8 @@
 
 /* FIXME: Is a Hurd-specific fallback mechanism necessary?  */
 #undef MD_UNWIND_SUPPORT
+
+#ifdef TARGET_LIBC_PROVIDES_SSP
+/* Not supported yet.  */
+#undef TARGET_THREAD_SSP_OFFSET
+#endif
Index: gcc/config/gnu.h
===================================================================
--- gcc/config/gnu.h    (Revision 140963)
+++ gcc/config/gnu.h    (Arbeitskopie)
@@ -12,10 +12,8 @@
 #undef STANDARD_INCLUDE_DIR
 #define STANDARD_INCLUDE_DIR "/include"
 
-/* The system headers under GNU are C++-aware.  */
-#define NO_IMPLICIT_EXTERN_C
-
-#define HURD_TARGET_OS_CPP_BUILTINS()          \
+#undef LINUX_TARGET_OS_CPP_BUILTINS
+#define LINUX_TARGET_OS_CPP_BUILTINS()         \
     do {                                       \
        builtin_define ("__gnu_hurd__");        \
        builtin_define ("__GNU__");             \

Attachment: signature.asc
Description: Digital signature

Reply via email to