/* 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
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
%{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. */