1From 8ef5787701f4d7cf46a27771d38ab54af2499e25 Mon Sep 17 00:00:00 2001
2From: Bernd Kuhls <bernd.kuhls@t-online.de>
3Date: Fri, 27 Mar 2020 21:23:53 +0100
4Subject: [PATCH] gcc: define _REENTRANT for OpenRISC when -pthread is passed
5
6The detection of pthread support fails on OpenRISC unless _REENTRANT
7is defined. Added the CPP_SPEC definition to correct this.
8
9Patch sent upstream: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94372
10
11Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
12---
13 gcc/config/or1k/linux.h | 2 ++
14 1 file changed, 2 insertions(+)
15
16diff --git a/gcc/config/or1k/linux.h b/gcc/config/or1k/linux.h
17index 196f3f3c8f0..0cbdc934af1 100644
18--- a/gcc/config/or1k/linux.h
19+++ b/gcc/config/or1k/linux.h
20@@ -32,6 +32,8 @@
21 #undef MUSL_DYNAMIC_LINKER
22 #define MUSL_DYNAMIC_LINKER  "/lib/ld-musl-or1k.so.1"
23
24+#define CPP_SPEC "%{pthread:-D_REENTRANT}"
25+
26 #undef LINK_SPEC
27 #define LINK_SPEC "%{h*}			\
28    %{static:-Bstatic}				\
29--
302.35.1
31
32