Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Pass down ELF Auxillary Vectors for static NetBSD binaries too.
details: https://anonhg.NetBSD.org/src/rev/60c25afb68f9
branches: trunk
changeset: 762984:60c25afb68f9
user: joerg <joerg%NetBSD.org@localhost>
date: Mon Mar 07 05:09:09 2011 +0000
description:
Pass down ELF Auxillary Vectors for static NetBSD binaries too.
Rename __libc_init to _libc_init and call it explicitly from CSU code.
This enforces the constructor run order for newly linked programs.
Keep it as constructor with run-once semantic for binary compatibility.
Implement dl_iterate_phdr for statically linked programs.
This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.
diffstat:
lib/csu/alpha/crt0.c | 6 ++-
lib/csu/arm_elf/crt0.c | 6 ++-
lib/csu/common/crt0-common.c | 7 ++-
lib/csu/common_elf/common.h | 3 +-
lib/csu/hppa/crt0.c | 6 ++-
lib/csu/ia64/crt0.c | 6 ++-
lib/csu/m68k_elf/crt0.c | 6 ++-
lib/csu/powerpc/crt0.c | 6 ++-
lib/csu/powerpc64/crt0.c | 6 ++-
lib/csu/sh3_elf/crt0.c | 6 ++-
lib/csu/sparc64/crt0.c | 6 ++-
lib/csu/sparc_elf/crt0.c | 6 ++-
lib/csu/vax_elf/crt0.c | 6 ++-
lib/libc/dlfcn/dlfcn_elf.c | 60 +++++++++++++++++++++++++++++-
lib/libc/misc/initfini.c | 33 ++++++++++++++--
lib/libc/stdlib/exit.c | 11 +----
sys/compat/netbsd32/netbsd32_exec_elf32.c | 6 +-
sys/kern/exec_elf.c | 5 +-
18 files changed, 144 insertions(+), 47 deletions(-)
diffs (truncated from 583 to 300 lines):
diff -r 45965571e727 -r 60c25afb68f9 lib/csu/alpha/crt0.c
--- a/lib/csu/alpha/crt0.c Mon Mar 07 03:29:26 2011 +0000
+++ b/lib/csu/alpha/crt0.c Mon Mar 07 05:09:09 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0.c,v 1.25 2011/02/22 05:45:05 joerg Exp $ */
+/* $NetBSD: crt0.c,v 1.26 2011/03/07 05:09:09 joerg Exp $ */
/*
* Copyright (c) 1995 Christopher G. Demetriou
@@ -69,6 +69,8 @@
_rtld_setup(cleanup, obj);
#endif
+ _libc_init();
+
#ifdef MCRT0
atexit(_mcleanup);
monstartup((u_long)&_eprol, (u_long)&_etext);
@@ -84,7 +86,7 @@
* NOTE: Leave the RCS ID _after_ __start(), in case it gets placed in .text.
*/
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: crt0.c,v 1.25 2011/02/22 05:45:05 joerg Exp $");
+__RCSID("$NetBSD: crt0.c,v 1.26 2011/03/07 05:09:09 joerg Exp $");
#endif /* LIBC_SCCS and not lint */
#include "common.c"
diff -r 45965571e727 -r 60c25afb68f9 lib/csu/arm_elf/crt0.c
--- a/lib/csu/arm_elf/crt0.c Mon Mar 07 03:29:26 2011 +0000
+++ b/lib/csu/arm_elf/crt0.c Mon Mar 07 05:09:09 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0.c,v 1.8 2011/02/22 05:45:05 joerg Exp $ */
+/* $NetBSD: crt0.c,v 1.9 2011/03/07 05:09:09 joerg Exp $ */
/*
* Copyright (C) 1997 Mark Brinicombe
@@ -68,7 +68,7 @@
" b " ___STRING(_C_LABEL(___start)) " ");
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: crt0.c,v 1.8 2011/02/22 05:45:05 joerg Exp $");
+__RCSID("$NetBSD: crt0.c,v 1.9 2011/03/07 05:09:09 joerg Exp $");
#endif /* LIBC_SCCS and not lint */
void
@@ -93,6 +93,8 @@
_rtld_setup(cleanup, obj);
#endif /* DYNAMIC */
+ _libc_init();
+
#ifdef MCRT0
atexit(_mcleanup);
monstartup((u_long)&_eprol, (u_long)&_etext);
diff -r 45965571e727 -r 60c25afb68f9 lib/csu/common/crt0-common.c
--- a/lib/csu/common/crt0-common.c Mon Mar 07 03:29:26 2011 +0000
+++ b/lib/csu/common/crt0-common.c Mon Mar 07 05:09:09 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0-common.c,v 1.4 2011/02/22 05:45:06 joerg Exp $ */
+/* $NetBSD: crt0-common.c,v 1.5 2011/03/07 05:09:09 joerg Exp $ */
/*
* Copyright (c) 1998 Christos Zoulas
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: crt0-common.c,v 1.4 2011/02/22 05:45:06 joerg Exp $");
+__RCSID("$NetBSD: crt0-common.c,v 1.5 2011/03/07 05:09:09 joerg Exp $");
#include <sys/types.h>
#include <sys/syscall.h>
@@ -50,6 +50,7 @@
extern void _init(void);
extern void _fini(void);
+extern void _libc_init(void);
/*
* Arrange for _DYNAMIC to be weak and undefined (and therefore to show up
@@ -115,6 +116,8 @@
atexit(cleanup);
}
+ _libc_init();
+
#ifdef MCRT0
atexit(_mcleanup);
monstartup((u_long)&__eprol, (u_long)&__etext);
diff -r 45965571e727 -r 60c25afb68f9 lib/csu/common_elf/common.h
--- a/lib/csu/common_elf/common.h Mon Mar 07 03:29:26 2011 +0000
+++ b/lib/csu/common_elf/common.h Mon Mar 07 05:09:09 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: common.h,v 1.14 2011/02/22 05:45:06 joerg Exp $ */
+/* $NetBSD: common.h,v 1.15 2011/03/07 05:09:09 joerg Exp $ */
/*
* Copyright (c) 1995 Christopher G. Demetriou
@@ -71,6 +71,7 @@
extern void _init(void);
extern void _fini(void);
+extern void _libc_init(void);
#ifdef DYNAMIC
void _rtld_setup(void (*)(void), const Obj_Entry *obj);
diff -r 45965571e727 -r 60c25afb68f9 lib/csu/hppa/crt0.c
--- a/lib/csu/hppa/crt0.c Mon Mar 07 03:29:26 2011 +0000
+++ b/lib/csu/hppa/crt0.c Mon Mar 07 05:09:09 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0.c,v 1.9 2011/02/23 10:26:09 skrll Exp $ */
+/* $NetBSD: crt0.c,v 1.10 2011/03/07 05:09:10 joerg Exp $ */
/*
* Copyright (c) 2002 Matt Fredette
@@ -93,6 +93,8 @@
_rtld_setup(cleanup, obj);
#endif
+ _libc_init();
+
#ifdef MCRT0
atexit(_mcleanup);
monstartup((u_long)&_eprol, (u_long)&_etext);
@@ -131,7 +133,7 @@
* NOTE: Leave the RCS ID _after_ __start(), in case it gets placed in .text.
*/
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: crt0.c,v 1.9 2011/02/23 10:26:09 skrll Exp $");
+__RCSID("$NetBSD: crt0.c,v 1.10 2011/03/07 05:09:10 joerg Exp $");
#endif /* LIBC_SCCS and not lint */
#include "common.c"
diff -r 45965571e727 -r 60c25afb68f9 lib/csu/ia64/crt0.c
--- a/lib/csu/ia64/crt0.c Mon Mar 07 03:29:26 2011 +0000
+++ b/lib/csu/ia64/crt0.c Mon Mar 07 05:09:09 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0.c,v 1.3 2011/02/22 05:45:06 joerg Exp $ */
+/* $NetBSD: crt0.c,v 1.4 2011/03/07 05:09:10 joerg Exp $ */
/*
* Copyright (c) 1995 Christopher G. Demetriou
@@ -76,6 +76,8 @@
_rtld_setup(cleanup, obj);
#endif
+ _libc_init();
+
#ifdef MCRT0
atexit(_mcleanup);
monstartup((u_long)&_eprol, (u_long)&_etext);
@@ -91,7 +93,7 @@
* NOTE: Leave the RCS ID _after_ __start(), in case it gets placed in .text.
*/
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: crt0.c,v 1.3 2011/02/22 05:45:06 joerg Exp $");
+__RCSID("$NetBSD: crt0.c,v 1.4 2011/03/07 05:09:10 joerg Exp $");
#endif /* LIBC_SCCS and not lint */
#include "common.c"
diff -r 45965571e727 -r 60c25afb68f9 lib/csu/m68k_elf/crt0.c
--- a/lib/csu/m68k_elf/crt0.c Mon Mar 07 03:29:26 2011 +0000
+++ b/lib/csu/m68k_elf/crt0.c Mon Mar 07 05:09:09 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0.c,v 1.12 2011/02/22 05:45:06 joerg Exp $ */
+/* $NetBSD: crt0.c,v 1.13 2011/03/07 05:09:10 joerg Exp $ */
/*
* Copyright (c) 1999 Klaus Klein
@@ -79,6 +79,8 @@
_rtld_setup(cleanup, obj);
#endif
+ _libc_init();
+
#ifdef MCRT0
atexit(_mcleanup);
monstartup((u_long)&_eprol, (u_long)&_etext);
@@ -94,7 +96,7 @@
* NOTE: Leave the RCS ID _after_ __start(), in case it gets placed in .text.
*/
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: crt0.c,v 1.12 2011/02/22 05:45:06 joerg Exp $");
+__RCSID("$NetBSD: crt0.c,v 1.13 2011/03/07 05:09:10 joerg Exp $");
#endif /* LIBC_SCCS and not lint */
#include "common.c"
diff -r 45965571e727 -r 60c25afb68f9 lib/csu/powerpc/crt0.c
--- a/lib/csu/powerpc/crt0.c Mon Mar 07 03:29:26 2011 +0000
+++ b/lib/csu/powerpc/crt0.c Mon Mar 07 05:09:09 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0.c,v 1.28 2011/02/26 17:11:23 matt Exp $ */
+/* $NetBSD: crt0.c,v 1.29 2011/03/07 05:09:10 joerg Exp $ */
/*
* Copyright (c) 1997 Jason R. Thorpe.
@@ -92,6 +92,8 @@
_rtld_setup(cleanup, obj);
#endif
+ _libc_init();
+
#ifdef MCRT0
atexit(_mcleanup);
monstartup((u_long)&_eprol, (u_long)&_etext);
@@ -107,7 +109,7 @@
* NOTE: Leave the RCS ID _after_ __start(), in case it gets placed in .text.
*/
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: crt0.c,v 1.28 2011/02/26 17:11:23 matt Exp $");
+__RCSID("$NetBSD: crt0.c,v 1.29 2011/03/07 05:09:10 joerg Exp $");
#endif /* LIBC_SCCS and not lint */
#include "common.c"
diff -r 45965571e727 -r 60c25afb68f9 lib/csu/powerpc64/crt0.c
--- a/lib/csu/powerpc64/crt0.c Mon Mar 07 03:29:26 2011 +0000
+++ b/lib/csu/powerpc64/crt0.c Mon Mar 07 05:09:09 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0.c,v 1.3 2011/02/22 05:45:07 joerg Exp $ */
+/* $NetBSD: crt0.c,v 1.4 2011/03/07 05:09:10 joerg Exp $ */
/*
* Copyright (c) 1997 Jason R. Thorpe.
@@ -78,6 +78,8 @@
_rtld_setup(cleanup, obj);
#endif
+ _libc_init();
+
#ifdef MCRT0
atexit(_mcleanup);
monstartup((u_long)&_eprol, (u_long)&_etext);
@@ -93,7 +95,7 @@
* NOTE: Leave the RCS ID _after_ __start(), in case it gets placed in .text.
*/
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: crt0.c,v 1.3 2011/02/22 05:45:07 joerg Exp $");
+__RCSID("$NetBSD: crt0.c,v 1.4 2011/03/07 05:09:10 joerg Exp $");
#endif /* LIBC_SCCS and not lint */
#include "common.c"
diff -r 45965571e727 -r 60c25afb68f9 lib/csu/sh3_elf/crt0.c
--- a/lib/csu/sh3_elf/crt0.c Mon Mar 07 03:29:26 2011 +0000
+++ b/lib/csu/sh3_elf/crt0.c Mon Mar 07 05:09:09 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0.c,v 1.11 2011/02/22 05:45:07 joerg Exp $ */
+/* $NetBSD: crt0.c,v 1.12 2011/03/07 05:09:11 joerg Exp $ */
/*
* Copyright (c) 1998 Christos Zoulas
@@ -73,6 +73,8 @@
_rtld_setup(cleanup, obj);
#endif
+ _libc_init();
+
#ifdef MCRT0
atexit(_mcleanup);
monstartup((u_long)&_eprol, (u_long)&_etext);
@@ -88,7 +90,7 @@
* NOTE: Leave the RCS ID _after_ __start(), in case it gets placed in .text.
*/
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: crt0.c,v 1.11 2011/02/22 05:45:07 joerg Exp $");
+__RCSID("$NetBSD: crt0.c,v 1.12 2011/03/07 05:09:11 joerg Exp $");
#endif /* LIBC_SCCS and not lint */
#include "common.c"
diff -r 45965571e727 -r 60c25afb68f9 lib/csu/sparc64/crt0.c
--- a/lib/csu/sparc64/crt0.c Mon Mar 07 03:29:26 2011 +0000
+++ b/lib/csu/sparc64/crt0.c Mon Mar 07 05:09:09 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0.c,v 1.25 2011/02/22 05:45:07 joerg Exp $ */
+/* $NetBSD: crt0.c,v 1.26 2011/03/07 05:09:11 joerg Exp $ */
/*
* Copyright (c) 1995 Christopher G. Demetriou
@@ -98,6 +98,8 @@
_rtld_setup(cleanup, obj);
#endif
+ _libc_init();
+
#ifdef MCRT0
atexit(_mcleanup);
monstartup((u_long)&_eprol, (u_long)&_etext);
@@ -113,7 +115,7 @@
* NOTE: Leave the RCS ID _after_ _start(), in case it gets placed in .text.
*/
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: crt0.c,v 1.25 2011/02/22 05:45:07 joerg Exp $");
+__RCSID("$NetBSD: crt0.c,v 1.26 2011/03/07 05:09:11 joerg Exp $");
#endif /* LIBC_SCCS and not lint */
#include "common.c"
diff -r 45965571e727 -r 60c25afb68f9 lib/csu/sparc_elf/crt0.c
--- a/lib/csu/sparc_elf/crt0.c Mon Mar 07 03:29:26 2011 +0000
+++ b/lib/csu/sparc_elf/crt0.c Mon Mar 07 05:09:09 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0.c,v 1.13 2011/02/22 05:45:08 joerg Exp $ */
Home |
Main Index |
Thread Index |
Old Index