2000-03-31  Ulrich Drepper  <drepper@redhat.com>

	* elf/Makefile (distribute): Add dep1.c, dep2.c, dep3.c, and dep4.c.
	(tests): Add order.
	(module-names): Add dep1, dep2, dep3, and dep4.
	Add dependencies for dep* modules and order.
	Define rule for order.out which checks the result.
	* elf/dep1.c: New file.
	* elf/dep2.c: New file.
	* elf/dep3.c: New file.
	* elf/dep4.c: New file.
	* elf/order.c: New file.

	* elf/dl-init.c: Fix type in comment.
This commit is contained in:
Ulrich Drepper 2000-03-31 17:09:42 +00:00
parent 84ddc586f6
commit c0c2af0799
7 changed files with 131 additions and 1 deletions

View File

@ -1,3 +1,18 @@
2000-03-31 Ulrich Drepper <drepper@redhat.com>
* elf/Makefile (distribute): Add dep1.c, dep2.c, dep3.c, and dep4.c.
(tests): Add order.
(module-names): Add dep1, dep2, dep3, and dep4.
Add dependencies for dep* modules and order.
Define rule for order.out which checks the result.
* elf/dep1.c: New file.
* elf/dep2.c: New file.
* elf/dep3.c: New file.
* elf/dep4.c: New file.
* elf/order.c: New file.
* elf/dl-init.c: Fix type in comment.
2000-03-31 Andreas Jaeger <aj@suse.de> 2000-03-31 Andreas Jaeger <aj@suse.de>
* sysdeps/mips/dl-machine.h (RTLD_START): Rewritten to match new * sysdeps/mips/dl-machine.h (RTLD_START): Rewritten to match new

24
elf/dep1.c Normal file
View File

@ -0,0 +1,24 @@
#include <unistd.h>
extern int dep2 (void);
extern int dep4 (void);
static void
__attribute__ ((constructor))
init (void)
{
write (1, "3", 1);
}
static void
__attribute__ ((destructor))
fini (void)
{
write (1, "6", 1);
}
int
dep1 (void)
{
return dep4 () - dep2 ();
}

24
elf/dep2.c Normal file
View File

@ -0,0 +1,24 @@
#include <unistd.h>
extern int dep3 (void);
extern int dep4 (void);
static void
__attribute__ ((constructor))
init (void)
{
write (1, "2", 1);
}
static void
__attribute__ ((destructor))
fini (void)
{
write (1, "7", 1);
}
int
dep2 (void)
{
return dep3 () - dep4 ();
}

21
elf/dep3.c Normal file
View File

@ -0,0 +1,21 @@
#include <unistd.h>
static void
__attribute__ ((constructor))
init (void)
{
write (1, "0", 1);
}
static void
__attribute__ ((destructor))
fini (void)
{
write (1, "9\n", 2);
}
int
dep3 (void)
{
return 42;
}

23
elf/dep4.c Normal file
View File

@ -0,0 +1,23 @@
#include <unistd.h>
extern int dep3 (void);
static void
__attribute__ ((constructor))
init (void)
{
write (1, "1", 1);
}
static void
__attribute__ ((destructor))
fini (void)
{
write (1, "8", 1);
}
int
dep4 (void)
{
return dep3 ();
}

View File

@ -111,7 +111,7 @@ _dl_init (struct link_map *main_map, int argc, char **argv, char **env)
init (argc, argv, env); init (argc, argv, env);
} }
/* Next see whether there is an array with initialiazation functions. */ /* Next see whether there is an array with initialization functions. */
if (l->l_info[DT_INIT_ARRAY] != NULL) if (l->l_info[DT_INIT_ARRAY] != NULL)
{ {
unsigned int j; unsigned int j;

23
elf/order.c Normal file
View File

@ -0,0 +1,23 @@
#include <unistd.h>
void
__attribute__ ((constructor))
init (void)
{
write (1, "4", 1);
}
void
__attribute__ ((destructor))
fini (void)
{
write (1, "5", 1);
}
extern int dep1 (void);
int
main (void)
{
return dep1 () != 42;
}