Glibc/Hurd: Patch to system-dependent dynamic linker code
Mark Kettenis
kettenis@delius.kettenis.nl
Sun Jul 12 14:32:00 GMT 1998
Hi all,
This is patch brings the Hurd specific startup code more or less in
sync with the generic implementation. It doesn't really change the
implementation. That will come later, when I've integrated Thomas's
changes to __mmap & __libc_read.
ChangeLog entries follow, but here are some comments (especially for
Roland :)):
* Replace references to _start with the macro ENTRY_POINT. This is
not really necessary, but it is the way the generic implementation
does it and makes porting to an architecture that has a different
convention for naming symbols easier.
* Remove __libc_uid. This parllels the change made by Uli to the
generic code on 1998-06-22.
* Add __libc_multiple_libcs. ChangeLog entry is missing, but the
generic implementation has it and the comment says that it is to
prevent the inclusion of init-first.
* Add __libc_stack_end. Uli, 1998-06-09.
* Add _dl_hwcap_mask and _dl_important_hwcaps. Uli 1998-03-31.
Since the we're not using hardware capabilities on the Hurd yet,
this is the dummy implementation from dl-support.c.
* Mark _dl_show_auxv as an internal function. Uli 1998-04-02.
Mark
1998-07-12 Mark Kettenis <kettenis@phys.uva.nl>
* sysdeps/mach/hurd/dl-sysdep.c: Bring in sync with generic
implementation. Include <entry.h>. Replace references to symbol
_start with macro ENTRY_POINT.
(__libc_uid): Remove.
(__libc_multiple_libcs): New variable.
(__libc_stack_end): New variable.
(_dl_hwcap_mask): New variable.
(_dl_important_hwcaps): New function.
(_dl_show_auxv): Mark internal.
Index: sysdeps/mach/hurd/dl-sysdep.c
--- Hurd.3/sysdeps/mach/hurd/dl-sysdep.c Fri, 29 May 1998 21:43:47 +0200 kettenis (libc/5_dl-sysdep. 1.1 640)
+++ Hurd.3(w)/sysdeps/mach/hurd/dl-sysdep.c Sun, 12 Jul 1998 22:47:02 +0200 kettenis (libc/5_dl-sysdep. 1.1 640)
@@ -37,16 +37,24 @@
#include <ctype.h>
#include <sys/stat.h>
-#include "dl-machine.h"
+#include <entry.h>
+#include <dl-machine.h>
+#include <dl-procinfo.h>
extern void __mach_init (void);
extern int _dl_argc;
extern char **_dl_argv;
extern char **_environ;
+extern void ENTRY_POINT (void);
-uid_t __libc_uid;
int __libc_enable_secure;
+int __libc_multiple_libcs; /* Defining this here avoids the inclusion
+ of init-first. */
+/* This variable containts the lowest stack address ever used. */
+void *__libc_stack_end;
+unsigned long int _dl_hwcap_mask = HWCAP_IMPORTANT;
+
struct hurd_startup_data *_dl_hurd_data;
@@ -86,8 +94,6 @@
void (*dl_main) (const Elf32_Phdr *phdr, Elf32_Word phent,
Elf32_Addr *user_entry))
{
- extern void _start ();
-
void go (int *argdata)
{
extern unsigned int _dl_skip_args; /* rtld.c */
@@ -103,21 +109,20 @@
{
static struct hurd_startup_data nodata;
_dl_hurd_data = &nodata;
- nodata.user_entry = (vm_address_t) &_start;
+ nodata.user_entry = (vm_address_t) &ENTRY_POINT;
}
else
_dl_hurd_data = (void *) p;
- __libc_uid = __getuid ();
__libc_enable_secure = _dl_hurd_data->flags & EXEC_SECURE;
if (_dl_hurd_data->flags & EXEC_STACK_ARGS &&
_dl_hurd_data->user_entry == 0)
- _dl_hurd_data->user_entry = (vm_address_t) &_start;
+ _dl_hurd_data->user_entry = (vm_address_t) &ENTRY_POINT;
unfmh(); /* XXX */
- if (_dl_hurd_data->user_entry == (vm_address_t) &_start)
+ if (_dl_hurd_data->user_entry == (vm_address_t) &ENTRY_POINT)
/* We were invoked as a command, not as the program interpreter.
The generic ld.so code supports this: it will parse the args
as "ld.so PROGRAM [ARGS...]". For booting the Hurd, we
@@ -576,9 +581,31 @@
void
+internal_function
_dl_show_auxv (void)
{
/* There is nothing to print. Hurd has no auxiliary vector. */
+}
+
+
+/* Return an array of useful/necessary hardware capability names. */
+const struct r_strlenpair *
+internal_function
+_dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz,
+ size_t *max_capstrlen)
+{
+ struct r_strlenpair *result;
+
+ /* Return an empty array. Hurd has no hardware capabilities. */
+ result = (struct r_strlenpair *) malloc (sizeof (*result));
+ if (result == NULL)
+ _dl_signal_error (ENOMEM, NULL, "cannot create capability list");
+
+ result[0].str = (char *) result; /* Does not really matter. */
+ result[0].len = 0;
+
+ *sz = 1;
+ return result;
}
void weak_function
More information about the Libc-hacker
mailing list