public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/12] Towards glibc on x86_64-gnu
@ 2023-02-12 11:10 Sergey Bugaev
  2023-02-12 11:10 ` [RFC PATCH glibc 1/12] hurd: Refactor readlinkat() Sergey Bugaev
                   ` (12 more replies)
  0 siblings, 13 replies; 47+ messages in thread
From: Sergey Bugaev @ 2023-02-12 11:10 UTC (permalink / raw)
  To: bug-hurd, libc-alpha; +Cc: Flávio Cruz, Sergey Bugaev

Hello!

Seeing that the patches to make binutils and GCC support --target=x86_64-gnu
have recently landed, I thought it would be interesting to try to configure
glibc with --host=x86_64-gnu and see what breaks.

To make things work at least somewhat, I've tried to put some basic directory
& Implies structure in place, then fixed various 64-bit issues in generic code
(these fixes should hopefully be uncontroversial!). Then I have even tried to
actually write some of the missing arch-specific code for x86_64-gnu.

With this patch series, I'm able to 'make install-headers' successfully.
Moreover, I'm able to 'make io/subdir_objs' successfully - which builds a lot
of Hurd-specific, but mostly arch-independent, routines. 'subdir_objs' in
'mach', 'hurd', and 'htl' do not succeed, but a lof of files do get built.

The main missing pieces seem to be, ordered by scariness increasing:
- missing x86_64 thread state definition in the kernel headers;
- TLS things;
- INTR_MSG_TRAP.

Thread state (i.e. a struct with all the register values) should not be that
hard for GNU Mach to define (unless it is defined somewhere already and I'm
just not seeing it).

It seems that GCC expects TLS on x86_64 to be done relative to %fs, not %gs, so
that's what I attempted to do in tls.h. The main thing missing there is the
ability to actually set (and read) the %fs base address of a thread. It is my
understanding (but note that I have no idea what I'm talking about) that on
x86_64 the segment descriptors (as in GDT/LDT) are not used for this, and
instead the address can be set by writing to a MSR. Linux exposes the
arch_prctl (ARCH_[GS]ET_[FG]S) syscall for this; so maybe GNU Mach could also
have an explicit routine for this, perhaps like this:

routine i386_set_fgs_base (
	target_thread: thread_t;
	which: int;
	value: rpc_vm_address_t);

We should not need a getter routine, because one can simply inspect the target
thread's state (unless, again, I misunderstand things horribly).

Anyway; this is an RFC. I don't expect the latter patches to actually get
merged. "I have no idea what I'm doing" applies. Maybe I'm doing things
horribly wrong; tell me!

Note: I'm sending this as a single patch series that consists of patches for
the glibc, MIG, and the Hurd repos. The repo that a patch is for is indicated
in the subject line of each patch.

Sergey

^ permalink raw reply	[flat|nested] 47+ messages in thread

end of thread, other threads:[~2023-02-16 20:22 UTC | newest]

Thread overview: 47+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-12 11:10 [RFC PATCH 0/12] Towards glibc on x86_64-gnu Sergey Bugaev
2023-02-12 11:10 ` [RFC PATCH glibc 1/12] hurd: Refactor readlinkat() Sergey Bugaev
2023-02-12 14:49   ` Samuel Thibault
2023-02-12 11:10 ` [RFC PATCH glibc 2/12] hurd: Use mach_msg_type_number_t where appropriate Sergey Bugaev
2023-02-12 14:52   ` Samuel Thibault
2023-02-12 11:10 ` [RFC PATCH glibc 3/12] mach, hurd: Cast through uintptr_t Sergey Bugaev
2023-02-12 14:55   ` Samuel Thibault
2023-02-12 11:10 ` [RFC PATCH glibc 4/12] hurd: Fix xattr error value Sergey Bugaev
2023-02-12 14:56   ` Samuel Thibault
2023-02-12 11:10 ` [RFC PATCH glibc 5/12] htl: Fix semaphore reference Sergey Bugaev
2023-02-12 14:57   ` Samuel Thibault
2023-02-12 11:10 ` [RFC PATCH hurd 6/12] hurd: Fix modes_t and speeds_t types on 64-bit Sergey Bugaev
2023-02-12 15:00   ` Samuel Thibault
2023-02-12 15:15     ` Sergey Bugaev
2023-02-12 15:22       ` Samuel Thibault
2023-02-12 16:13         ` Sergey Bugaev
2023-02-12 16:30           ` Samuel Thibault
2023-02-12 19:03           ` Samuel Thibault
2023-02-12 11:10 ` [RFC PATCH mig 7/12] Drop -undef -ansi from cpp flags Sergey Bugaev
2023-02-12 15:01   ` Samuel Thibault
2023-02-12 18:43     ` Flávio Cruz
2023-02-12 18:44   ` Samuel Thibault
2023-02-12 11:10 ` [RFC PATCH mig 8/12] Set max type alignment to sizeof(long) Sergey Bugaev
2023-02-12 11:10 ` [RFC PATCH glibc 9/12] mach: Look for mach_i386.defs on x86_64 too Sergey Bugaev
2023-02-12 15:07   ` Samuel Thibault
2023-02-12 15:38     ` Sergey Bugaev
2023-02-12 15:46       ` Samuel Thibault
2023-02-12 16:01         ` Sergey Bugaev
2023-02-16 20:22   ` Joseph Myers
2023-02-12 11:10 ` [RFC PATCH glibc 10/12] hurd: Set up the basic tree for x86_64-gnu Sergey Bugaev
2023-02-12 15:15   ` Samuel Thibault
2023-02-12 11:10 ` [RFC PATCH glibc 11/12] hurd, htl: Add some x86_64-specific code Sergey Bugaev
2023-02-12 16:11   ` Samuel Thibault
2023-02-12 16:25     ` Sergey Bugaev
2023-02-12 16:36       ` Samuel Thibault
2023-02-12 16:40         ` Florian Weimer
2023-02-12 16:46           ` Samuel Thibault
2023-02-12 19:29             ` Florian Weimer
2023-02-12 19:37               ` Samuel Thibault
2023-02-12 16:51         ` Sergey Bugaev
2023-02-12 17:02           ` Samuel Thibault
2023-02-12 17:06             ` Sergey Bugaev
2023-02-12 11:10 ` [RFC PATCH glibc 12/12] C11 thrd: Downgrade the default alignment of mtx_t Sergey Bugaev
2023-02-12 15:18   ` Samuel Thibault
2023-02-12 15:52     ` Sergey Bugaev
2023-02-12 16:29       ` Samuel Thibault
2023-02-12 16:12 ` [RFC PATCH 0/12] Towards glibc on x86_64-gnu Samuel Thibault

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).