Hello,
I would like to get rid of the -qrtems command for normal RTEMS
applications. The difficulty is that the configuration process to build
GCC with all the target libraries (libatomic, libstdc++, libgomp, etc.)
relies on some link time tests which use the crt0.o, libc.a and libm.a.
The attached patch introduces a new -qrtemsstub command line option
which is enabled during the GCC target library build. In case this
option is not present, then the standard RTEMS libraries will be used,
e.g. librtemscpu.a, librtemsbsp.a, libc.a, etc. For backward
compatibility the -qrtems option is ignored.
--
Sebastian Huber, embedded brains GmbH
Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
>From b29ab1d5cfa80083de4edc81753b7f91a847ef6b Mon Sep 17 00:00:00 2001
From: Sebastian Huber <sebastian.hu...@embedded-brains.de>
Date: Mon, 24 Jun 2019 09:45:54 +0200
Subject: [PATCH] RTEMS: Introduce -qrtemsstub
---
configure | 3 +++
configure.ac | 3 +++
gcc/config/rtems.h | 23 ++++++++++-------------
gcc/config/rtems.opt | 3 +++
4 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/configure b/configure
index 63b1e33f41c..b13281a82af 100755
--- a/configure
+++ b/configure
@@ -7627,6 +7627,9 @@ case " $target_configdirs " in
*-cygwin*)
FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(TARGET_SUBDIR)/winsup/cygwin -isystem $$s/winsup/cygwin/include'
;;
+ *-rtems*)
+ LDFLAGS_FOR_TARGET=$LDFLAGS_FOR_TARGET' -qrtemsstub'
+ ;;
esac
# If we're not building GCC, don't discard standard headers.
diff --git a/configure.ac b/configure.ac
index dcc89fbdde1..f69f31a91a5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3143,6 +3143,9 @@ case " $target_configdirs " in
*-cygwin*)
FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(TARGET_SUBDIR)/winsup/cygwin -isystem $$s/winsup/cygwin/include'
;;
+ *-rtems*)
+ LDFLAGS_FOR_TARGET=$LDFLAGS_FOR_TARGET' -qrtemsstub'
+ ;;
esac
# If we're not building GCC, don't discard standard headers.
diff --git a/gcc/config/rtems.h b/gcc/config/rtems.h
index 71ae2fd3575..eea6b2248e8 100644
--- a/gcc/config/rtems.h
+++ b/gcc/config/rtems.h
@@ -23,25 +23,22 @@
<http://www.gnu.org/licenses/>. */
/*
- * Dummy start/end specification to let linker work as
- * needed by autoconf scripts using this compiler.
+ * Dummy start/end specification to let linker work as needed by autoconf
+ * scripts using this compiler if requested by -qrtemsstub.
*/
+
#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "crt0.o%s"
+#define STARTFILE_SPEC "%{qrtemsstub: crt0.o%s}"
#undef ENDFILE_SPEC
-#define ENDFILE_SPEC ""
-
-/*
- * Some targets do not set up LIB_SPECS, override it, here.
- */
-#define STD_LIB_SPEC "%{!shared:%{g*:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}}"
+#define ENDFILE_SPEC ""
#undef LIB_SPEC
-#define LIB_SPEC "%{!qrtems: " STD_LIB_SPEC "} " \
-"%{!nostdlib: %{qrtems: --start-group \
- -lrtemsbsp -lrtemscpu \
- -latomic -lc -lgcc --end-group %{!qnolinkcmds: -T linkcmds%s}}}"
+#define LIB_SPEC \
+"%{qrtemsstub: %{!shared:%{g*:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}}} \
+%{!nostdlib: %{--start-group \
+-lrtemsbsp -lrtemscpu -latomic -lc -lgcc \
+--end-group %{!qnolinkcmds: -T linkcmds%s}}}"
#define TARGET_POSIX_IO
diff --git a/gcc/config/rtems.opt b/gcc/config/rtems.opt
index d09fd507777..6ce0407bf79 100644
--- a/gcc/config/rtems.opt
+++ b/gcc/config/rtems.opt
@@ -32,4 +32,7 @@ Driver
qrtems
Driver
+qrtemsstub
+Driver
+
; This comment is to ensure we retain the blank line above.
--
2.16.4
_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel