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 --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.