===================================================================
@@ -54,7 +54,6 @@ along with GCC; see the file COPYING3.
#undef GNU_USER_TARGET_LINK_SPEC
#define GNU_USER_TARGET_LINK_SPEC "\
- %{G*} %{EB} %{EL} %{mips*} %{shared} \
%{!shared: \
%{!static: \
%{rdynamic:-export-dynamic} \
@@ -66,8 +65,8 @@ along with GCC; see the file COPYING3.
%{mabi=64:-m" GNU_USER_LINK_EMULATION64 "} \
%{mabi=32:-m" GNU_USER_LINK_EMULATION32 "}"
-#undef LINK_SPEC
-#define LINK_SPEC GNU_USER_TARGET_LINK_SPEC
+#undef SUBTARGET_LINK_SPEC
+#define SUBTARGET_LINK_SPEC GNU_USER_TARGET_LINK_SPEC
#undef SUBTARGET_ASM_SPEC
#define SUBTARGET_ASM_SPEC \
===================================================================
@@ -27,8 +27,8 @@ along with GCC; see the file COPYING3.
ANDROID_TARGET_OS_CPP_BUILTINS(); \
} while (0)
-#undef LINK_SPEC
-#define LINK_SPEC \
+#undef SUBTARGET_LINK_SPEC
+#define SUBTARGET_LINK_SPEC \
LINUX_OR_ANDROID_LD (GNU_USER_TARGET_LINK_SPEC, \
GNU_USER_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC)
===================================================================
@@ -1334,11 +1334,27 @@ FP_ASM_SPEC "\
/* Extra switches sometimes passed to the linker. */
+/* SUBTARGET_LINK_SPEC is always passed to the linker. It may be
+ overridden by subtargets. */
+
+#ifndef SUBTARGET_LINK_SPEC
+#define SUBTARGET_LINK_SPEC ""
+#endif
+
+/* LINK_SHARED_SPEC is usually set to `%{shared}', however some
+ subtargets may have other means to include this spec and wish
+ to override this macro. Notice the leading space. */
+
+#ifndef LINK_SHARED_SPEC
+#define LINK_SHARED_SPEC " %{shared}"
+#endif
+
#ifndef LINK_SPEC
#define LINK_SPEC "\
%(endian_spec) \
-%{G*} %{mips1} %{mips2} %{mips3} %{mips4} %{mips32*} %{mips64*} \
-%{shared}"
+%{G*} %{mips1} %{mips2} %{mips3} %{mips4} %{mips32*} %{mips64*}" \
+LINK_SHARED_SPEC " \
+%(subtarget_link_spec)"
#endif /* LINK_SPEC defined */
@@ -1382,6 +1398,7 @@ FP_ASM_SPEC "\
{ "subtarget_cpp_spec", SUBTARGET_CPP_SPEC }, \
{ "subtarget_asm_debugging_spec", SUBTARGET_ASM_DEBUGGING_SPEC }, \
{ "subtarget_asm_spec", SUBTARGET_ASM_SPEC }, \
+ { "subtarget_link_spec", SUBTARGET_LINK_SPEC }, \
{ "asm_abi_default_spec", "-" MULTILIB_ABI_DEFAULT }, \
{ "endian_spec", ENDIAN_SPEC }, \
SUBTARGET_EXTRA_SPECS
===================================================================
@@ -124,17 +124,20 @@ along with GCC; see the file COPYING3.
#undef SUBTARGET_CPP_SPEC
#define SUBTARGET_CPP_SPEC "%(netbsd_cpp_spec)"
-/* Provide a LINK_SPEC appropriate for a NetBSD/mips target.
+/* LINK_SHARED_SPEC is usually set to `%{shared}', however we already
+ include this spec in `%(netbsd_link_spec)', so set this macro to nil. */
+
+#undef LINK_SHARED_SPEC
+#define LINK_SHARED_SPEC ""
+
+/* Provide a SUBTARGET_LINK_SPEC appropriate for a NetBSD/mips target.
This is a copy of LINK_SPEC from <netbsd-elf.h> tweaked for
the MIPS target. */
-#undef LINK_SPEC
-#define LINK_SPEC \
+#undef SUBTARGET_LINK_SPEC
+#define SUBTARGET_LINK_SPEC \
"%{EL:-m elf32lmip} \
%{EB:-m elf32bmip} \
- %(endian_spec) \
- %{G*} %{mips1} %{mips2} %{mips3} %{mips4} %{mips32} %{mips32r2} \
- %{mips32r6} %{mips64} %{mips64r6} \
%(netbsd_link_spec)"
#define NETBSD_ENTRY_POINT "__start"
===================================================================
@@ -57,11 +57,8 @@ along with GCC; see the file COPYING3.
%{!mips1:--trap} \
%{mips16:-no-mips16}"
-#undef LINK_SPEC
-#define LINK_SPEC "\
-%(endian_spec) \
-%{G*} %{mips1} %{mips2} %{mips3} %{mips4} %{mips32*} %{mips64*} \
-%{shared} \
+#undef SUBTARGET_LINK_SPEC
+#define SUBTARGET_LINK_SPEC "\
%{mabi=n32:-melf32%{EB:b}%{EL:l}tsmipn32} \
%{mabi=64:-melf64%{EB:b}%{EL:l}tsmip} \
%{mabi=32:-melf32%{EB:b}%{EL:l}tsmip}"