This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch, rfa] rewrite TPF OS handling
- From: Eric Christopher <echristo at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: jtison at us dot ibm dot com, uweigand at de dot ibm dot com
- Date: Tue, 12 Jul 2005 13:54:30 -0700
- Subject: [patch, rfa] rewrite TPF OS handling
The original TPF OS port was done with a very odd idea for cross
compilation in mind. This rewrite gets it more toward a standard host
cross host sysroot type environment. Now it's possible to use
--with-sysroot and get a cross compiler that with a few additional
command line options will produce code for the s390x-ibm-tpf system.
This was written by me and tested by the TPF OS group.
OK?
2005-07-12 Eric Christopher <echristo@redhat.com>
* configure.in: Add toplevel noconfigdir support for tpf.
* configure: Regenerate.
2005-07-12 Eric Christopher <echristo@redhat.com>
* config.gcc (s390x-ibm-tpf*): Add extra_options. Remove
static extra parts.
* config/s390/s390.md: Include tpf.md. Move tpf specific
patterns...
* config/s390/tpf.md: To here.
* config/s390/s390.opt: Move tpf specific options...
* config/s390/tpf.opt: to here. Add mmain option.
* config/s390/tpf-unwind.h: Remove unnecessary defines.
* config/s390/tpf.h: Rewrite.
-eric
Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/configure.in,v
retrieving revision 1.357
diff -u -p -w -r1.357 configure.in
--- configure.in 7 Jul 2005 01:12:59 -0000 1.357
+++ configure.in 12 Jul 2005 18:47:22 -0000
@@ -413,6 +413,10 @@ case "${target}" in
*-*-rtems*)
noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
;;
+ # The tpf target doesn't support gdb yet.
+ *-*-tpf*)
+ noconfigdirs="$noconfigdirs target-newlib target-libgloss target-libiberty ${libgcj} target-libmudflap gdb tcl tk libgui itcl"
+ ;;
*-*-uclinux*)
noconfigdirs="$noconfigdirs target-newlib target-libgloss target-rda ${libgcj}"
;;
Index: gcc/config.gcc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config.gcc,v
retrieving revision 1.553
diff -u -p -w -r1.553 config.gcc
--- gcc/config.gcc 11 Jul 2005 08:23:27 -0000 1.553
+++ gcc/config.gcc 12 Jul 2005 18:47:23 -0000
@@ -1824,10 +1824,11 @@ s390x-ibm-tpf*)
tm_p_file=s390/s390-protos.h
md_file=s390/s390.md
extra_modes=s390/s390-modes.def
- extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
out_file=s390/s390.c
- tmake_file="t-slibgcc-elf-ver s390/t-crtstuff s390/t-tpf"
+ extra_parts="crtbeginS.o crtendS.o"
+ tmake_file="s390/t-crtstuff s390/t-tpf"
thread_file='tpf'
+ extra_options="${extra_options} s390/tpf.opt"
;;
sh-*-elf* | sh[12346l]*-*-elf* | sh*-*-kaos* | \
sh-*-symbianelf* | sh[12346l]*-*-symbianelf* | \
Index: gcc/config/s390/s390.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/s390.md,v
retrieving revision 1.181
diff -u -p -w -r1.181 s390.md
--- gcc/config/s390/s390.md 7 Jul 2005 10:34:57 -0000 1.181
+++ gcc/config/s390/s390.md 12 Jul 2005 18:47:24 -0000
@@ -257,6 +257,8 @@
;; Predicates
(include "predicates.md")
+;; Other includes
+(include "tpf.md")
;; Macros
@@ -7019,25 +7021,11 @@
""
"s390_emit_prologue (); DONE;")
-(define_insn "prologue_tpf"
- [(unspec_volatile [(const_int 0)] UNSPECV_TPF_PROLOGUE)
- (clobber (reg:DI 1))]
- "TARGET_TPF_PROFILING"
- "larl\t%%r1,.+14\;tm\t4065,255\;bnz\t4064"
- [(set_attr "length" "14")])
-
(define_expand "epilogue"
[(use (const_int 1))]
""
"s390_emit_epilogue (false); DONE;")
-(define_insn "epilogue_tpf"
- [(unspec_volatile [(const_int 0)] UNSPECV_TPF_EPILOGUE)
- (clobber (reg:DI 1))]
- "TARGET_TPF_PROFILING"
- "larl\t%%r1,.+14\;tm\t4071,255\;bnz\t4070"
- [(set_attr "length" "14")])
-
(define_expand "sibcall_epilogue"
[(use (const_int 0))]
""
Index: gcc/config/s390/s390.opt
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/s390.opt,v
retrieving revision 1.4
diff -u -p -w -r1.4 s390.opt
--- gcc/config/s390/s390.opt 7 Jul 2005 10:25:37 -0000 1.4
+++ gcc/config/s390/s390.opt 12 Jul 2005 18:47:24 -0000
@@ -71,10 +71,6 @@ mstack-size=
Target RejectNegative Joined
Emit extra code in the function prologue in order to trap if the stack size exceeds the given limit
-mtpf-trace
-Target Report Mask(TPF_PROFILING)
-Enable tpf OS tracing code
-
mtune=
Target RejectNegative Joined
Schedule code for given CPU
Index: gcc/config/s390/tpf-unwind.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/tpf-unwind.h,v
retrieving revision 1.5
diff -u -p -w -r1.5 tpf-unwind.h
--- gcc/config/s390/tpf-unwind.h 25 Jun 2005 01:22:22 -0000 1.5
+++ gcc/config/s390/tpf-unwind.h 12 Jul 2005 18:47:24 -0000
@@ -28,11 +28,7 @@ along with GCC; see the file COPYING. I
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
-#define __USE_GNU 1
-#define _GNU_SOURCE
#include <dlfcn.h>
-#undef __USE_GNU
-#undef _GNU_SOURCE
/* Function Name: __isPATrange
Parameters passed into it: address to check
Index: gcc/config/s390/tpf.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/tpf.h,v
retrieving revision 1.8
diff -u -p -w -r1.8 tpf.h
--- gcc/config/s390/tpf.h 25 Jun 2005 01:22:22 -0000 1.8
+++ gcc/config/s390/tpf.h 12 Jul 2005 18:47:24 -0000
@@ -33,8 +33,6 @@ Software Foundation, 51 Franklin Street,
#define ASM_APP_OFF "#NO_APP\n"
#define NO_IMPLICIT_EXTERN_C
#define TARGET_HAS_F_SETLKW
-#undef MD_EXEC_PREFIX
-#undef MD_STARTFILE_PREFIX
#undef SIZE_TYPE
#define SIZE_TYPE ("long unsigned int")
@@ -54,11 +52,12 @@ Software Foundation, 51 Franklin Street,
#undef STACK_POINTER_OFFSET
#define STACK_POINTER_OFFSET 448
-/* When building for TPF, set a generic default target that is 64 bits.
- Also, enable TPF profiling support and the standard backchain by default. */
+/* When building for TPF, set a generic default target that is 64 bits. Also
+ enable TPF profiling support and the standard backchain by default. */
#undef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_64BIT | MASK_ZARCH | MASK_HARD_FLOAT \
- | MASK_TPF_PROFILING | MASK_BACKCHAIN)
+#define TARGET_DEFAULT (MASK_TPF_PROFILING | MASK_64BIT \
+ | MASK_HARD_FLOAT | MASK_BACKCHAIN)
+
/* Exception handling. */
/* Select a format to encode pointers in exception handling data. */
@@ -82,45 +81,55 @@ Software Foundation, 51 Franklin Street,
while (0)
+#define EXTRA_SPECS \
+ { "entry_spec", ENTRY_SPEC }
+
/* Make TPF specific spec file settings here. */
#undef STARTFILE_SPEC
#define STARTFILE_SPEC \
- "%{!shared: \
- %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \
- %{!p:%{profile:gcrt1.o%s} \
- %{!profile:crt1.o%s}}}} \
- crti.o%s %{static:crtbeginT.o%s} \
- %{!static:%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}}"
+ "%{mmain:crt0%O%s} crtbeginS%O%s crt3%O%s"
#undef ENDFILE_SPEC
-#define ENDFILE_SPEC \
- "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
+#define ENDFILE_SPEC "crtendS%O%s"
+
+#undef CC1_SPEC
+#define CC1_SPEC "%{!fverbose-asm: -fverbose-asm}"
/* The GNU C++ standard library requires that these macros be defined. */
#undef CPLUSPLUS_CPP_SPEC
#define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
#undef ASM_SPEC
-#define ASM_SPEC "%{m31&m64}%{mesa&mzarch}%{march=*}"
+#define ASM_SPEC "%{m31&m64}%{march=*} \
+ -alshd=%b.lst"
+/* It would be nice to get the system linker script define the ones that it
+ needed. */
#undef LIB_SPEC
-#define LIB_SPEC "%{pthread:-lpthread} -lc"
+#define LIB_SPEC "-lCTIS -lCISO -lCLBM -lCTAL -lCFVS -lCTBX -lCTXO \
+ -lCJ00 -lCTDF -lCOMX -lCOMS -lCTHD -lCTAD -lTPFSTUB"
#undef TARGET_C99_FUNCTIONS
#define TARGET_C99_FUNCTIONS 1
+#define ENTRY_SPEC "%{mmain:-entry=_start} \
+ %{!mmain:-entry=0}"
+
+/* All linking is done shared on TPF-OS. */
+/* FIXME: When binutils patch for new emulation is committed
+ then change emulation to elf64_s390_tpf. */
#undef LINK_SPEC
#define LINK_SPEC \
"-m elf64_s390 \
+ %{static:%estatic is not supported on TPF-OS} \
%{shared:-shared} \
- %{!shared: \
- %{static:-static} \
- %{!static: \
- %{rdynamic:-export-dynamic} \
- %{!dynamic-linker:-dynamic-linker /lib/ld64.so}}}"
+ %{!shared:-shared} \
+ %(entry_spec)"
#define MD_UNWIND_SUPPORT "config/s390/tpf-unwind.h"
+/* IBM copies these libraries over with these names. */
+#define MATH_LIBRARY "-lCLBM"
+#define LIBSTDCXX "-lCPP1"
#endif /* ! _TPF_H */
-
Index: gcc/config/s390/tpf.md
===================================================================
RCS file: gcc/config/s390/tpf.md
diff -N gcc/config/s390/tpf.md
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gcc/config/s390/tpf.md 12 Jul 2005 18:47:24 -0000
@@ -0,0 +1,34 @@
+;; S390 TPF-OS specific machine patterns
+;; Copyright (C) 2005 Free Software Foundation, Inc.
+;;
+;; 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 2, 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 COPYING. If not, write to
+;; the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
+
+(define_insn "prologue_tpf"
+ [(unspec_volatile [(const_int 0)] UNSPECV_TPF_PROLOGUE)
+ (clobber (reg:DI 1))]
+ "TARGET_TPF_PROFILING"
+ "larl\t%%r1,.+14\;tm\t4065,255\;bnz\t4064"
+ [(set_attr "length" "14")])
+
+
+(define_insn "epilogue_tpf"
+ [(unspec_volatile [(const_int 0)] UNSPECV_TPF_EPILOGUE)
+ (clobber (reg:DI 1))]
+ "TARGET_TPF_PROFILING"
+ "larl\t%%r1,.+14\;tm\t4071,255\;bnz\t4070"
+ [(set_attr "length" "14")])
Index: gcc/config/s390/tpf.opt
===================================================================
RCS file: gcc/config/s390/tpf.opt
diff -N gcc/config/s390/tpf.opt
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gcc/config/s390/tpf.opt 12 Jul 2005 18:47:24 -0000
@@ -0,0 +1,28 @@
+; Options for the TPF-OS port of the compiler.
+
+; Copyright (C) 2005 Free Software Foundation, Inc.
+;
+; 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 2, 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 COPYING. If not, write to the Free
+; Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+; 02110-1301, USA.
+
+mtpf-trace
+Target Report Mask(TPF_PROFILING)
+Enable TPF-OS tracing code
+
+mmain
+Target Report
+Specify main object for TPF-OS