summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog17
-rw-r--r--gcc/config.gcc29
-rw-r--r--gcc/config/i386/lynx-ng.h70
-rw-r--r--gcc/config/i386/lynx.h96
-rw-r--r--gcc/config/lynx-ng.h110
-rw-r--r--gcc/config/lynx.h297
-rw-r--r--gcc/config/rs6000/lynx.h146
-rw-r--r--gcc/config/rs6000/lynxbase.h45
-rw-r--r--gcc/config/rs6000/t-lynx38
-rw-r--r--gcc/config/t-lynx15
-rw-r--r--gcc/doc/install.texi1
-rw-r--r--gcc/gthr-lynx.h64
12 files changed, 469 insertions, 459 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 761abf8218b..ccbdd46288d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,20 @@
+2004-08-05 Adam Nemet <anemet@lnxw.com>
+
+ * config.gcc (case i[34567]86-*-lynxos*): Update to LynxOS 4.0.
+ (case rs6000-*-lynxos*): Rename it to powerpc-*-lynxos*. Update
+ to LynxOS 4.0.
+ * gthr-lynx.h: New file.
+ * config/lynx-ng.h: Remove file.
+ * config/lynx.h: Update to LynxOS 4.0.
+ * config/t-lynx: New file.
+ * config/i386/lynx-ng.h: Remove file.
+ * config/i386/lynx.h: Update to LynxOS 4.0.
+ * config/rs6000/lynxbase.h: Remove file.
+ * config/rs6000/lynx.h: Update to LynxOS 4.0.
+ * config/rs6000/t-lynx: New file.
+ * doc/install.texi (Options specification): Remove reference to
+ LynxOS from systems where --with-gnu-as makes a difference.
+
2004-08-05 Joseph S. Myers <jsm@polyomino.org.uk>
* c-common.c (c_stddef_cpp_builtins): Define __INTMAX_TYPE__ and
diff --git a/gcc/config.gcc b/gcc/config.gcc
index d20d3c5c3a1..68d80826f2d 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -944,13 +944,13 @@ i[34567]86-pc-msdosdjgpp*)
gas=yes
;;
i[34567]86-*-lynxos*)
- if test x$gas = xyes
- then
- tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h i386/gstabs.h svr3.h lynx.h i386/lynx.h"
- else
- tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h i386/gstabs.h lynx-ng.h i386/lynx-ng.h"
- fi
- use_fixproto=yes
+ xm_defines=POSIX
+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h i386/lynx.h lynx.h"
+ tmake_file="i386/t-crtstuff t-lynx"
+ extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
+ thread_file=lynx
+ gnu_ld=yes
+ gas=yes
;;
i[34567]86-*-nto-qnx*)
tm_file="${tm_file} i386/att.h dbxelf.h tm-dwarf2.h elfos.h svr4.h i386/unix.h i386/nto.h"
@@ -1597,6 +1597,15 @@ powerpc-wrs-windiss*) # Instruction-level simulator for VxWorks.
thread_file=""
use_fixproto=yes
;;
+powerpc-*-lynxos*)
+ xm_defines=POSIX
+ tm_file="${tm_file} dbxelf.h elfos.h rs6000/sysv4.h rs6000/lynx.h lynx.h"
+ tmake_file="t-lynx rs6000/t-lynx"
+ extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
+ thread_file=lynx
+ gnu_ld=yes
+ gas=yes
+ ;;
powerpcle-*-sysv*)
tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/sysv4le.h"
tmake_file="rs6000/t-fprules rs6000/t-ppcos rs6000/t-ppccomm"
@@ -1651,12 +1660,6 @@ rs6000-ibm-aix[56789].* | powerpc-ibm-aix[56789].*)
thread_file='aix'
extra_headers=
;;
-rs6000-*-lynxos*)
- tm_file="svr3.h lynx.h rs6000/lynxbase.h rs6000/rs6000.h rs6000/lynx.h"
- tmake_file=rs6000/t-fprules
- use_collect2=yes
- use_fixproto=yes
- ;;
s390-*-linux*)
tm_file="s390/s390.h dbxelf.h elfos.h svr4.h linux.h s390/linux.h"
tmake_file="${tmake_file} s390/t-crtstuff"
diff --git a/gcc/config/i386/lynx-ng.h b/gcc/config/i386/lynx-ng.h
deleted file mode 100644
index 536aa7af203..00000000000
--- a/gcc/config/i386/lynx-ng.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* Definitions for Intel 386 running LynxOS, using Lynx's old as and ld.
- Copyright (C) 1993, 1995, 2002 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, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-#define TARGET_VERSION fprintf (stderr, " (80386, LYNX BSD syntax)");
-
-#define TARGET_OS_CPP_BUILTINS() \
- do \
- { \
- builtin_define_std ("unix"); \
- builtin_define_std ("I386"); \
- builtin_define_std ("Lynx"); \
- builtin_define_std ("IBITS32"); \
- builtin_assert ("system=unix"); \
- builtin_assert ("system=lynx"); \
- } \
- while (0)
-
-/* Provide required defaults for linker switches. */
-
-#undef LINK_SPEC
-#define LINK_SPEC "-P1000 %{msystem-v:-V} %{mcoff:-k}"
-
-/* Apparently LynxOS clobbers ebx when you call into the OS. */
-
-#undef CALL_USED_REGISTERS
-#define CALL_USED_REGISTERS \
-/*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7,arg*/ \
-{ 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
-
-/* Prefix for internally generated assembler labels. If we aren't using
- underscores, we are using prefix `.'s to identify labels that should
- be ignored, as in `i386/gas.h' --karl@cs.umb.edu */
-
-#undef LPREFIX
-#define LPREFIX ".L"
-
-/* The prefix to add to user-visible assembler symbols. */
-
-#undef USER_LABEL_PREFIX
-#define USER_LABEL_PREFIX ""
-
-/* If user-symbols don't have underscores,
- then it must take more than `L' to identify
- a label that should be ignored. */
-
-/* This is how to store into the string BUF
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'. */
-
-#undef ASM_GENERATE_INTERNAL_LABEL
-#define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER) \
- sprintf ((BUF), ".%s%ld", (PREFIX), (long)(NUMBER))
diff --git a/gcc/config/i386/lynx.h b/gcc/config/i386/lynx.h
index a926d14067c..1aad4d6b121 100644
--- a/gcc/config/i386/lynx.h
+++ b/gcc/config/i386/lynx.h
@@ -1,5 +1,6 @@
-/* Definitions for Intel 386 running LynxOS.
- Copyright (C) 1993, 1995, 1996, 2002 Free Software Foundation, Inc.
+/* Definitions for LynxOS on i386.
+ Copyright (C) 1993, 1995, 1996, 2002, 2004
+ Free Software Foundation, Inc.
This file is part of GCC.
@@ -18,54 +19,79 @@ along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#define TARGET_VERSION fprintf (stderr, " (80386, LYNX BSD syntax)");
+#define TARGET_VERSION fputs (" (i386/LynxOS)", stderr);
#define TARGET_OS_CPP_BUILTINS() \
do \
{ \
- builtin_define_std ("I386"); \
- builtin_define_std ("Lynx"); \
- builtin_define_std ("IBITS32"); \
- builtin_assert ("system=unix"); \
- builtin_assert ("system=lynx"); \
+ builtin_define ("__LITTLE_ENDIAN__"); \
+ builtin_define ("__x86__"); \
} \
while (0)
-/* The prefix to add to user-visible assembler symbols. */
+/* The svr4 ABI for the i386 says that records and unions are returned
+ in memory. */
-/* Override the svr3 convention of adding a leading underscore. */
+#define DEFAULT_PCC_STRUCT_RETURN 1
-#undef USER_LABEL_PREFIX
-#define USER_LABEL_PREFIX ""
+/* BSS_SECTION_ASM_OP gets defined i386/unix.h. */
-/* Apparently LynxOS clobbers ebx when you call into the OS. */
+#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
+ asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
-#undef CALL_USED_REGISTERS
-#define CALL_USED_REGISTERS \
-/*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7,arg*/ \
-{ 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
+/* LynxOS's GDB counts the floating point registers from 16. */
-/* Prefix for internally generated assembler labels. If we aren't using
- underscores, we are using prefix `.'s to identify labels that should
- be ignored, as in `i386/gas.h' --karl@cs.umb.edu */
+#undef DBX_REGISTER_NUMBER
+#define DBX_REGISTER_NUMBER(n) \
+ (TARGET_64BIT ? dbx64_register_map[n] \
+ : (n) == 0 ? 0 \
+ : (n) == 1 ? 2 \
+ : (n) == 2 ? 1 \
+ : (n) == 3 ? 3 \
+ : (n) == 4 ? 6 \
+ : (n) == 5 ? 7 \
+ : (n) == 6 ? 5 \
+ : (n) == 7 ? 4 \
+ : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n) + 8 \
+ : (-1))
+
+/* A C statement to output to the stdio stream FILE an assembler
+ command to advance the location counter to a multiple of 1<<LOG
+ bytes if it is within MAX_SKIP bytes.
-#undef LPREFIX
-#define LPREFIX ".L"
+ This is used to align code labels according to Intel recommendations. */
-/* The prefix to add to user-visible assembler symbols. */
+#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
+#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \
+ do { \
+ if ((LOG) != 0) { \
+ if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
+ else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \
+ } \
+ } while (0)
+#endif
-#undef USER_LABEL_PREFIX
-#define USER_LABEL_PREFIX ""
+/* Since i386.h defines an empty SUBTARGET_SWITCHES the definition in
+ config/lynx.h is omitted. */
-/* If user-symbols don't have underscores,
- then it must take more than `L' to identify
- a label that should be ignored. */
+#undef SUBTARGET_SWITCHES
+#define SUBTARGET_SWITCHES SUBTARGET_OS_LYNX_SWITCHES
-/* This is how to store into the string BUF
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'. */
+/* Undefine SUBTARGET_EXTRA_SPECS it is empty anyway. We define it in
+ config/lynx.h. */
-#undef ASM_GENERATE_INTERNAL_LABEL
-#define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER) \
- sprintf ((BUF), ".%s%ld", (PREFIX), (long)(NUMBER))
+#undef SUBTARGET_EXTRA_SPECS
+
+/* Undefine the definition from att.h to enable our default. */
+
+#undef ASM_OUTPUT_ALIGN
+
+/* Undefine the definition from elfos.h to enable our default. */
+
+#undef PREFERRED_DEBUGGING_TYPE
+
+/* The file i386.c defines TARGET_HAVE_TLS unconditionally if
+ HAVE_AS_TLS is defined. HAVE_AS_TLS is defined as gas support for
+ TLS is detected by configure. We undefine it here. */
+
+#undef HAVE_AS_TLS
diff --git a/gcc/config/lynx-ng.h b/gcc/config/lynx-ng.h
deleted file mode 100644
index a1fe786b463..00000000000
--- a/gcc/config/lynx-ng.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/* Target independent definitions for LynxOS, using Lynx's old as and ld.
- Copyright (C) 1993, 1999 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, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-/* This is for backwards compatibility with older Lynx tools, which use
- a version of a.out format. */
-
-#undef ASM_SPEC
-#define ASM_SPEC "%{mcoff:-C}"
-
-#undef CPP_SPEC
-#define CPP_SPEC "%{mthreads:-D_MULTITHREADED} \
- %{mposix:-D_POSIX_SOURCE} \
- %{msystem-v:-I/usr/include_v}"
-
-/* Provide required defaults for linker switches. */
-
-#undef LINK_SPEC
-#define LINK_SPEC "%{msystem-v:-V} %{mcoff:-k}"
-
-#undef LIB_SPEC
-#define LIB_SPEC "%{mthreads:-L/lib/thread/}%{msystem-v:-lc_v}%{!msystem-v:%{mposix:-lc_p} -lc}"
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "%{p:%{mcoff:pinit1.o%s}%{!mcoff:pinit.o%s}}%{!p:%{msystem-v:%{mcoff:vinit1.o%s}%{!mcoff:vinit.o%s}}%{!msystem-v:%{mcoff:init1.o%s}%{!mcoff:init.o%s}}}"
-
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC "%{mcoff:initn.o%s} %{p:_etext.o%s}"
-
-#undef SIZE_TYPE
-#define SIZE_TYPE "unsigned int"
-
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "int"
-
-#undef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "long int"
-
-/* We want to output DBX debugging information. */
-
-#define DBX_DEBUGGING_INFO 1
-#undef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-
-/* We optionally want to be able to produce SDB debugging output so that
- we can create debuggable SDB/coff files. This won't be needed when
- stabs-in-coff works. */
-
-#define SDB_DEBUGGING_INFO 1
-
-/* Handle #pragma pack and sometimes #pragma weak. */
-
-#define HANDLE_SYSV_PRAGMA 1
-
-#define TARGET_THREADS (target_flags & MASK_THREADS)
-#define MASK_THREADS 0x40000000
-
-#define TARGET_POSIX (target_flags & MASK_POSIX)
-#define MASK_POSIX 0x20000000
-
-#define TARGET_SYSTEM_V (target_flags & MASK_SYSTEM_V)
-#define MASK_SYSTEM_V 0x10000000
-
-#define TARGET_COFF (target_flags & MASK_COFF)
-#define MASK_COFF 0x08000000
-
-#undef SUBTARGET_SWITCHES
-#define SUBTARGET_SWITCHES \
- {"threads", MASK_THREADS}, \
- {"posix", MASK_POSIX}, \
- {"system-v", MASK_SYSTEM_V}, \
- {"coff", MASK_COFF},
-
-#undef SUBTARGET_OVERRIDE_OPTIONS
-#define SUBTARGET_OVERRIDE_OPTIONS \
-{ if (TARGET_SYSTEM_V && profile_flag) \
- warning ("-msystem-v and -p are incompatible"); \
- if (TARGET_SYSTEM_V && TARGET_THREADS) \
- warning ("-msystem-v and -mthreads are incompatible"); }
-
-/* This is defined only so that we can find the assembler. Everything else
- is in /bin. */
-
-#define MD_EXEC_PREFIX "/usr/local/lib/gcc-"
-
-/* This is needed because /bin/ld does not handle -L options correctly. */
-
-#define LINK_LIBGCC_SPECIAL_1
-
-/* The Lynx linker considers __main to be a possible entry point, so we
- must use a different name. */
-
-#define NAME__MAIN "____main"
-#define SYMBOL__MAIN ____main
diff --git a/gcc/config/lynx.h b/gcc/config/lynx.h
index a2366d106da..94780c6c747 100644
--- a/gcc/config/lynx.h
+++ b/gcc/config/lynx.h
@@ -1,5 +1,5 @@
-/* Target independent definitions for LynxOS using gas and gnu ld.
- Copyright (C) 1993, 1994, 1995, 1996, 1999, 2000, 2002, 2003
+/* Target independent definitions for LynxOS.
+ Copyright (C) 1993, 1994, 1995, 1996, 1999, 2000, 2002, 2003, 2004
Free Software Foundation, Inc.
This file is part of GCC.
@@ -19,125 +19,174 @@ along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-/* LynxOS is a multi-platform Unix, similar to SVR3, but not identical. */
-
-/* Define various macros, depending on the combination of flags. */
-
-#undef CPP_SPEC
-#define CPP_SPEC "%{mthreads:-D_MULTITHREADED} \
- %{mposix:-D_POSIX_SOURCE} \
- %{msystem-v:-I/usr/include_v}"
-
-/* No asm spec needed, since using GNU assembler always. */
-
-/* No linker spec needed, since using GNU linker always. */
-
-#undef LIB_SPEC
-#define LIB_SPEC "%{mthreads:-L/lib/thread/} \
- %{msystem-v:-lc_v} \
- %{!msystem-v:%{mposix:-lc_p} -lc -lm}"
-
-/* Set the appropriate names for the Lynx startfiles. */
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "%{p:%{mthreads:thread/pinit1.o%s}%{!mthreads:pinit1.o%s}}%{!p:%{msystem-v:vinit1.o%s -e_start}%{!msystem-v:%{mthreads:thread/init1.o%s}%{!mthreads:init1.o%s}}}"
-
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC "%{p:_etext.o%s}%{!p:initn.o%s}"
-
-/* Override the svr3 versions. */
-
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "int"
-
-#undef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "long int"
-
-/* We want to output DBX (stabs) debugging information normally. */
-
-#define DBX_DEBUGGING_INFO 1
-#undef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-
-/* It is convenient to be able to generate standard coff debugging
- if requested via -gcoff. */
-
-#define SDB_DEBUGGING_INFO 1
-
-/* Be function-relative for block and source line stab directives. */
-
-#define DBX_BLOCKS_FUNCTION_RELATIVE 1
-
-/* but, to make this work, functions must appear prior to line info */
-
-#define DBX_FUNCTION_FIRST
-
-/* Generate a blank trailing N_SO to mark the end of the .o file, since
- we can't depend upon the linker to mark .o file boundaries with
- embedded stabs. */
-
-#define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \
- fprintf (FILE, \
- "\t.text\n\t.stabs \"\",%d,0,0,Letext\nLetext:\n", N_SO)
-
-#undef ASM_OUTPUT_SOURCE_LINE
-#define ASM_OUTPUT_SOURCE_LINE(file, line, counter) \
- { fprintf (file, ".stabn 68,0,%d,.LM%d-", \
- line, counter); \
- assemble_name (file, \
- XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \
- fprintf (file, "\n.LM%d:\n", counter); }
-
-/* Handle #pragma pack and sometimes #pragma weak. */
-
-#define HANDLE_SYSV_PRAGMA 1
-
-/* Some additional command-line options. */
-
-#define TARGET_THREADS (target_flags & MASK_THREADS)
-#define MASK_THREADS 0x40000000
-
-#define TARGET_POSIX (target_flags & MASK_POSIX)
-#define MASK_POSIX 0x20000000
-
-#define TARGET_SYSTEM_V (target_flags & MASK_SYSTEM_V)
-#define MASK_SYSTEM_V 0x10000000
-
-#undef SUBTARGET_SWITCHES
-#define SUBTARGET_SWITCHES \
- {"threads", MASK_THREADS}, \
- {"posix", MASK_POSIX}, \
- {"system-v", MASK_SYSTEM_V},
-
-#undef SUBTARGET_OVERRIDE_OPTIONS
-#define SUBTARGET_OVERRIDE_OPTIONS \
-do { \
- if (TARGET_SYSTEM_V && profile_flag) \
- warning ("-msystem-v and -p are incompatible"); \
- if (TARGET_SYSTEM_V && TARGET_THREADS) \
- warning ("-msystem-v and -mthreads are incompatible"); \
-} while (0)
-
-/* Since init.o et al put all sorts of stuff into the init section,
- we can't use the standard init section support in crtbegin.o. */
-
-#undef INIT_SECTION_ASM_OP
-
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_fini
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
- FINI_SECTION_FUNCTION
-
-#undef CTORS_SECTION_ASM_OP
-#define CTORS_SECTION_ASM_OP "\t.section\t.ctors"
-#undef DTORS_SECTION_ASM_OP
-#define DTORS_SECTION_ASM_OP "\t.section\t.dtors"
-
-#undef DO_GLOBAL_CTORS_BODY
-#undef DO_GLOBAL_DTORS_BODY
-
-/* LynxOS doesn't have mcount. */
-#undef FUNCTION_PROFILER
-#define FUNCTION_PROFILER(file, profile_label_no)
+/* In this file we set up defaults that can be chosen by
+ <target>/lynx.h files. A target-specific lynx.h file can decide
+ either to define and override these definitions or to use them by
+ ensuring they are undefined at this point. If we were to #undef
+ them here we might accidentally disable some target-specific
+ defines. */
+
+#ifndef EXTRA_OS_LYNX_TARGET_SPECS
+# define EXTRA_OS_LYNX_TARGET_SPECS
+#endif
+
+#ifndef EXTRA_OS_LYNX_SPECS
+# define EXTRA_OS_LYNX_SPECS \
+ { "cpp_os_lynx", CPP_OS_LYNX_SPEC }, \
+ { "lib_os_lynx", LIB_OS_LYNX_SPEC }, \
+ { "link_os_lynx", LINK_OS_LYNX_SPEC }, \
+ { "startfile_os_lynx", STARTFILE_OS_LYNX_SPEC }, \
+ { "endfile_os_lynx", ENDFILE_OS_LYNX_SPEC }, \
+ EXTRA_OS_LYNX_TARGET_SPECS
+#endif
+
+#ifndef SUBTARGET_EXTRA_SPECS
+# define SUBTARGET_EXTRA_SPECS EXTRA_OS_LYNX_SPECS
+#endif
+
+#ifndef CPP_SPEC
+# define CPP_SPEC "%(cpp_cpu) %(cpp_os_lynx)"
+#endif
+
+#ifndef LIB_SPEC
+# define LIB_SPEC "%(lib_os_lynx)"
+#endif
+
+#ifndef LINK_SPEC
+# define LINK_SPEC "%(link_os_lynx)"
+#endif
+
+#ifndef STARTFILE_SPEC
+# define STARTFILE_SPEC "%(startfile_os_lynx)"
+#endif
+
+#ifndef ENDFILE_SPEC
+# define ENDFILE_SPEC "%(endfile_os_lynx)"
+#endif
+
+#ifndef CPP_OS_LYNX_SPEC
+# define CPP_OS_LYNX_SPEC \
+"%{mthreads: \
+ %{mlegacy-threads: \
+ %eCannot use mthreads and mlegacy-threads together.}} \
+ %{mthreads: -D_MULTITHREADED} \
+ %{mlegacy-threads: -D_THREADS_POSIX4ad4} \
+ -Asystem=lynx -Asystem=unix -D__Lynx__ -D__unix__"
+#endif
+
+#ifndef LIB_OS_LYNX_SPEC
+# define LIB_OS_LYNX_SPEC \
+"%{mlegacy-threads:-lposix-pre1c} -lm -lc"
+#endif
+
+/* We link static executables for LynxOS by default unless -mshared is
+ used when linking an executable. Along the same line, we link to
+ shared libraries when linking a shared object by default unless
+ -static is used.
+
+ We have to pass in our -L options here otherwise the translated
+ startfile directories (%D) will take priority over this.
+ Furthermore since we have to pass in -L options here we have to
+ make sure that -L options provided by the user take priority over
+ everything we specify. */
+
+#ifndef LINK_OS_LYNX_SPEC
+# define LINK_OS_LYNX_SPEC \
+"%{shared} %{static} \
+ %{mshared: %{static: %eCannot use mshared and static together.}} \
+ %{!mshared: %{!shared: %{!static: -static}}} \
+ %{L*} \
+ %{mthreads: \
+ %{mshared: -L/lib/thread/shlib -rpath /lib/thread/shlib} \
+ %{shared: \
+ %{!static: -L/lib/thread/shlib -rpath /lib/thread/shlib} \
+ %{!mshared: -L/lib/thread}} \
+ %{shared: %{static: -L/lib/thread}}} \
+ %{!mthreads: \
+ %{mshared: -L/lib/shlib -rpath /lib/shlib} \
+ %{shared: -L/lib/shlib -rpath /lib/shlib}} \
+ %{mlegacy-threads:-lposix-pre1c} -lm -lc"
+#endif
+
+#ifndef STARTFILE_OS_LYNX_SPEC
+# define STARTFILE_OS_LYNX_SPEC \
+"%{!shared: \
+ %{!mthreads: \
+ %{p:gcrt1.o%s} %{pg:gcrt1.o%s} \
+ %{!p:%{!pg:crt1.o%s}}} \
+ %{mthreads: \
+ %{p:thread/gcrt1.o%s} %{pg:thread/gcrt1.o%s} \
+ %{!p:%{!pg:thread/crt1.o%s }}}}\
+ %{mthreads: thread/crti.o%s} %{!mthreads: crti.o%s} \
+ %{!shared: crtbegin.o%s} \
+ %{shared: crtbeginS.o%s}"
+#endif
+
+#ifndef ENDFILE_OS_LYNX_SPEC
+# define ENDFILE_OS_LYNX_SPEC \
+"%{!shared: crtend.o%s} \
+ %{shared: crtendS.o%s} \
+ %{mthreads: thread/crtn.o%s} %{!mthreads: crtn.o%s}"
+#endif
+
+/* Because of the %{m*} in cc1_options these options get substituted
+ for cc1. We ignore them here. */
+
+#ifndef SUBTARGET_OS_LYNX_SWITCHES
+# define SUBTARGET_OS_LYNX_SWITCHES \
+ { "shared", 0, N_("Use shared libraries") }, \
+ { "threads", 0, N_("Support multi-threading") }, \
+ { "legacy-threads", 0, N_("Support legacy multi-threading") },
+#endif
+
+#ifndef SUBTARGET_SWITCHES
+# define SUBTARGET_SWITCHES SUBTARGET_OS_LYNX_SWITCHES
+#endif
+
+/* Define the actual types of some ANSI-mandated types. */
+
+#ifndef SIZE_TYPE
+# define SIZE_TYPE "unsigned int"
+#endif
+
+#ifndef PTRDIFF_TYPE
+# define PTRDIFF_TYPE "int"
+#endif
+
+#ifndef WCHAR_TYPE
+# define WCHAR_TYPE "long int"
+#endif
+
+#ifndef WCHAR_TYPE_SIZE
+# define WCHAR_TYPE_SIZE BITS_PER_WORD
+#endif
+
+/* Define ASM_OUTPUT_ALIGN to use the .balign directive rather that
+ the .align directive with GAS. */
+
+#ifndef ASM_OUTPUT_ALIGN
+# define ASM_OUTPUT_ALIGN(FILE, LOG) \
+ do \
+ { \
+ if ((LOG) != 0) \
+ fprintf ((FILE), "\t.balign %d\n", 1 << (LOG)); \
+ } \
+ while (0)
+#endif
+
+/* Keep the *_DEBUGGING_INFO defines from elfos.h except that stabs is
+ the default on LynxOS. */
+
+#ifndef PREFERRED_DEBUGGING_TYPE
+# define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
+#endif
+
+/* We have C++ support in our system headers. */
+
+#ifndef NO_IMPLICIT_EXTERN_C
+# define NO_IMPLICIT_EXTERN_C
+#endif
+
+#ifndef TARGET_HAS_F_SETLKW
+# define TARGET_HAS_F_SETLKW
+#endif
diff --git a/gcc/config/rs6000/lynx.h b/gcc/config/rs6000/lynx.h
index b32b07890ae..fb02f517d6f 100644
--- a/gcc/config/rs6000/lynx.h
+++ b/gcc/config/rs6000/lynx.h
@@ -1,6 +1,8 @@
/* Definitions for Rs6000 running LynxOS.
- Copyright (C) 1995, 1996, 2000, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 2000, 2002, 2003, 2004
+ Free Software Foundation, Inc.
Contributed by David Henkel-Wallace, Cygnus Support (gumby@cygnus.com)
+ Rewritten by Adam Nemet, LynuxWorks Inc.
This file is part of GCC.
@@ -19,69 +21,91 @@
Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
-/* Print subsidiary information on the compiler version in use. */
-#define TARGET_VERSION fprintf (stderr, " (LynxOS-RS/6000)");
-
-/* LynxOS has signed chars, regardless of what most R/S 6000 systems do */
-#undef DEFAULT_SIGNED_CHAR
-#define DEFAULT_SIGNED_CHAR 1
-
-#undef TARGET_OS_CPP_BUILTINS
-#define TARGET_OS_CPP_BUILTINS() \
- do \
- { \
- builtin_assert ("cpu=rs6000"); \
- builtin_assert ("machine=rs6000"); \
- builtin_assert ("system=lynx"); \
- builtin_assert ("system=unix"); \
- builtin_define_std ("Lynx"); \
- builtin_define ("_IBMR2"); \
- builtin_define_std ("unix"); \
- builtin_define_std ("rs6000"); \
- builtin_define_std ("lynx"); \
- builtin_define_std ("LYNX"); \
- } \
- while (0)
+/* Override the definition in sysv4.h. */
+
+#undef TARGET_VERSION
+#define TARGET_VERSION fputs (" (PowerPC/LynxOS)", stderr);
+
+/* Undefine the definition to enable the LynxOS default from the
+ top-level lynx.h. */
+
+#undef SUBTARGET_EXTRA_SPECS
+
+/* Get rid off the spec definitions from rs6000/sysv4.h. */
-#undef LINK_SPEC
-#define LINK_SPEC "-T0x10001000 -H0x1000 -D0x20000000 -btextro -bhalt:4 -bnodelcsect -bnso -bro -bnoglink %{v} %{b*}"
+#undef CPP_SPEC
+#define CPP_SPEC \
+"%{msoft-float: -D_SOFT_FLOAT} \
+ %(cpp_cpu) \
+ %(cpp_os_lynx)"
-#undef LIB_SPEC
-#define LIB_SPEC "%{mthreads:-L/lib/thread/} \
- %{msystem-v:-lc_v -lm.v} \
- %{!msystem-v:%{mposix:-lc_p} -lc -lm}"
+/* LynxOS only supports big-endian on PPC so we override the
+ definition from sysv4.h. Since the LynxOS 4.0 compiler was set to
+ return every structure in memory regardless of their size we have
+ to emulate the same behavior here with disabling the SVR4 structure
+ returning. */
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "%{p:%{mthreads:thread/pinit.o%s}%{!mthreads:pinit.o%s}}%{!p:%{msystem-v:vinit.o%s -e_start}%{!msystem-v:%{mthreads:thread/init.o%s}%{!mthreads:init.o%s}}}"
+#undef CC1_SPEC
+#define CC1_SPEC \
+"%{G*} %{mno-sdata:-msdata=none} \
+ %{maltivec:-mabi=altivec} \
+ -mno-svr4-struct-return"
+#undef ASM_SPEC
+#define ASM_SPEC \
+"%(asm_cpu) \
+ %{.s: %{mregnames} %{mno-regnames}} \
+ %{.S: %{mregnames} %{mno-regnames}}"
+
+#undef STARTFILE_SPEC
#undef ENDFILE_SPEC
+#undef LIB_SPEC
+#undef LINK_SPEC
+#define LINK_SPEC \
+"%{!msdata=none:%{G*}} %{msdata=none:-G0} \
+ %(link_os_lynx)"
+
+/* Override the definition from sysv4.h. */
+
+#undef TARGET_OS_CPP_BUILTINS
+#define TARGET_OS_CPP_BUILTINS() \
+ do \
+ { \
+ builtin_define ("__BIG_ENDIAN__"); \
+ builtin_define ("__powerpc__"); \
+ builtin_assert ("cpu=powerpc"); \
+ builtin_assert ("machine=powerpc"); \
+ builtin_define ("__PPC__"); \
+ } \
+ while (0)
+
+/* Override the rs6000.h definition. */
+
+#undef ASM_APP_ON
+#define ASM_APP_ON "#APP\n"
+
+/* Override the rs6000.h definition. */
+
+#undef ASM_APP_OFF
+#define ASM_APP_OFF "#NO_APP\n"
+
+#undef EXTRA_SUBTARGET_SWITCHES
+#define EXTRA_SUBTARGET_SWITCHES SUBTARGET_OS_LYNX_SWITCHES
+
+/* LynxOS does not do anything with .fixup plus let's not create
+ writable section for linkonce.r and linkonce.t. */
+
+#undef RELOCATABLE_NEEDS_FIXUP
+
+/* Override these from rs6000.h with the generic definition. */
+
+#undef SIZE_TYPE
+#undef ASM_OUTPUT_ALIGN
+#undef PREFERRED_DEBUGGING_TYPE
+
+/* The file rs6000.c defines TARGET_HAVE_TLS unconditionally to the
+ value of HAVE_AS_TLS. HAVE_AS_TLS is true as gas support for TLS
+ is detected by configure. Override the definition to false. */
-/* This can become more refined as we have more powerpc options. */
-#undef ASM_SPEC
-#define ASM_SPEC "-u %(asm_cpu)"
-
-#undef SUBTARGET_SWITCHES
-#define SUBTARGET_SWITCHES \
- {"threads", MASK_THREADS}, \
- {"posix", MASK_POSIX}, \
- {"system-v", MASK_SYSTEM_V},
-
-#undef SUBTARGET_OVERRIDE_OPTIONS
-#define SUBTARGET_OVERRIDE_OPTIONS \
-do { \
- if (TARGET_SYSTEM_V && profile_flag) \
- warning ("-msystem-v and -p are incompatible"); \
- if (TARGET_SYSTEM_V && TARGET_THREADS) \
- warning ("-msystem-v and -mthreads are incompatible"); \
-} while (0)
-
-/* For collect2 */
-#define OBJECT_FORMAT_NONE
-#undef OBJECT_FORMAT_COFF
-#undef MD_EXEC_PREFIX
-#undef REAL_LD_FILE_NAME
-#undef REAL_STRIP_FILE_NAME
-
-/* LynxOS doesn't have mcount. */
-#undef FUNCTION_PROFILER
-#define FUNCTION_PROFILER(file, profile_label_no)
+#undef HAVE_AS_TLS
+#define HAVE_AS_TLS 0
diff --git a/gcc/config/rs6000/lynxbase.h b/gcc/config/rs6000/lynxbase.h
deleted file mode 100644
index 02a255254a5..00000000000
--- a/gcc/config/rs6000/lynxbase.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Definitions for Rs6000 running LynxOS.
- Copyright (C) 2003 Free Software Foundation, Inc.
- Contributed by David Henkel-Wallace, Cygnus Support (gumby@cygnus.com)
-
- 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, 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA. */
-
-/* Definitions we want to override with those from rs6000.h: */
-#undef LIB_SPEC
-#undef PTRDIFF_TYPE
-#undef SIZE_TYPE
-#undef WCHAR_TYPE
-#undef WCHAR_TYPE_SIZE
-#undef EXTRA_SECTIONS
-#undef READONLY_DATA_SECTION
-#undef READONLY_DATA_SECTION_ASM_OP
-#undef EXTRA_SECTION_FUNCTIONS
-#undef TARGET_ASM_SELECT_RTX_SECTION
-#undef TARGET_ASM_SELECT_SECTION
-#undef USER_LABEL_PREFIX
-#undef ASM_OUTPUT_LABELREF
-#undef ASM_GENERATE_INTERNAL_LABEL
-#undef ASM_OUTPUT_COMMON
-#undef ASM_OUTPUT_LOCAL
-
-#undef SDB_DEBUGGING_INFO
-#undef DBX_DEBUGGING_INFO
-#undef PREFERRED_DEBUGGING_TYPE
-
-#undef FUNCTION_PROFILER
-#undef SUBTARGET_SWITCHES
diff --git a/gcc/config/rs6000/t-lynx b/gcc/config/rs6000/t-lynx
new file mode 100644
index 00000000000..429f641ece2
--- /dev/null
+++ b/gcc/config/rs6000/t-lynx
@@ -0,0 +1,38 @@
+LIB2FUNCS_EXTRA = tramp.S
+
+tramp.S: $(srcdir)/config/rs6000/tramp.asm
+ cat $(srcdir)/config/rs6000/tramp.asm > tramp.S
+
+FPBIT = fp-bit.c
+DPBIT = dp-bit.c
+
+dp-bit.c: $(srcdir)/config/fp-bit.c
+ cat $(srcdir)/config/fp-bit.c > dp-bit.c
+
+fp-bit.c: $(srcdir)/config/fp-bit.c
+ echo '#define FLOAT' > fp-bit.c
+ cat $(srcdir)/config/fp-bit.c >> fp-bit.c
+
+LIBGCC = stmp-multilib
+INSTALL_LIBGCC = install-multilib
+
+MULTILIB_OPTIONS += msoft-float
+MULTILIB_DIRNAMES += soft-float
+
+MULTILIB_OPTIONS += maltivec
+MULTILIB_DIRNAMES += altivec
+
+MULTILIB_EXCEPTIONS = *msoft-float/*maltivec*
+
+EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o
+
+# If .sdata is enabled __CTOR_{LIST,END}__ go into .sdata instead of
+# .ctors.
+CRTSTUFF_T_CFLAGS = -mno-sdata
+
+# Compile crtbeginS.o and crtendS.o with pic.
+CRTSTUFF_T_CFLAGS_S = -fPIC -mno-sdata
+
+Local Variables:
+mode: makefile
+End:
diff --git a/gcc/config/t-lynx b/gcc/config/t-lynx
new file mode 100644
index 00000000000..a14a53c614e
--- /dev/null
+++ b/gcc/config/t-lynx
@@ -0,0 +1,15 @@
+# Compile crtbeginS.o and crtendS.o with pic.
+CRTSTUFF_T_CFLAGS_S = -fPIC
+
+# Compile libgcc2.a with pic.
+TARGET_LIBGCC2_CFLAGS = -fPIC
+
+MULTILIB_OPTIONS = mthreads
+MULTILIB_DIRNAMES = thread
+
+LIBGCC = stmp-multilib
+INSTALL_LIBGCC = install-multilib
+
+Local Variables:
+mode: makefile
+End:
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index ddbc1bc9960..64c120531b1 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -790,7 +790,6 @@ whether you use the GNU assembler. On any other system,
@item @samp{m68k-hp-hpux}
@item @samp{m68000-hp-hpux}
@item @samp{m68000-att-sysv}
-@item @samp{@var{any}-lynx-lynxos}
@item @samp{mips-@var{any}}
@item @samp{sparc-sun-solaris2.@var{any}}
@item @samp{sparc64-@var{any}-solaris2.@var{any}}
diff --git a/gcc/gthr-lynx.h b/gcc/gthr-lynx.h
new file mode 100644
index 00000000000..651d7198f11
--- /dev/null
+++ b/gcc/gthr-lynx.h
@@ -0,0 +1,64 @@
+/* Threads compatibility routines for libgcc2 and libobjc for
+ LynxOS. */
+/* Compile this one with gcc. */
+/* Copyright (C) 2004 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, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+/* As a special exception, if you link this library with other files,
+ some of which are compiled with GCC, to produce an executable,
+ this library does not by itself cause the resulting executable
+ to be covered by the GNU General Public License.
+ This exception does not however invalidate any other reasons why
+ the executable file might be covered by the GNU General Public License. */
+
+#ifndef GCC_GTHR_LYNX_H
+#define GCC_GTHR_LYNX_H
+
+#ifdef _MULTITHREADED
+
+/* Using the macro version of pthread_setspecific leads to a
+ compilation error. Instead we have two choices either kill all
+ macros in pthread.h with defining _POSIX_THREADS_CALLS or undefine
+ individual macros where we should fall back on the function
+ implementation. We choose the second approach. */
+
+#include <pthread.h>
+#undef pthread_setspecific
+
+/* When using static libc on LynxOS, we cannot define pthread_create
+ weak. If the multi-threaded application includes iostream.h,
+ gthr-posix.h is included and pthread_create will be defined weak.
+ If pthead_create is weak its defining module in libc is not
+ necessarly included in the link and the symbol is resolved to zero.
+ Therefore the first call to it will crash.
+
+ Since -mthreads is a multilib switch on LynxOS we know that at this
+ point we are compiling for multi-threaded. Omitting the weak
+ definitions at this point should have no effect. */
+
+#undef GTHREAD_USE_WEAK
+#define GTHREAD_USE_WEAK 0
+
+#include "gthr-posix.h"
+
+#else
+#include "gthr-single.h"
+#endif
+
+#endif /* GCC_GTHR_LYNX_H */