[PATCH glibc 1/3] glibc: Perform rseq registration at C startup and thread creation (v20)

Florian Weimer fweimer@redhat.com
Wed Jun 3 12:05:21 GMT 2020


* Mathieu Desnoyers:

> +#ifdef __cplusplus
> +# if  __cplusplus >= 201103L
> +#  define __rseq_static_assert(expr, diagnostic) static_assert (expr, diagnostic)
> +#  define __rseq_alignof(type)                   alignof (type)
> +#  define __rseq_alignas(x)                      alignas (x)
> +#  define __rseq_tls_storage_class               thread_local
> +# endif
> +#elif (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) >= 201112L
> +# define __rseq_static_assert(expr, diagnostic)  _Static_assert (expr, diagnostic)
> +# define __rseq_alignof(type)                    _Alignof (type)
> +# define __rseq_alignas(x)                       _Alignas (x)
> +# define __rseq_tls_storage_class                _Thread_local
> +#endif

This does not seem to work.  I get this with GCC 9:

In file included from /tmp/cih_test_gsrKbC.cc:8:0:
../sysdeps/unix/sysv/linux/sys/rseq.h:42:50: error: attribute ignored [-Werror=attributes]
 #  define __rseq_alignas(x)                      alignas (x)
                                                  ^
../sysdeps/unix/sysv/linux/sys/rseq.h:122:14: note: in expansion of macro ‘__rseq_alignas’
     uint32_t __rseq_alignas (32) version;
              ^

In any case, these changes really have to go into the UAPI header first.
Only the __thread handling should remain.  Otherwise, we'll have a tough
situation on our hands changing the UAPI header, without introducing
macro definition conflicts.  I'd suggest to stick to the aligned
attribute for the time being, like the current UAPI headers.

The resut looks okay to me.

I'm still waiting for feedback from other maintainers whether the level
of documentation and testing is appropriate.

Thanks,
Florian



More information about the Libc-alpha mailing list