[PATCH] x32: Add <asm/unistd_x32.h> and regenerate arch-syscall.h

H.J. Lu hjl.tools@gmail.com
Mon Aug 24 18:54:57 GMT 2020


On Mon, Aug 24, 2020 at 10:17 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> * H. J. Lu:
>
> > On Mon, Aug 24, 2020 at 6:23 AM Florian Weimer <fweimer@redhat.com> wrote:
> >>
> >> * H. J. Lu:
> >>
> >> > It doesn't work in this case.  <fixup-asm-unistd.h> is used to undefine or
> >> > redefine a syscall from <asm/unistd.h>.   The actual syscall numbers still
> >> > come from <asm/unistd.h>.  In this case, the sycall number is missing from
> >> > <asm/unistd_x32.h>.   My patch is a prerequisite for a new testcase:
> >> >
> >> > ../sysdeps/unix/sysv/linux/x86/tst-sigreturn-1.c: In function ‘setup_ldt’:
> >> > ../sysdeps/unix/sysv/linux/x86/tst-sigreturn-1.c:258:14: error:
> >> > ‘SYS_set_thread_area’ undeclared (first use in this function)
> >> >   258 |  if (syscall(SYS_set_thread_area, &gdt_data16_desc) == 0) {
> >> >       |              ^~~~~~~~~~~~~~~~~~~
> >>
> >> Can you make it an internal test and use __NR_set_thread_area?
> >>
> >
> > Like?
> >
> > #if !defined(__NR_set_thread_area) && defined(__x86_64__) && defined(__ILP32__)
> > /* X32 uses the same 64-bit syscall interface for set_thread_area.  */
> > # define __NR_set_thread_area (__X32_SYSCALL_BIT + 205)
> > #endif
>
> No, I neant using tests-internal, so that you get the built-in system
> call table.

Since __NR_set_thread_area may not be defined in the kernel header file,
move the test to tests-internal doesn't solve the problem.

> But is it really correct to add an unsupported system call definition
> for the rest of glibc?  If this is just setting things up for a test,
> maybe the __X32_SYSCALL_BIT hack is the right approach after all.
> (I don't know the objective of this test.)

set_thread_area is supported on x32.  The only thing missing is

#define __NR_set_thread_area (__X32_SYSCALL_BIT + 205)

in <asm/unistd_x32.h>.

Should I update my original patch to

#define __NR_set_thread_area (__X32_SYSCALL_BIT + 205)

-- 
H.J.


More information about the Libc-alpha mailing list