[ARC] Define _REENTRANT when -pthread is passed.
authorClaudiu Zissulescu <claziss@synopsys.com>
Tue, 28 Mar 2017 08:56:44 +0000 (10:56 +0200)
committerClaudiu Zissulescu <claziss@gcc.gnu.org>
Tue, 28 Mar 2017 08:56:44 +0000 (10:56 +0200)
The compiler is supposed to have the builtin defined _REENTRANT defined
when -pthread is passed, which wasn't done on the ARC architecture.

When _REENTRANT is not passed, the C library will not use reentrant
functions, and the latest version of ax_pthread.m4 from the
autoconf-archive will no longer detect that thread support is
available (see https://savannah.gnu.org/patch/?8186).

gcc/
2017-03-28  Claudiu Zissulescu  <claziss@synopsys.com>
    Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

* config/arc/arc.h (CPP_SPEC): Add subtarget_cpp_spec.
(EXTRA_SPECS): Define.
(SUBTARGET_EXTRA_SPECS): Likewise.
(SUBTARGET_CPP_SPEC): Likewise.
* config/arc/elf.h (EXTRA_SPECS): Renamed to
SUBTARGET_EXTRA_SPECS.
* config/arc/linux.h (SUBTARGET_CPP_SPEC): Define.

Co-Authored-By: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
From-SVN: r246524

gcc/ChangeLog
gcc/config/arc/arc.h
gcc/config/arc/elf.h
gcc/config/arc/linux.h

index 732ad50f8abb1d403c820495eaeecf7c72b8ab94..4864d75bb6672a3d880278e785ae885a219c9b5c 100644 (file)
@@ -1,3 +1,14 @@
+2017-03-28  Claudiu Zissulescu  <claziss@synopsys.com>
+           Thomas Petazzoni  <thomas.petazzoni@free-electrons.com>
+
+       * config/arc/arc.h (CPP_SPEC): Add subtarget_cpp_spec.
+       (EXTRA_SPECS): Define.
+       (SUBTARGET_EXTRA_SPECS): Likewise.
+       (SUBTARGET_CPP_SPEC): Likewise.
+       * config/arc/elf.h (EXTRA_SPECS): Renamed to
+       SUBTARGET_EXTRA_SPECS.
+       * config/arc/linux.h (SUBTARGET_CPP_SPEC): Define.
+
 2017-03-28  Claudiu Zissulescu  <claziss@synopsys.com>
 
        * config/arc/simdext.md (vst64_insn): Update pattern.
index da191287510be38cbd5aeaecedb3ebb57b93423c..08644eb7cdd05eb3890cbb057cc54690140631e4 100644 (file)
@@ -61,7 +61,8 @@ along with GCC; see the file COPYING3.  If not see
 %{mmac-d16:-D__Xxmac_d16} %{mmac-24:-D__Xxmac_24} \
 %{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}"
+%{mlock:-D__Xlock} %{mswape:-D__Xswape} %{mrtsc:-D__Xrtsc} \
+%(subtarget_cpp_spec)"
 
 #undef CC1_SPEC
 #define CC1_SPEC "\
@@ -73,6 +74,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}"
index 2b572a52322010cc922cb05930ba086ac0208ebd..c5794f8f785b7e57285f18c4bc17e21fb0d7f370 100644 (file)
@@ -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
index 6e1a96efc23a18d0e5d70185a41fa9aa69ad8520..83e5a1d61f25d5e3a45bfe6290c2629a44c4a344 100644 (file)
@@ -78,3 +78,8 @@ along with GCC; see the file COPYING3.  If not see
 /* Linux toolchains use r25 as the thread pointer register.  */
 #undef TARGET_ARC_TP_REGNO_DEFAULT
 #define TARGET_ARC_TP_REGNO_DEFAULT 25
+
+#undef SUBTARGET_CPP_SPEC
+#define SUBTARGET_CPP_SPEC "\
+   %{pthread:-D_REENTRANT} \
+"