public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-5938] VxWorks config fixes for shared objects
@ 2021-12-13 18:03 Olivier Hainque
  0 siblings, 0 replies; only message in thread
From: Olivier Hainque @ 2021-12-13 18:03 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:0515c95d5fe0a865f688f3ab89572b917e8f0185

commit r12-5938-g0515c95d5fe0a865f688f3ab89572b917e8f0185
Author: Frederic Konrad <konrad@adacore.com>
Date:   Fri Nov 6 19:42:27 2020 +0100

    VxWorks config fixes for shared objects
    
    This strengthens the VxWorks configuration files for the support
    of shared objects, which encompasses a VxWorks specific "non-static"
    mode for RTPs (in addition to -static and -shared).
    
    2020-11-06  Fred Konrad  <konrad@adacore.com>
                Olivier Hainque  <hainque@adacore.com>
    
    gcc/
            * config/vx-common.h: Define REAL_LIBGCC_SPEC since the
            '-non-static' option is not standard.
            * config/vxworks.h (VXWORKS_LIBGCC_SPEC): Implement the LIBGCC_SPEC
            since REAL_LIBGCC_SPEC is used now.
            (STARTFILE_PREFIX_SPEC): Use the PIC VSB when building shared libraries
            or non-static binaries.

Diff:
---
 gcc/config/vx-common.h |  7 +++++--
 gcc/config/vxworks.h   | 19 ++++++++++++++++++-
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/gcc/config/vx-common.h b/gcc/config/vx-common.h
index a436bf14074..efa5d5f6a60 100644
--- a/gcc/config/vx-common.h
+++ b/gcc/config/vx-common.h
@@ -23,8 +23,11 @@ along with GCC; see the file COPYING3.  If not see
 /* Most of these will probably be overridden by subsequent headers.  We
    undefine them here just in case, and define VXWORKS_ versions of each,
    to be used in port-specific vxworks.h.  */
-#undef LIBGCC_SPEC
-#define LIBGCC_SPEC VXWORKS_LIBGCC_SPEC
+
+/* REAL_LIBGCC_SPEC needs to be used since the non-static option is not
+   handled in gcc.c.  */
+#undef REAL_LIBGCC_SPEC
+#define REAL_LIBGCC_SPEC VXWORKS_LIBGCC_SPEC
 #undef STARTFILE_SPEC
 #undef ENDFILE_SPEC
 
diff --git a/gcc/config/vxworks.h b/gcc/config/vxworks.h
index f76141ffdca..96076e3c272 100644
--- a/gcc/config/vxworks.h
+++ b/gcc/config/vxworks.h
@@ -143,11 +143,21 @@ along with GCC; see the file COPYING3.  If not see
    tlsLib, responsible for TLS support by the OS.  */
 
 #if TARGET_VXWORKS7
+
+/* For static links, /usr/lib/common has everything. For dynamic links,
+   /usr/lib/common/PIC has the static libs and objects that might be needed
+   in the closure (e.g. crt0.o), while the shared version of standard deps
+   (e.g. libc.so) are still in /usr/lib/common.  */
 #undef  STARTFILE_PREFIX_SPEC
-#define STARTFILE_PREFIX_SPEC "/usr/lib/common"
+#define STARTFILE_PREFIX_SPEC \
+  "%{shared|non-static:/usr/lib/common/PIC} /usr/lib/common"
+
 #define TLS_SYM "-u __tls__"
+
 #else
+
 #define TLS_SYM ""
+
 #endif
 
 #undef VXWORKS_LIB_SPEC
@@ -177,7 +187,14 @@ along with GCC; see the file COPYING3.  If not see
  		  %{non-static:--force-dynamic --export-dynamic}}}"
 
 #undef VXWORKS_LIBGCC_SPEC
+#if defined(ENABLE_SHARED_LIBGCC)
+#define VXWORKS_LIBGCC_SPEC                                             \
+"%{!mrtp:-lgcc -lgcc_eh}                                                \
+ %{mrtp:%{!static-libgcc:%{shared|non-static:-lgcc_s;:-lgcc -lgcc_eh}}  \
+         %{static-libgcc:-lgcc -lgcc_eh}}"
+#else
 #define VXWORKS_LIBGCC_SPEC "-lgcc"
+#endif
 
 /* Setup the crtstuff begin/end we might need for dwarf EH registration.  */


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-12-13 18:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-13 18:03 [gcc r12-5938] VxWorks config fixes for shared objects Olivier Hainque

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).