diff mbox series

[uclibc-ng-devel] Fix errors due to absent sys/asm.h in mips64 musl build

Message ID 20240725081519.611076-1-dm.chestnykh@gmail.com
State New
Headers show
Series [uclibc-ng-devel] Fix errors due to absent sys/asm.h in mips64 musl build | expand

Commit Message

Dmitry Chestnykh July 25, 2024, 8:15 a.m. UTC
Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
---
 test/tls/tls-macros-mips.h | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

Comments

Waldemar Brodkorb July 25, 2024, 10:39 a.m. UTC | #1
Hi Dmitry,

when trying to compile uClibc-ng-test for musl with mips64 to verify
your patch.

But i get:
/home/wbx/embedded-test/openadk/toolchain_qemu-mips64_musl_mips64_n32/usr/bin/mips64-openadk-linux-muslabin32-gcc
-fwrapv -fno-ident -march=mips64 -Os -pipe -fomit-frame-pointer
-I../test -D_GNU_SOURCE -Wno-missing-field-initializers -I../../test
-D_GNU_SOURCE -Wno-missing-field-initializers -DUSE_TLS=1
-DHAVE___THREAD=1 -I. -DHAVE_TLS_MODEL_ATTRIBUTE=1    -c tst-tls1.c
-o tst-tls1.o
In file included from tls-macros.h:64,
                 from tst-tls1.c:6:
                 ./tls-macros-mips.h:3:10: fatal error: sys/cdefs.h:
                 No such file or directory
                     3 | #include <sys/cdefs.h>
                           |          ^~~~~~~~~~~~~
                           compilation terminated.

Could you take a look?

best regards
 Waldemar

Dmitry Chestnykh wrote,

> Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
> ---
>  test/tls/tls-macros-mips.h | 33 +++++++++++++++++++++++++++++++++
>  1 file changed, 33 insertions(+)
> 
> diff --git a/test/tls/tls-macros-mips.h b/test/tls/tls-macros-mips.h
> index eed0938..bd4c5c4 100644
> --- a/test/tls/tls-macros-mips.h
> +++ b/test/tls/tls-macros-mips.h
> @@ -1,7 +1,40 @@
>  /* Macros to support TLS testing in times of missing compiler support.  */
>  
>  #include <sys/cdefs.h>
> +#if defined(__has_include) && __has_include(<sys/asm.h>)
>  #include <sys/asm.h>
> +#else
> +
> +#define __STRING(x) #x
> +
> +#if ((_MIPS_SIM == _MIPS_SIM_ABI32 || _MIPS_SIM == _ABI32) && _MIPS_SZPTR == 32)
> +#define PTR_ADDIU	addiu
> +#define PTR_L		lw
> +#endif
> +
> +#if _MIPS_SIM == _MIPS_SIM_NABI32 || _MIPS_SIM == _NABI32
> +
> +#if !defined __mips_isa_rev || __mips_isa_rev < 6
> +#define PTR_ADDU	add
> +#define PTR_ADDIU	addi
> +#else
> +#define PTR_ADDU        addu
> +#define PTR_ADDIU       addiu
> +#endif
> +
> +#define PTR_L		lw
> +#endif
> +
> +#if ((_MIPS_SIM == _MIPS_SIM_ABI32 || _MIPS_SIM == _ABI32) && _MIPS_SZPTR == 64) \
> +    || _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM ==  _ABIN32
> +
> +#define PTR_ADDU	daddu
> +#define PTR_ADDIU	daddiu
> +#define PTR_L		ld
> +
> +#endif
> +
> +#endif
>  
>  #define __STRING2(X) __STRING(X)
>  #define ADDU __STRING2(PTR_ADDU)
> -- 
> 2.45.2
> 
> _______________________________________________
> devel mailing list -- devel@uclibc-ng.org
> To unsubscribe send an email to devel-leave@uclibc-ng.org
>
diff mbox series

Patch

diff --git a/test/tls/tls-macros-mips.h b/test/tls/tls-macros-mips.h
index eed0938..bd4c5c4 100644
--- a/test/tls/tls-macros-mips.h
+++ b/test/tls/tls-macros-mips.h
@@ -1,7 +1,40 @@ 
 /* Macros to support TLS testing in times of missing compiler support.  */
 
 #include <sys/cdefs.h>
+#if defined(__has_include) && __has_include(<sys/asm.h>)
 #include <sys/asm.h>
+#else
+
+#define __STRING(x) #x
+
+#if ((_MIPS_SIM == _MIPS_SIM_ABI32 || _MIPS_SIM == _ABI32) && _MIPS_SZPTR == 32)
+#define PTR_ADDIU	addiu
+#define PTR_L		lw
+#endif
+
+#if _MIPS_SIM == _MIPS_SIM_NABI32 || _MIPS_SIM == _NABI32
+
+#if !defined __mips_isa_rev || __mips_isa_rev < 6
+#define PTR_ADDU	add
+#define PTR_ADDIU	addi
+#else
+#define PTR_ADDU        addu
+#define PTR_ADDIU       addiu
+#endif
+
+#define PTR_L		lw
+#endif
+
+#if ((_MIPS_SIM == _MIPS_SIM_ABI32 || _MIPS_SIM == _ABI32) && _MIPS_SZPTR == 64) \
+    || _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM ==  _ABIN32
+
+#define PTR_ADDU	daddu
+#define PTR_ADDIU	daddiu
+#define PTR_L		ld
+
+#endif
+
+#endif
 
 #define __STRING2(X) __STRING(X)
 #define ADDU __STRING2(PTR_ADDU)