https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71749
--- Comment #2 from Claudiu Zissulescu ---
Proposed patch for mainline:
diff --git a/gcc/config/arc/arc.h b/gcc/config/arc/arc.h
index 5cc9dc1..d270390 100644
--- a/gcc/config/arc/arc.h
+++ b/gcc/config/arc/arc.h
@@ -62,7 +62,8 @@ along with GCC; see the file COPYING3. If not see
%{mdsp-packa:-D__Xdsp_packa} %{mcrc:-D__Xcrc} %{mdvbf:-D__Xdvbf} \
%{mtelephony:-D__Xtelephony} %{mxy:-D__Xxy} %{mmul64: -D__Xmult32} \
%{mlock:-D__Xlock} %{mswape:-D__Xswape} %{mrtsc:-D__Xrtsc} \
-%{mcpu=nps400:-D__NPS400__}"
+%{mcpu=nps400:-D__NPS400__} \
+%(subtarget_cpp_spec)"
#undef CC1_SPEC
#define CC1_SPEC "\
@@ -74,6 +75,27 @@ extern const char *arc_cpu_to_as (int argc, const char
**argv);
#define EXTRA_SPEC_FUNCTIONS \
{ "cpu_to_as", arc_cpu_to_as },
+/* This macro defines names of additional specifications to put in the specs
+ that can be used in various specifications like CC1_SPEC. Its definition
+ is an initializer with a subgrouping for each command option.
+
+ Each subgrouping contains a string constant, that defines the
+ specification name, and a string constant that used by the GCC driver
+ program.
+
+ Do not define this macro if it does not need to do anything. */
+#define EXTRA_SPECS \
+ { "subtarget_cpp_spec", SUBTARGET_CPP_SPEC }, \
+ SUBTARGET_EXTRA_SPECS
+
+#ifndef SUBTARGET_EXTRA_SPECS
+#define SUBTARGET_EXTRA_SPECS
+#endif
+
+#ifndef SUBTARGET_CPP_SPEC
+#define SUBTARGET_CPP_SPEC ""
+#endif
+
#undef ASM_SPEC
#define ASM_SPEC "%{mbig-endian|EB:-EB} %{EL} " \
"%:cpu_to_as(%{mcpu=*:%*}) %{mspfp*} %{mdpfp*} %{mfpu=fpuda*:-mfpuda}"
diff --git a/gcc/config/arc/elf.h b/gcc/config/arc/elf.h
index e0c3350..fbdb1d7 100644
--- a/gcc/config/arc/elf.h
+++ b/gcc/config/arc/elf.h
@@ -26,7 +26,8 @@ along with GCC; see the file COPYING3. If not see
#define ARC_TLS_EXTRA_START_SPEC "crttls.o%s"
-#define EXTRA_SPECS \
+#undef SUBTARGET_EXTRA_SPECS
+#define SUBTARGET_EXTRA_SPECS \
{ "arc_tls_extra_start_spec", ARC_TLS_EXTRA_START_SPEC }, \
#undef STARTFILE_SPEC
diff --git a/gcc/config/arc/linux.h b/gcc/config/arc/linux.h
index 590f1a9..db60870 100644
--- a/gcc/config/arc/linux.h
+++ b/gcc/config/arc/linux.h
@@ -86,3 +86,8 @@ along with GCC; see the file COPYING3. If not see
/* Pre/post modify with register displacement are default off. */
#undef TARGET_AUTO_MODIFY_REG_DEFAULT
#define TARGET_AUTO_MODIFY_REG_DEFAULT 0
+
+#undef SUBTARGET_CPP_SPEC
+#define SUBTARGET_CPP_SPEC "\
+ %{pthread:-D_REENTRANT} \
+"