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
This commit is contained in:
andrew 2018-11-07 09:49:25 +00:00
parent b6f712a95b
commit 573e268cd6
3 changed files with 23 additions and 7 deletions
lib/csu
mips
sparc64
share/mk

@ -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

@ -27,5 +27,7 @@
#define _CRT_H_
#define HAVE_CTORS
#define CTORS_CONSTRUCTORS
#define INIT_CALL_SEQ(func) "call " __STRING(func) "; nop"
#endif

@ -193,6 +193,7 @@ __DEFAULT_YES_OPTIONS = \
ZONEINFO
__DEFAULT_NO_OPTIONS = \
BSD_CRTBEGIN \
BSD_GREP \
CLANG_EXTRAS \
DTRACE_TESTS \
@ -385,13 +386,6 @@ BROKEN_OPTIONS+=HYPERV
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>
#