diff mbox series

selftests/rseq: Fix unknown type name __weak for gcc 11.3.0

Message ID 20230731141733.25059-1-tuananhlfc@gmail.com (mailing list archive)
State New
Headers show
Series selftests/rseq: Fix unknown type name __weak for gcc 11.3.0 | expand

Commit Message

Anh Tuan Phan July 31, 2023, 2:17 p.m. UTC
Add the definition of the '__weak' attribute since it is not available in
GCC 11.3.0 and newer:

rseq.c:41:1: error: unknown type name ‘__weak’
   41 | __weak ptrdiff_t __rseq_offset;

Fixes: 3bcbc20942db ("selftests/rseq: Play nice with binaries statically linked against glibc 2.35+")
Signed-off-by: Anh Tuan Phan <tuananhlfc@gmail.com>
---
 tools/testing/selftests/rseq/rseq.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/tools/testing/selftests/rseq/rseq.c b/tools/testing/selftests/rseq/rseq.c
index a723da253244..584eec9b0930 100644
--- a/tools/testing/selftests/rseq/rseq.c
+++ b/tools/testing/selftests/rseq/rseq.c
@@ -34,6 +34,10 @@ 
 #include "../kselftest.h"
 #include "rseq.h"
 
+#ifndef __weak
+#define __weak __attribute__((weak))
+#endif
+
 /*
  * Define weak versions to play nice with binaries that are statically linked
  * against a libc that doesn't support registering its own rseq.