]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
hurd: copy over start/end and entry too on fork
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Sat, 31 Jan 2026 16:04:53 +0000 (17:04 +0100)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Sat, 31 Jan 2026 16:04:53 +0000 (17:04 +0100)
gdb needs them to properly find libraries etc.

sysdeps/mach/hurd/_Fork.c

index 7949f536c552fef23052e4b3782bf81701a041bc..d2e393a631c10a8b5d1f2c0c2e68a0bf58cc07cf 100644 (file)
@@ -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.