[PATCH] LoongArch: Ensure consistency with kernel by using union for struct members in mcontext_t and ucontext_t.

Szabolcs Nagy szabolcs.nagy@arm.com
Tue Apr 4 17:38:27 GMT 2023


The 04/03/2023 20:01, caiyinyu wrote:
> During the construction of the LoongArch Alpine system,
> we found that there is an inconsistency in the member
> names of mcontext_t and ucontext_t between musl and glibc,
> which can cause compilation errors. After testing, we decided
> to use union to keep these member names consistency.

there is no musl api compat requirement at the moment (the musl
loongarch port is not committed yet so surely that can be
changed to be consistent).

there is an api difference between glibc and linux uapi headers.
i personally don't think this is an issue. (the c abi must match
but struct sigcontext and mcontext_t are not used interchangably
in code. the c++ mangling abi is different even after your patch)

there is also a difference in ucontext compared to other targets:
they have uc_flags field while loongarch has  __uc_flags. i don't
know if this may cause a portability issue.

in any case the commit message does not do a good job describing
the reasoning.


More information about the Libc-alpha mailing list