[PATCH] gcc: define _REENTRANT for OpenRISC when -pthread is passed

Stafford Horne shorne@gmail.com
Mon Jan 31 13:38:13 GMT 2022

From: Bernd Kuhls <bernd.kuhls@t-online.de>

The detection of pthread support fails on OpenRISC unless _REENTRANT
is defined. Added the CPP_SPEC definition to correct this.


	PR target/94372
	* config/or1k/linux.h (CPP_SPEC): Define.

Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
This was brought up on the buildroot list and somehow I missed it.  Sending it
now.  I plan to commit soon.

 gcc/config/or1k/linux.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/config/or1k/linux.h b/gcc/config/or1k/linux.h
index 52909af41a6..80f77c72232 100644
--- a/gcc/config/or1k/linux.h
+++ b/gcc/config/or1k/linux.h
@@ -32,6 +32,8 @@
 #define MUSL_DYNAMIC_LINKER  "/lib/ld-musl-or1k.so.1"
+#define CPP_SPEC "%{pthread:-D_REENTRANT}"
 #undef LINK_SPEC
 #define LINK_SPEC "%{h*}			\
    %{static:-Bstatic}				\

More information about the Gcc-patches mailing list