[PATCH] Rework to minimize and eventually eliminate RTEMS use of bsp_specs

Joel Sherrill joel at rtems.org
Wed May 16 15:16:57 UTC 2018


---
 gcc/config.gcc                |  2 +-
 gcc/config/arm/rtems.h        |  4 ++++
 gcc/config/bfin/rtems.h       |  4 ++++
 gcc/config/i386/rtemself.h    |  6 +++++-
 gcc/config/i386/rtemself64.h  | 39 +++++++++++++++++++++++++++++++++++++++
 gcc/config/m68k/rtemself.h    |  4 ++++
 gcc/config/microblaze/rtems.h |  4 ++++
 gcc/config/mips/rtems.h       |  4 ++++
 gcc/config/moxie/rtems.h      |  4 ++++
 gcc/config/nios2/rtems.h      |  4 ++++
 gcc/config/riscv/rtems.h      |  4 ++++
 gcc/config/rs6000/rtems.h     |  5 +++++
 gcc/config/rtems.h            |  6 +++++-
 gcc/config/sh/rtems.h         |  4 ++++
 gcc/config/sh/rtemself.h      |  4 ++++
 gcc/config/sparc/rtemself.h   |  4 ++++
 gcc/config/v850/rtems.h       |  4 ++++
 17 files changed, 103 insertions(+), 3 deletions(-)
 create mode 100644 gcc/config/i386/rtemself64.h

diff --git a/gcc/config.gcc b/gcc/config.gcc
index d509800..de27e5c 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1499,7 +1499,7 @@ x86_64-*-elf*)
 	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h"
 	;;
 x86_64-*-rtems*)
-	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h i386/rtemself.h rtems.h"
+	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h i386/rtemself64.h"
 	;;
 i[34567]86-*-rdos*)
     tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/rdos.h"
diff --git a/gcc/config/arm/rtems.h b/gcc/config/arm/rtems.h
index 1123f4a..e79ce90 100644
--- a/gcc/config/arm/rtems.h
+++ b/gcc/config/arm/rtems.h
@@ -34,3 +34,7 @@
     } while (0)
 
 #define ARM_DEFAULT_SHORT_ENUMS false
+
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC "\
+%{!nostdlib: %{!qrtems: crt0.o%s} crti.o%s crtbegin.o%s}"
diff --git a/gcc/config/bfin/rtems.h b/gcc/config/bfin/rtems.h
index 6a9a41f..28a69b9 100644
--- a/gcc/config/bfin/rtems.h
+++ b/gcc/config/bfin/rtems.h
@@ -31,3 +31,7 @@
       builtin_assert ("system=rtems");		\
     }						\
   while (0)
+
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC "\
+%{!nostdlib: %{!qrtems: crt0.o%s} crti.o%s crtbegin.o%s}"
diff --git a/gcc/config/i386/rtemself.h b/gcc/config/i386/rtemself.h
index 65e8dad..3a09354 100644
--- a/gcc/config/i386/rtemself.h
+++ b/gcc/config/i386/rtemself.h
@@ -1,4 +1,4 @@
-/* Definitions for rtems targeting an ix86 using ELF.
+/* Definitions for rtems targeting an x86_64 using ELF.
    Copyright (C) 1996-2018 Free Software Foundation, Inc.
    Contributed by Joel Sherrill (joel at OARcorp.com).
 
@@ -33,3 +33,7 @@
 	builtin_assert ("system=rtems");	\
     }						\
   while (0)
+
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC "\
+%{!nostdlib: %{!qrtems: crt0.o%s} crtbegin.o%s}"
diff --git a/gcc/config/i386/rtemself64.h b/gcc/config/i386/rtemself64.h
new file mode 100644
index 0000000..34e5937
--- /dev/null
+++ b/gcc/config/i386/rtemself64.h
@@ -0,0 +1,39 @@
+/* Definitions for rtems targeting an ix86 using ELF.
+   Copyright (C) 1996-2018 Free Software Foundation, Inc.
+   Contributed by Joel Sherrill (joel at OARcorp.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 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.
+
+   Under Section 7 of GPL version 3, you are granted additional
+   permissions described in the GCC Runtime Library Exception, version
+   3.1, as published by the Free Software Foundation.
+
+   You should have received a copy of the GNU General Public License and
+   a copy of the GCC Runtime Library Exception along with this program;
+   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* Specify predefined symbols in preprocessor.  */
+
+#define TARGET_OS_CPP_BUILTINS()		\
+  do						\
+    {						\
+	builtin_define ("__rtems__");		\
+	builtin_define ("__USE_INIT_FINI__");	\
+	builtin_assert ("system=rtems");	\
+    }						\
+  while (0)
+
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC "\
+%{!nostdlib: %{!qrtems: crt0.o%s} crti.o%s crtbegin.o%s}"
diff --git a/gcc/config/m68k/rtemself.h b/gcc/config/m68k/rtemself.h
index e18a06e..6f31aa5 100644
--- a/gcc/config/m68k/rtemself.h
+++ b/gcc/config/m68k/rtemself.h
@@ -36,3 +36,7 @@
 	builtin_assert ("system=rtems");	\
     }						\
   while (0)
+
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC "\
+%{!nostdlib: %{!qrtems: crt0.o%s} crti.o%s crtbegin.o%s}"
diff --git a/gcc/config/microblaze/rtems.h b/gcc/config/microblaze/rtems.h
index 5f23321..fc8914c 100644
--- a/gcc/config/microblaze/rtems.h
+++ b/gcc/config/microblaze/rtems.h
@@ -35,3 +35,7 @@
   %{mbig-endian:-EB --oformat=elf32-microblaze} \
   %{mlittle-endian:-EL --oformat=elf32-microblazeel} \
   %{mxl-gp-opt:%{G*}} %{!mxl-gp-opt: -G 0}"
+
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC "\
+%{!nostdlib: %{!qrtems: crt0.o%s} crti.o%s crtbegin.o%s}"
diff --git a/gcc/config/mips/rtems.h b/gcc/config/mips/rtems.h
index 66e00bf..6e96853 100644
--- a/gcc/config/mips/rtems.h
+++ b/gcc/config/mips/rtems.h
@@ -37,3 +37,7 @@ do {					\
  */
 #undef MIPS_DEFAULT_GVALUE
 #define MIPS_DEFAULT_GVALUE 0
+
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC "\
+%{!nostdlib: %{!qrtems: crt0.o%s} crti.o%s crtbegin.o%s}"
diff --git a/gcc/config/moxie/rtems.h b/gcc/config/moxie/rtems.h
index bc28d6e..6c79063 100644
--- a/gcc/config/moxie/rtems.h
+++ b/gcc/config/moxie/rtems.h
@@ -38,3 +38,7 @@
 #undef PTRDIFF_TYPE
 #undef WCHAR_TYPE
 #undef WCHAR_TYPE_SIZE
+
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC "\
+%{!nostdlib: %{!qrtems: crt0.o%s} crti.o%s crtbegin.o%s}"
diff --git a/gcc/config/nios2/rtems.h b/gcc/config/nios2/rtems.h
index b4a6082..f6eedf6 100644
--- a/gcc/config/nios2/rtems.h
+++ b/gcc/config/nios2/rtems.h
@@ -37,3 +37,7 @@ do {                                    \
 
    This is done so RTEMS targets have Thread Local Storage like Linux.  */
 #define TARGET_LINUX_ABI 1
+
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC "\
+%{!nostdlib: %{!qrtems: crt0.o%s} crti.o%s crtbegin.o%s}"
diff --git a/gcc/config/riscv/rtems.h b/gcc/config/riscv/rtems.h
index 231b6a0..a9d1e01 100644
--- a/gcc/config/riscv/rtems.h
+++ b/gcc/config/riscv/rtems.h
@@ -29,3 +29,7 @@
 	builtin_define ("__USE_INIT_FINI__");	\
 	builtin_assert ("system=rtems");	\
     } while (0)
+
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC "\
+%{!nostdlib: %{!qrtems: crt0.o%s} crti.o%s crtbegin.o%s}"
diff --git a/gcc/config/rs6000/rtems.h b/gcc/config/rs6000/rtems.h
index 54ddcb4..20a4ffa 100644
--- a/gcc/config/rs6000/rtems.h
+++ b/gcc/config/rs6000/rtems.h
@@ -72,6 +72,11 @@
     }							\
   while (0)
 
+
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC "\
+%{!nostdlib: %{!qrtems: crt0.o%s} ecrti.o%s crtbegin.o%s}"
+
 /* Copy and paste from linux64.h and freebsd64.h */
 #undef RELOCATABLE_NEEDS_FIXUP
 #define RELOCATABLE_NEEDS_FIXUP \
diff --git a/gcc/config/rtems.h b/gcc/config/rtems.h
index dcea95c..9a0619c 100644
--- a/gcc/config/rtems.h
+++ b/gcc/config/rtems.h
@@ -30,11 +30,15 @@
  * Dummy start/end specification to let linker work as
  * needed by autoconf scripts using this compiler.
  */
+#if 0
 #undef STARTFILE_SPEC
-#define STARTFILE_SPEC "crt0.o%s"
+#define STARTFILE_SPEC "%{!qrtems: crt0.o%s}"
+#endif
 
+#if 0
 #undef ENDFILE_SPEC
 #define ENDFILE_SPEC   ""
+#endif
 
 /*
  * Some targets do not set up LIB_SPECS, override it, here.
diff --git a/gcc/config/sh/rtems.h b/gcc/config/sh/rtems.h
index d2f2b2a..f699151 100644
--- a/gcc/config/sh/rtems.h
+++ b/gcc/config/sh/rtems.h
@@ -29,3 +29,7 @@
   builtin_define( "__rtems__" );		\
   builtin_assert( "system=rtems" );		\
 } while (0)
+
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC "\
+%{!nostdlib: %{!qrtems: crt0.o%s} crti.o%s crtbegin.o%s}"
diff --git a/gcc/config/sh/rtemself.h b/gcc/config/sh/rtemself.h
index 6a67b49..85f26b0 100644
--- a/gcc/config/sh/rtemself.h
+++ b/gcc/config/sh/rtemself.h
@@ -29,3 +29,7 @@
   builtin_define( "__rtems__" );		\
   builtin_assert( "system=rtems" );		\
 } while (0)
+
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC "\
+%{!nostdlib: %{!qrtems: crt0.o%s} crti.o%s crtbegin.o%s}"
diff --git a/gcc/config/sparc/rtemself.h b/gcc/config/sparc/rtemself.h
index e4b52d8..7c5bf43 100644
--- a/gcc/config/sparc/rtemself.h
+++ b/gcc/config/sparc/rtemself.h
@@ -38,3 +38,7 @@
 
 /* Use the default */
 #undef LINK_GCC_C_SEQUENCE_SPEC
+
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC "\
+%{!nostdlib: %{!qrtems: crt0.o%s} crti.o%s crtbegin.o%s}"
diff --git a/gcc/config/v850/rtems.h b/gcc/config/v850/rtems.h
index b20b2c3..1b56649 100644
--- a/gcc/config/v850/rtems.h
+++ b/gcc/config/v850/rtems.h
@@ -39,3 +39,7 @@
 %{!mv850es:%{!mv850e1:%{mv*:-mv%*}} \
 %{m8byte-align:-m8byte-align} \
 %{mgcc-abi:-mgcc-abi}}"
+
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC "\
+%{!nostdlib: %{!qrtems: crt0.o%s} crti.o%s crtbegin.o%s}"
-- 
1.8.3.1



More information about the devel mailing list