Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Jul 2015 15:03:00 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r285044 - head/lib/csu/aarch64
Message-ID:  <201507021503.t62F309V098209@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Thu Jul  2 15:02:59 2015
New Revision: 285044
URL: https://svnweb.freebsd.org/changeset/base/285044

Log:
  Force the dynamic linker to resolve _end early so we pick up the correct
  copy.
  
  Sponsored by:	ABT Systems Ltd

Modified:
  head/lib/csu/aarch64/crt1.c

Modified: head/lib/csu/aarch64/crt1.c
==============================================================================
--- head/lib/csu/aarch64/crt1.c	Thu Jul  2 14:54:21 2015	(r285043)
+++ head/lib/csu/aarch64/crt1.c	Thu Jul  2 15:02:59 2015	(r285044)
@@ -51,6 +51,8 @@ extern int eprol;
 extern int etext;
 #endif
 
+extern long * _end;
+
 void __start(int, char **, char **, void (*)(void));
 
 /* The entry function. */
@@ -79,8 +81,17 @@ __start(int argc, char *argv[], char *en
 
 	if (&_DYNAMIC != NULL)
 		atexit(cleanup);
-	else
+	else {
+		/*
+		 * Hack to resolve _end so we read the correct symbol.
+		 * Without this it will resolve to the copy in the library
+		 * that firsts requests it. We should fix the toolchain,
+		 * however this is is needed until this can take place.
+		 */
+		*(volatile long *)&_end;
+
 		_init_tls();
+	}
 
 #ifdef GCRT
 	atexit(_mcleanup);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201507021503.t62F309V098209>