Bug 28938 - [csky, microblaze, or1k, powerpc] typedef for greg_t missing in sys/ucontext.h on some architectures
Summary: [csky, microblaze, or1k, powerpc] typedef for greg_t missing in sys/ucontext....
Status: UNCONFIRMED
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-03-03 14:19 UTC by Arfrever Frehtes Taifersar Arahesis
Modified: 2022-06-30 02:16 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arfrever Frehtes Taifersar Arahesis 2022-03-03 14:19:52 UTC
Original bug report: https://bugs.gentoo.org/834450

> In file included from include/libucontext/libucontext.h:5,
>                  from arch/ppc/makecontext.c:19:
> include/libucontext/bits.h:8:9: error: unknown type name 'greg_t'
>     8 | typedef greg_t libucontext_greg_t;
>       |         ^~~~~~


In glibc 2.35:

The following sys/ucontext.h files define both greg_t and gregset_t:

sysdeps/arm/sys/ucontext.h
sysdeps/i386/sys/ucontext.h
sysdeps/m68k/sys/ucontext.h
sysdeps/mips/sys/ucontext.h
sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h
sysdeps/unix/sysv/linux/alpha/sys/ucontext.h
sysdeps/unix/sysv/linux/arm/sys/ucontext.h
sysdeps/unix/sysv/linux/hppa/sys/ucontext.h
sysdeps/unix/sysv/linux/m68k/sys/ucontext.h
sysdeps/unix/sysv/linux/mips/sys/ucontext.h
sysdeps/unix/sysv/linux/riscv/sys/ucontext.h
sysdeps/unix/sysv/linux/s390/sys/ucontext.h
sysdeps/unix/sysv/linux/sh/sys/ucontext.h
sysdeps/unix/sysv/linux/sparc/sys/ucontext.h
sysdeps/unix/sysv/linux/x86/sys/ucontext.h

The following sys/ucontext.h files define gregset_t, but not greg_t:

sysdeps/unix/sysv/linux/csky/sys/ucontext.h
sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h

The following sys/ucontext.h files do not define greg_t or gregset_t:

sysdeps/generic/sys/ucontext.h
sysdeps/unix/sysv/linux/arc/sys/ucontext.h
sysdeps/unix/sysv/linux/ia64/sys/ucontext.h
sysdeps/unix/sysv/linux/microblaze/sys/ucontext.h
sysdeps/unix/sysv/linux/nios2/sys/ucontext.h
sysdeps/unix/sysv/linux/or1k/sys/ucontext.h


In musl, sys/ucontext.h includes ucontext.h, which includes signal.h, which includes bits/signal.h.

In musl, the following bits/signal.h files define greg_t and gregset_t:

arch/aarch64/bits/signal.h
arch/arm/bits/signal.h
arch/i386/bits/signal.h
arch/m68k/bits/signal.h
arch/microblaze/bits/signal.h
arch/mips/bits/signal.h
arch/mips64/bits/signal.h
arch/mipsn32/bits/signal.h
arch/or1k/bits/signal.h
arch/powerpc/bits/signal.h
arch/powerpc64/bits/signal.h
arch/riscv64/bits/signal.h
arch/s390x/bits/signal.h
arch/sh/bits/signal.h
arch/x32/bits/signal.h
arch/x86_64/bits/signal.h


In glibc, typedef for greg_t needs to be added at least in:

sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h
  (In musl, in arch/powerpc/bits/signal.h: 'typedef unsigned long greg_t, gregset_t[48]')
  (In musl, in arch/powerpc64/bits/signal.h: 'typedef unsigned long greg_t, gregset_t[48]')

And probably also in:

sysdeps/unix/sysv/linux/csky/sys/ucontext.h
  (Not supported by musl, but 'typedef unsigned long greg_t' seems obvious.)
sysdeps/unix/sysv/linux/microblaze/sys/ucontext.h
  (In musl: 'typedef unsigned long greg_t, gregset_t[38]')
sysdeps/unix/sysv/linux/or1k/sys/ucontext.h
  (In musl: 'typedef unsigned long greg_t, gregset_t[34]')
Comment 1 Andreas Schwab 2022-03-03 15:05:27 UTC
I don't think the set of definitions expected from <sys/ucontext.h> is well defined.