Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 Nov 2018 09:49:26 +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: r340213 - in head: lib/csu/mips lib/csu/sparc64 share/mk
Message-ID:  <201811070949.wA79nQWs077495@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Wed Nov  7 09:49:25 2018
New Revision: 340213
URL: https://svnweb.freebsd.org/changeset/base/340213

Log:
  Add the (untested) mips and sparc64 .init call sequences.
  
  The BSD crtbegin/crtend code now builds on all architectures, however
  further work is needed to check if it works correctly.
  
  MFC with:	r339738
  Sponsored by:	DARPA, AFRL

Modified:
  head/lib/csu/mips/crt.h
  head/lib/csu/sparc64/crt.h
  head/share/mk/src.opts.mk

Modified: head/lib/csu/mips/crt.h
==============================================================================
--- head/lib/csu/mips/crt.h	Wed Nov  7 08:25:44 2018	(r340212)
+++ head/lib/csu/mips/crt.h	Wed Nov  7 09:49:25 2018	(r340213)
@@ -27,5 +27,25 @@
 #define	_CRT_H_
 
 #define	HAVE_CTORS
+#define	CTORS_CONSTRUCTORS
+#ifdef __mips_o32
+#define	INIT_CALL_SEQ(func)						\
+    ".set noreorder		\n"					\
+    "bal	1f		\n"					\
+    "nop			\n"					\
+    "1:				\n"					\
+    ".cpload $ra		\n"					\
+    ".set reorder		\n"					\
+    "jal	" __STRING(func)
+#else
+#define	INIT_CALL_SEQ(func)						\
+    ".set noreorder		\n"					\
+    "bal	1f		\n"					\
+    "nop			\n"					\
+    "1:				\n"					\
+    ".set reorder		\n"					\
+    ".cpsetup $ra, $v0, 1b	\n"					\
+    "jal	" __STRING(func)
+#endif
 
 #endif

Modified: head/lib/csu/sparc64/crt.h
==============================================================================
--- head/lib/csu/sparc64/crt.h	Wed Nov  7 08:25:44 2018	(r340212)
+++ head/lib/csu/sparc64/crt.h	Wed Nov  7 09:49:25 2018	(r340213)
@@ -27,5 +27,7 @@
 #define	_CRT_H_
 
 #define	HAVE_CTORS
+#define	CTORS_CONSTRUCTORS
+#define	INIT_CALL_SEQ(func)	"call " __STRING(func) "; nop"
 
 #endif

Modified: head/share/mk/src.opts.mk
==============================================================================
--- head/share/mk/src.opts.mk	Wed Nov  7 08:25:44 2018	(r340212)
+++ head/share/mk/src.opts.mk	Wed Nov  7 09:49:25 2018	(r340213)
@@ -193,6 +193,7 @@ __DEFAULT_YES_OPTIONS = \
     ZONEINFO
 
 __DEFAULT_NO_OPTIONS = \
+    BSD_CRTBEGIN \
     BSD_GREP \
     CLANG_EXTRAS \
     DTRACE_TESTS \
@@ -383,13 +384,6 @@ BROKEN_OPTIONS+=HYPERV
 # NVME is only x86 and powerpc64
 .if ${__T} != "amd64" && ${__T} != "i386" && ${__T} != "powerpc64"
 BROKEN_OPTIONS+=NVME
-.endif
-
-.if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386" || \
-    ${__T} == "powerpc64"
-__DEFAULT_NO_OPTIONS+=BSD_CRTBEGIN
-.else
-BROKEN_OPTIONS+=BSD_CRTBEGIN
 .endif
 
 .include <bsd.mkopt.mk>



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