From e6a7a8617c4768ae9bb8977acacb42675c003fe1 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Mon, 25 Aug 2008 23:38:35 +0000 Subject: [PATCH] AMD64 Support: Adjust crt1 for amd64 to call _init_tls() and _rtld_call_init(). These calls are needed to initialize TLS support, which we use unconditionally to access errno. --- lib/csu/amd64/crt1.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/csu/amd64/crt1.c b/lib/csu/amd64/crt1.c index 8d6f1630da..71ce7ca8e0 100644 --- a/lib/csu/amd64/crt1.c +++ b/lib/csu/amd64/crt1.c @@ -24,7 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/lib/csu/amd64/crt1.c,v 1.13 2003/04/30 19:27:07 peter Exp $ - * $DragonFly: src/lib/csu/amd64/crt1.c,v 1.1 2004/02/02 05:43:13 dillon Exp $ + * $DragonFly: src/lib/csu/amd64/crt1.c,v 1.2 2008/08/25 23:38:35 dillon Exp $ */ #ifndef lint @@ -78,6 +78,15 @@ _start(char **ap, void (*cleanup)(void)) __progname = s + 1; } + /* + * Setup the initial TLS space. The RTLD does not set up our TLS + * (it can't, it doesn't know how our errno is declared). It simply + * does all the groundwork required so that we can call + * _rtld_allocate_tls(). + */ + _init_tls(); + _rtld_call_init(); + if (&_DYNAMIC != NULL) atexit(cleanup); @@ -98,4 +107,4 @@ __asm__("eprol:"); __asm__(".previous"); #endif -__asm__(".ident\t\"$DragonFly: src/lib/csu/amd64/crt1.c,v 1.1 2004/02/02 05:43:13 dillon Exp $\""); +__asm__(".ident\t\"$DragonFly: src/lib/csu/amd64/crt1.c,v 1.2 2008/08/25 23:38:35 dillon Exp $\""); -- 2.11.4.GIT