From 573e268cd6a5cfa3967f752f3dd3835f0e43a898 Mon Sep 17 00:00:00 2001 From: andrew Date: Wed, 7 Nov 2018 09:49:25 +0000 Subject: [PATCH] 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 --- lib/csu/mips/crt.h | 20 ++++++++++++++++++++ lib/csu/sparc64/crt.h | 2 ++ share/mk/src.opts.mk | 8 +------- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/lib/csu/mips/crt.h b/lib/csu/mips/crt.h index 509899b97b96..7da894280f53 100644 --- a/lib/csu/mips/crt.h +++ b/lib/csu/mips/crt.h @@ -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 diff --git a/lib/csu/sparc64/crt.h b/lib/csu/sparc64/crt.h index 509899b97b96..82984849630d 100644 --- a/lib/csu/sparc64/crt.h +++ b/lib/csu/sparc64/crt.h @@ -27,5 +27,7 @@ #define _CRT_H_ #define HAVE_CTORS +#define CTORS_CONSTRUCTORS +#define INIT_CALL_SEQ(func) "call " __STRING(func) "; nop" #endif diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index dc017618db4f..4e4ce4a535d1 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -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 #