From: Samuel Thibault Date: Sat, 31 Jan 2026 16:04:53 +0000 (+0100) Subject: hurd: copy over start/end and entry too on fork X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9513e9e5a45fd1c6165c115f43f103f93e7a7faa;p=thirdparty%2Fglibc.git hurd: copy over start/end and entry too on fork gdb needs them to properly find libraries etc. --- diff --git a/sysdeps/mach/hurd/_Fork.c b/sysdeps/mach/hurd/_Fork.c index 7949f536c5..d2e393a631 100644 --- a/sysdeps/mach/hurd/_Fork.c +++ b/sysdeps/mach/hurd/_Fork.c @@ -460,9 +460,9 @@ retry: LOSE; /* This seems like a convenient juncture to copy the proc server's - idea of what addresses our argv and envp are found at from the - parent into the child. Since we happen to know that the child - shares our memory image, it is we who should do this copying. */ + idea of what addresses our argv, envp, start, end, entry are found at + from the parent into the child. Since we happen to know that the + child shares our memory image, it is we who should do this copying. */ { vm_address_t argv, envp; err = (__USEPORT (PROC, __proc_get_arg_locations (port, &argv, &envp)) @@ -470,6 +470,20 @@ retry: if (err) LOSE; } + { + vm_address_t start, end; + err = (__USEPORT (PROC, __proc_get_code (port, &start, &end)) + ?: __proc_set_code (newproc, start, end)); + if (err) + LOSE; + } + { + vm_address_t entry; + err = (__USEPORT (PROC, __proc_get_entry (port, &entry)) + ?: __proc_set_entry (newproc, entry)); + if (err) + LOSE; + } /* Set the child signal thread up to run the msgport server function using the same signal thread stack copied from our address space.