svn commit: r352394 - in stable/12: etc/mtree gnu/lib gnu/lib/csu lib/csu lib/csu/aarch64 lib/csu/amd64 lib/csu/arm lib/csu/common lib/csu/i386 lib/csu/mips lib/csu/powerpc lib/csu/powerpc64 lib/cs...
Andrew Turner
andrew at FreeBSD.org
Mon Sep 16 13:41:30 UTC 2019
Author: andrew
Date: Mon Sep 16 13:41:24 2019
New Revision: 352394
URL: https://svnweb.freebsd.org/changeset/base/352394
Log:
MFC r339738, r339744, r339770, r339773, r339864-r339866, r339907-r339908, r339912-r339913, r339916, r339954, r340213, r340395, r340840, r340910-r340911, r341424, r342773, r342974, r351027, r352073:
MFC the BSD crtbegin to stable/12 but keep it disabled.
r339738:
Implement a BSD licensed crtbegin/crtend
These are needed for .ctors/.dtors and .jcr handling. The former needs
all the function pointers to be called in the correct order from the
.init/.fini section. The latter just needs to call a gcj specific function
if it exists with a pointer to the start of the .jcr section.
This is currently disabled until __dso_handle support is added.
Reviewed by: emaste
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D17587
r339744:
Add a missing include for src.opts.mk. Without it MK_TESTS isn't defined.
MFC with: r339738
Sponsored by: DARPA, AFRL
r339770:
Drop the csu tests WARNS to 5 to fix the powerpc64 build.
MFC with: r339738
Sponsored by: DARPA, AFRL
r339773:
Add __dso_handle to the BSD crtbegin. This is used to identify shared
objects.
MFC with: r339738
Sponsored by: DARPA, AFRL
r339864:
Check __dso_handle is NULL in non-DSO objects. It should only be non-NULL
when accessed from a shared object.
MFC with: r339738
Sponsored by: DARPA, AFRL
r339865:
Include the csu test directories in BSD.tests.dist
MFC with: r339738
Sponsored by: DARPA, AFRL
r339866:
Make the .ctors, .dtors, and .jcr markers as static. They shouldn't be
accessible from out of the files they are defined in.
MFC with: r339738
Sponsored by: DARPA, AFRL
r339907:
The jcr argument to _Jv_RegisterClasses is used, stop marking it otherwise.
MFC with: r339738
Sponsored by: DARPA, AFRL
r339908:
Run the csu tests on a DSO. This builds the tests into a shared library,
then runs these from the base test programs. With this we can check
crtbeginS.o and crtendS.o are working as expected.
MFC with: r339738
Sponsored by: DARPA, AFRL
r339912:
Fix the location of the static keyword.
MFC with: r339738
Sponsored by: DARPA, AFRL
r339913:
Disable the .preinit_array test in DSOs, ld.bfd fails to link objects with
the section.
MFC with: r339738
Sponsored by: DARPA, AFRL
r339916:
Build the csu tests on all architectures.
The tests haven't been run them, but this is enough to build them so I can
get feedback on if the various crt.h headers are correct.
MFC with: r339738
Sponsored by: DARPA, AFRL
r339954:
Add __used to __CTOR_LIST__ and __DTOR_LIST__
Enabling BSD_CRTBEGIN on amd64 resulted in
error: unused variable '__CTOR_LIST__'.
__CTOR_LIST__ is indeed unused in crtbegin.c; it marks the beginning of
the .ctors array and is used in crtend.c. Annotate __DTOR_LIST__ as
well for consistency.
Discussed with: andrew
MFC with: r339738
Sponsored by: The FreeBSD Foundation
r340213:
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
r340395:
Run __cxa_finalize in shared objects in the destructor path.
When we have .dtors call them before .dtor handling, otherwise call from
a destructor.
PR: 233056
MFC with: r339738
Sponsored by: DARPA, AFRL
r340840:
Mark the function called by the MIPS .init/.fini sequence with .local.
As with r328939 we need to mark local symbols as such. Without this the
assembly parser treats the symbols as global and created relocations
against these private symbols.
MFC with: r339738
Sponsored by: DARPA, AFRL
r340910:
Add the missing 0 at the end of the .jcr section.
Without this the dynamic library test was failing as it was calling
_Jv_RegisterClasses multiple times.
r340911:
Re-enable the dynamiclib tests. These should be fixed by r340910.
r341424:
Disable the BSD CRT code on powerpc and sparc64, they need extra crt*.o
files that haven't been implemented.
Reported by: sbruno
MFC with: r339738
Sponsored by: DARPA, AFRL
r342773:
Add explicit csu test dependency
lib/csu/tests/dynamiclib requires libh_csu.so be built first. I'm not
sure this is the most correct/best way to address this but it solves
the issue in my testing.
PR: 233734
Sponsored by: The FreeBSD Foundation
r342974:
Create crtsavres.o for powerpc builds
Summary:
GCC expects to link in a crtsavres.o on powerpc platforms. On
powerpc64 this is an empty file, but on powerpc and powerpcspe this does contain
some save/restore functions, which may not actually be necessary for newer
modern GCC and clang. This appeases the in-tree gcc, though, and is needed in
order to switch to the BSD CRTRBEGIN.
PR: 233751
Reviewed By: andrew
Differential Revision: https://reviews.freebsd.org/D18826
r351027:
Enable BSD_CRTBEGIN on powerpc
In r342974 jhibbits added support to build crtsavres.o. This was the
blocker for BSD_CRTBEGIN to be enabled there. As such enable this
option again.
Reviewed by: jhibbits
Sponsored by: DARPA, AFRL
r352073:
csu: Add the riscv .init call sequence
Reviewed by: br
Sponsored by: Axiado
Differential Revision: https://reviews.freebsd.org/D21537
Added:
stable/12/lib/csu/aarch64/crt.h
- copied unchanged from r339738, head/lib/csu/aarch64/crt.h
stable/12/lib/csu/amd64/crt.h
- copied unchanged from r339738, head/lib/csu/amd64/crt.h
stable/12/lib/csu/arm/crt.h
- copied unchanged from r339916, head/lib/csu/arm/crt.h
stable/12/lib/csu/common/crtbegin.c
- copied, changed from r339738, head/lib/csu/common/crtbegin.c
stable/12/lib/csu/common/crtend.c
- copied, changed from r339738, head/lib/csu/common/crtend.c
stable/12/lib/csu/i386/crt.h
- copied unchanged from r339738, head/lib/csu/i386/crt.h
stable/12/lib/csu/mips/crt.h
- copied, changed from r339916, head/lib/csu/mips/crt.h
stable/12/lib/csu/powerpc/crt.h
- copied unchanged from r339916, head/lib/csu/powerpc/crt.h
stable/12/lib/csu/powerpc/crtsavres.S
- copied unchanged from r342974, head/lib/csu/powerpc/crtsavres.S
stable/12/lib/csu/powerpc64/crt.h
- copied unchanged from r339738, head/lib/csu/powerpc64/crt.h
stable/12/lib/csu/riscv/crt.h
- copied, changed from r339916, head/lib/csu/riscv/crt.h
stable/12/lib/csu/sparc64/crt.h
- copied, changed from r339916, head/lib/csu/sparc64/crt.h
stable/12/lib/csu/tests/
- copied from r339738, head/lib/csu/tests/
stable/12/lib/csu/tests/dso/
- copied from r339908, head/lib/csu/tests/dso/
stable/12/lib/csu/tests/dynamiclib/
- copied from r339908, head/lib/csu/tests/dynamiclib/
stable/12/tools/build/options/WITHOUT_BSD_CRTBEGIN
- copied unchanged from r339738, head/tools/build/options/WITHOUT_BSD_CRTBEGIN
stable/12/tools/build/options/WITH_BSD_CRTBEGIN
- copied unchanged from r339738, head/tools/build/options/WITH_BSD_CRTBEGIN
Modified:
stable/12/etc/mtree/BSD.tests.dist
stable/12/gnu/lib/Makefile
stable/12/gnu/lib/csu/Makefile
stable/12/lib/csu/Makefile
stable/12/lib/csu/Makefile.inc
stable/12/lib/csu/powerpc/Makefile
stable/12/lib/csu/powerpc64/Makefile
stable/12/lib/csu/tests/Makefile
stable/12/lib/csu/tests/Makefile.tests
stable/12/lib/csu/tests/cxx_constructors.cc
stable/12/lib/csu/tests/dynamic/Makefile
stable/12/lib/csu/tests/fini_test.c
stable/12/lib/csu/tests/init_test.c
stable/12/lib/csu/tests/static/Makefile
stable/12/share/mk/src.opts.mk
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/etc/mtree/BSD.tests.dist
==============================================================================
--- stable/12/etc/mtree/BSD.tests.dist Mon Sep 16 13:26:27 2019 (r352393)
+++ stable/12/etc/mtree/BSD.tests.dist Mon Sep 16 13:41:24 2019 (r352394)
@@ -280,6 +280,14 @@
test-programs
..
..
+ csu
+ dynamic
+ ..
+ dynamiclib
+ ..
+ static
+ ..
+ ..
googletest
gmock
..
Modified: stable/12/gnu/lib/Makefile
==============================================================================
--- stable/12/gnu/lib/Makefile Mon Sep 16 13:26:27 2019 (r352393)
+++ stable/12/gnu/lib/Makefile Mon Sep 16 13:41:24 2019 (r352394)
@@ -2,7 +2,7 @@
.include <src.opts.mk>
-SUBDIR= csu
+SUBDIR=
SUBDIR.${MK_DIALOG}+= libdialog
SUBDIR.${MK_GCC}+= libgcov
.if ${MK_GCC} != "no" && ${MK_OPENMP} == "no"
@@ -10,6 +10,10 @@ SUBDIR+= libgomp
.endif
SUBDIR.${MK_SSP}+= libssp
SUBDIR.${MK_TESTS}+= tests
+
+.if ${MK_BSD_CRTBEGIN} == "no"
+SUBDIR+= csu
+.endif
.if ${MK_GNU_GREP} != "no" || ${MK_GNU_GREP_COMPAT} != "no" || \
${MK_GDB} != "no"
Modified: stable/12/gnu/lib/csu/Makefile
==============================================================================
--- stable/12/gnu/lib/csu/Makefile Mon Sep 16 13:26:27 2019 (r352393)
+++ stable/12/gnu/lib/csu/Makefile Mon Sep 16 13:41:24 2019 (r352394)
@@ -28,10 +28,6 @@ CRTS_CFLAGS= -DCRTSTUFFS_O -DSHARED ${PICFLAG}
CFLAGS+= -DTARGET_ARM_EABI
.endif
-.if ${MACHINE_CPUARCH} == "powerpc"
-TGTOBJS= crtsavres.o
-SRCS+= crtsavres.asm
-.endif
.if ${MACHINE_CPUARCH} == "sparc64"
TGTOBJS= crtfastmath.o
SRCS+= crtfastmath.c
Modified: stable/12/lib/csu/Makefile
==============================================================================
--- stable/12/lib/csu/Makefile Mon Sep 16 13:26:27 2019 (r352393)
+++ stable/12/lib/csu/Makefile Mon Sep 16 13:41:24 2019 (r352394)
@@ -1,9 +1,14 @@
# $FreeBSD$
+.include <src.opts.mk>
+
.if exists(${.CURDIR}/${MACHINE_ARCH})
SUBDIR+= ${MACHINE_ARCH}
.else
SUBDIR+= ${MACHINE_CPUARCH}
.endif
+
+HAS_TESTS=
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.subdir.mk>
Modified: stable/12/lib/csu/Makefile.inc
==============================================================================
--- stable/12/lib/csu/Makefile.inc Mon Sep 16 13:26:27 2019 (r352393)
+++ stable/12/lib/csu/Makefile.inc Mon Sep 16 13:41:24 2019 (r352394)
@@ -6,4 +6,27 @@ SED_FIX_NOTE = -i "" -e '/\.note\.tag/s/progbits/note/
NO_WMISSING_VARIABLE_DECLARATIONS=
+.include <src.opts.mk>
+
+.if ${MK_BSD_CRTBEGIN} != "no" && !defined(BUILDING_TESTS)
+
+OBJS+= crtbegin.o crtbeginS.o crtbeginT.o
+OBJS+= crtend.o crtendS.o
+
+CFLAGS_CRTS= -DSHARED ${PICFLAG}
+
+crtbegin.o: crtbegin.c
+crtbeginS.o: crtbegin.c
+crtbeginT.o: crtbegin.c
+crtend.o: crtend.c
+crtendS.o: crtend.c
+
+crtbegin.o crtend.o crtbeginT.o:
+ ${CC} ${CFLAGS} -I${.CURDIR} -c -o ${.TARGET} ${.ALLSRC}
+
+crtbeginS.o crtendS.o:
+ ${CC} ${CFLAGS} -I${.CURDIR} ${CFLAGS_CRTS} -c -o ${.TARGET} ${.ALLSRC}
+
+.endif
+
.include "../Makefile.inc"
Copied: stable/12/lib/csu/aarch64/crt.h (from r339738, head/lib/csu/aarch64/crt.h)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ stable/12/lib/csu/aarch64/crt.h Mon Sep 16 13:41:24 2019 (r352394, copy of r339738, head/lib/csu/aarch64/crt.h)
@@ -0,0 +1,2 @@
+/* $FreeBSD$ */
+/* Empty so we can include this unconditionally */
Copied: stable/12/lib/csu/amd64/crt.h (from r339738, head/lib/csu/amd64/crt.h)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ stable/12/lib/csu/amd64/crt.h Mon Sep 16 13:41:24 2019 (r352394, copy of r339738, head/lib/csu/amd64/crt.h)
@@ -0,0 +1,32 @@
+/*-
+ * SPDX-License-Identifier: BSD-1-Clause
+ *
+ * Copyright 2018 Andrew Turner
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _CRT_H_
+#define _CRT_H_
+
+#define HAVE_CTORS
+#define INIT_CALL_SEQ(func) "call " __STRING(func)
+
+#endif
Copied: stable/12/lib/csu/arm/crt.h (from r339916, head/lib/csu/arm/crt.h)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ stable/12/lib/csu/arm/crt.h Mon Sep 16 13:41:24 2019 (r352394, copy of r339916, head/lib/csu/arm/crt.h)
@@ -0,0 +1,2 @@
+/* $FreeBSD$ */
+/* Empty so we can include this unconditionally */
Copied and modified: stable/12/lib/csu/common/crtbegin.c (from r339738, head/lib/csu/common/crtbegin.c)
==============================================================================
--- head/lib/csu/common/crtbegin.c Thu Oct 25 17:39:41 2018 (r339738, copy source)
+++ stable/12/lib/csu/common/crtbegin.c Mon Sep 16 13:41:24 2019 (r352394)
@@ -30,17 +30,42 @@ __FBSDID("$FreeBSD$");
typedef void (*crt_func)(void);
+extern void *__dso_handle __hidden;
+
+#ifndef SHARED
+void *__dso_handle = 0;
+#else
+void *__dso_handle = &__dso_handle;
+void __cxa_finalize(void *) __weak_symbol;
+
/*
+ * Call __cxa_finalize with the dso handle in shared objects.
+ * When we have ctors/dtors call from the dtor handler before calling
+ * any dtors, otherwise use a destructor.
+ */
+#ifndef HAVE_CTORS
+__attribute__((destructor))
+#endif
+static void
+run_cxa_finalize(void)
+{
+
+ if (__cxa_finalize != NULL)
+ __cxa_finalize(__dso_handle);
+}
+#endif
+
+/*
* On some architectures and toolchains we may need to call the .dtors.
* These are called in the order they are in the ELF file.
*/
#ifdef HAVE_CTORS
static void __do_global_dtors_aux(void) __used;
-crt_func __CTOR_LIST__[] __section(".ctors") __hidden = {
+static crt_func __CTOR_LIST__[] __section(".ctors") __used = {
(crt_func)-1
};
-crt_func __DTOR_LIST__[] __section(".dtors") __hidden = {
+static crt_func __DTOR_LIST__[] __section(".dtors") __used = {
(crt_func)-1
};
@@ -50,6 +75,10 @@ __do_global_dtors_aux(void)
crt_func fn;
int n;
+#ifdef SHARED
+ run_cxa_finalize();
+#endif
+
for (n = 1;; n++) {
fn = __DTOR_LIST__[n];
if (fn == (crt_func)0 || fn == (crt_func)-1)
@@ -73,7 +102,7 @@ asm (
extern void _Jv_RegisterClasses(void *) __weak_symbol;
static void register_classes(void) __used;
-crt_func __JCR_LIST__[] __section(".jcr") __used __hidden = { };
+static crt_func __JCR_LIST__[] __section(".jcr") __used = { };
#ifndef CTORS_CONSTRUCTORS
__attribute__((constructor))
Copied and modified: stable/12/lib/csu/common/crtend.c (from r339738, head/lib/csu/common/crtend.c)
==============================================================================
--- head/lib/csu/common/crtend.c Thu Oct 25 17:39:41 2018 (r339738, copy source)
+++ stable/12/lib/csu/common/crtend.c Mon Sep 16 13:41:24 2019 (r352394)
@@ -35,10 +35,13 @@ typedef void (*crt_func)(void);
*/
static void __do_global_ctors_aux(void) __used;
-crt_func __CTOR_END__[] __section(".ctors") __used __hidden = {
+static crt_func __CTOR_END__[] __section(".ctors") __used = {
(crt_func)0
};
-crt_func __DTOR_END__[] __section(".dtors") __used __hidden = {
+static crt_func __DTOR_END__[] __section(".dtors") __used = {
+ (crt_func)0
+};
+static crt_func __JCR_LIST__[] __section(".jcr") __used = {
(crt_func)0
};
Copied: stable/12/lib/csu/i386/crt.h (from r339738, head/lib/csu/i386/crt.h)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ stable/12/lib/csu/i386/crt.h Mon Sep 16 13:41:24 2019 (r352394, copy of r339738, head/lib/csu/i386/crt.h)
@@ -0,0 +1,32 @@
+/*-
+ * SPDX-License-Identifier: BSD-1-Clause
+ *
+ * Copyright 2018 Andrew Turner
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _CRT_H_
+#define _CRT_H_
+
+#define HAVE_CTORS
+#define INIT_CALL_SEQ(func) "call " __STRING(func)
+
+#endif
Copied and modified: stable/12/lib/csu/mips/crt.h (from r339916, head/lib/csu/mips/crt.h)
==============================================================================
--- head/lib/csu/mips/crt.h Tue Oct 30 14:44:12 2018 (r339916, copy source)
+++ stable/12/lib/csu/mips/crt.h Mon Sep 16 13:41:24 2019 (r352394)
@@ -27,5 +27,27 @@
#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" \
+ ".local " __STRING(func) "\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" \
+ ".local " __STRING(func) "\n" \
+ "jal " __STRING(func)
+#endif
#endif
Modified: stable/12/lib/csu/powerpc/Makefile
==============================================================================
--- stable/12/lib/csu/powerpc/Makefile Mon Sep 16 13:26:27 2019 (r352393)
+++ stable/12/lib/csu/powerpc/Makefile Mon Sep 16 13:41:24 2019 (r352394)
@@ -2,7 +2,7 @@
.PATH: ${.CURDIR:H}/common
-SRCS= crt1.c crti.S crtn.S
+SRCS= crt1.c crti.S crtn.S crtsavres.S
OBJS= ${SRCS:N*.h:R:S/$/.o/g}
OBJS+= Scrt1.o gcrt1.o
CFLAGS+= -I${.CURDIR:H}/common \
Copied: stable/12/lib/csu/powerpc/crt.h (from r339916, head/lib/csu/powerpc/crt.h)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ stable/12/lib/csu/powerpc/crt.h Mon Sep 16 13:41:24 2019 (r352394, copy of r339916, head/lib/csu/powerpc/crt.h)
@@ -0,0 +1,33 @@
+/*-
+ * SPDX-License-Identifier: BSD-1-Clause
+ *
+ * Copyright 2018 Andrew Turner
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _CRT_H_
+#define _CRT_H_
+
+#define HAVE_CTORS
+#define CTORS_CONSTRUCTORS
+#define INIT_CALL_SEQ(func) "bl " __STRING(func) "; nop"
+
+#endif
Copied: stable/12/lib/csu/powerpc/crtsavres.S (from r342974, head/lib/csu/powerpc/crtsavres.S)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ stable/12/lib/csu/powerpc/crtsavres.S Mon Sep 16 13:41:24 2019 (r352394, copy of r342974, head/lib/csu/powerpc/crtsavres.S)
@@ -0,0 +1,191 @@
+/*-
+ * SPDX-License-Identifier: BSD-1-Clause
+ *
+ * Copyright 2019 Justin Hibbits
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <machine/asm.h>
+__FBSDID("$FreeBSD$");
+
+.text
+
+/*
+ * The PowerPC ABI spec requires the following save/restore functions to be
+ * provided:
+ *
+ * _savefpr_N
+ * _restfpr_N
+ * _restfpr_N_x
+ * _savegpr_N
+ * _restgpr_N
+ * _restgpr_N_x
+ *
+ * With N ranging from 14 to 31, to save the nonvolatile registers.
+ */
+
+#define _CRTENTRY(name) \
+ .text; \
+ .globl name; \
+ .type name, at function; \
+ name:
+
+#define SAVEFPR(r) _CRTENTRY(__CONCAT(_savefpr_,r)) \
+ stfd r,(-256 + r * 8)(11)
+
+SAVEFPR(14)
+SAVEFPR(15)
+SAVEFPR(16)
+SAVEFPR(17)
+SAVEFPR(18)
+SAVEFPR(19)
+SAVEFPR(20)
+SAVEFPR(21)
+SAVEFPR(22)
+SAVEFPR(23)
+SAVEFPR(24)
+SAVEFPR(25)
+SAVEFPR(26)
+SAVEFPR(27)
+SAVEFPR(28)
+SAVEFPR(29)
+SAVEFPR(30)
+SAVEFPR(31)
+ blr
+
+#define RESTFPR(r) _CRTENTRY(__CONCAT(_restfpr_,r)) \
+ lfd r,(-256 + r * 8)(11)
+
+RESTFPR(14)
+RESTFPR(15)
+RESTFPR(16)
+RESTFPR(17)
+RESTFPR(18)
+RESTFPR(19)
+RESTFPR(20)
+RESTFPR(21)
+RESTFPR(22)
+RESTFPR(23)
+RESTFPR(24)
+RESTFPR(25)
+RESTFPR(26)
+RESTFPR(27)
+RESTFPR(28)
+RESTFPR(29)
+RESTFPR(30)
+RESTFPR(31)
+ blr
+
+#define SAVEGPR(r) _CRTENTRY(__CONCAT(_savegpr_,r)) \
+ stfd r,(-128 + r*4)(11)
+
+SAVEGPR(14)
+SAVEGPR(15)
+SAVEGPR(16)
+SAVEGPR(17)
+SAVEGPR(18)
+SAVEGPR(19)
+SAVEGPR(20)
+SAVEGPR(21)
+SAVEGPR(22)
+SAVEGPR(23)
+SAVEGPR(24)
+SAVEGPR(25)
+SAVEGPR(26)
+SAVEGPR(27)
+SAVEGPR(28)
+SAVEGPR(29)
+SAVEGPR(30)
+SAVEGPR(31)
+ blr
+
+#define RESTGPR(r) _CRTENTRY(__CONCAT(_restgpr_,r)) \
+ lwz r,(-128 + r*4)(11)
+
+RESTGPR(14)
+RESTGPR(15)
+RESTGPR(16)
+RESTGPR(17)
+RESTGPR(18)
+RESTGPR(19)
+RESTGPR(20)
+RESTGPR(21)
+RESTGPR(22)
+RESTGPR(23)
+RESTGPR(24)
+RESTGPR(25)
+RESTGPR(26)
+RESTGPR(27)
+RESTGPR(28)
+RESTGPR(29)
+RESTGPR(30)
+RESTGPR(31)
+ blr
+
+#define RESTFPR_X(r) _CRTENTRY(__CONCAT(__CONCAT(_restfpr_,r),_x)) \
+ lfd r,(-256 + r * 8)(11)
+
+RESTFPR_X(14)
+RESTFPR_X(15)
+RESTFPR_X(16)
+RESTFPR_X(17)
+RESTFPR_X(18)
+RESTFPR_X(19)
+RESTFPR_X(20)
+RESTFPR_X(21)
+RESTFPR_X(22)
+RESTFPR_X(23)
+RESTFPR_X(24)
+RESTFPR_X(25)
+RESTFPR_X(26)
+RESTFPR_X(27)
+RESTFPR_X(28)
+RESTFPR_X(29)
+RESTFPR_X(30)
+RESTFPR_X(31)
+ lwz 0,4(11)
+ mtlr 0
+ mr 1,11
+ blr
+
+#define RESTGPR_X(r) _CRTENTRY(__CONCAT(__CONCAT(_restgpr_,r),_x)) \
+ lwz r,(-128 + r*4)(11)
+
+RESTGPR_X(14)
+RESTGPR_X(15)
+RESTGPR_X(16)
+RESTGPR_X(17)
+RESTGPR_X(18)
+RESTGPR_X(19)
+RESTGPR_X(20)
+RESTGPR_X(21)
+RESTGPR_X(22)
+RESTGPR_X(23)
+RESTGPR_X(24)
+RESTGPR_X(25)
+RESTGPR_X(26)
+RESTGPR_X(27)
+RESTGPR_X(28)
+RESTGPR_X(29)
+RESTGPR_X(30)
+RESTGPR_X(31)
+ lwz 0,4(11)
+ mtlr 0
+ mr 1,11
+ blr
Modified: stable/12/lib/csu/powerpc64/Makefile
==============================================================================
--- stable/12/lib/csu/powerpc64/Makefile Mon Sep 16 13:26:27 2019 (r352393)
+++ stable/12/lib/csu/powerpc64/Makefile Mon Sep 16 13:41:24 2019 (r352394)
@@ -4,7 +4,7 @@
SRCS= crt1.c crti.S crtn.S
OBJS= ${SRCS:N*.h:R:S/$/.o/g}
-OBJS+= Scrt1.o gcrt1.o
+OBJS+= crtsavres.o Scrt1.o gcrt1.o
CFLAGS+= -I${.CURDIR:H}/common \
-I${SRCTOP}/lib/libc/include \
-mlongcall -DCRT_IRELOC_SUPPRESS
@@ -18,7 +18,7 @@ FILESDIR= ${LIBDIR}
.undef LIBRARIES_ONLY
CLEANFILES= ${OBJS}
-CLEANFILES+= crt1.s gcrt1.s Scrt1.s
+CLEANFILES+= crt1.s crtsavres.s gcrt1.s Scrt1.s
# See the comment in lib/csu/common/crtbrand.c for the reason crt1.c is not
# directly compiled to .o files.
@@ -26,6 +26,10 @@ CLEANFILES+= crt1.s gcrt1.s Scrt1.s
crt1.s: crt1.c
${CC} ${CFLAGS} -S -o ${.TARGET} ${.CURDIR}/crt1.c
sed ${SED_FIX_NOTE} ${.TARGET}
+
+# On powerpc64 crtsavres is an empty file
+crtsavres.s:
+ touch ${.TARGET}
crt1.o: crt1.s
${CC} ${CFLAGS:N-g} ${ACFLAGS} -c -o ${.TARGET} crt1.s
Copied: stable/12/lib/csu/powerpc64/crt.h (from r339738, head/lib/csu/powerpc64/crt.h)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ stable/12/lib/csu/powerpc64/crt.h Mon Sep 16 13:41:24 2019 (r352394, copy of r339738, head/lib/csu/powerpc64/crt.h)
@@ -0,0 +1,33 @@
+/*-
+ * SPDX-License-Identifier: BSD-1-Clause
+ *
+ * Copyright 2018 Andrew Turner
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _CRT_H_
+#define _CRT_H_
+
+#define HAVE_CTORS
+#define CTORS_CONSTRUCTORS
+#define INIT_CALL_SEQ(func) "bl " __STRING(func) "; nop"
+
+#endif
Copied and modified: stable/12/lib/csu/riscv/crt.h (from r339916, head/lib/csu/riscv/crt.h)
==============================================================================
--- head/lib/csu/riscv/crt.h Tue Oct 30 14:44:12 2018 (r339916, copy source)
+++ stable/12/lib/csu/riscv/crt.h Mon Sep 16 13:41:24 2019 (r352394)
@@ -1,2 +1,9 @@
/* $FreeBSD$ */
-/* Empty so we can include this unconditionally */
+
+#ifndef _CRT_H_
+#define _CRT_H_
+
+#define HAVE_CTORS
+#define INIT_CALL_SEQ(func) "call " __STRING(func)
+
+#endif
Copied and modified: stable/12/lib/csu/sparc64/crt.h (from r339916, head/lib/csu/sparc64/crt.h)
==============================================================================
--- head/lib/csu/sparc64/crt.h Tue Oct 30 14:44:12 2018 (r339916, copy source)
+++ stable/12/lib/csu/sparc64/crt.h Mon Sep 16 13:41:24 2019 (r352394)
@@ -27,5 +27,7 @@
#define _CRT_H_
#define HAVE_CTORS
+#define CTORS_CONSTRUCTORS
+#define INIT_CALL_SEQ(func) "call " __STRING(func) "; nop"
#endif
Modified: stable/12/lib/csu/tests/Makefile
==============================================================================
--- head/lib/csu/tests/Makefile Thu Oct 25 17:39:41 2018 (r339738)
+++ stable/12/lib/csu/tests/Makefile Mon Sep 16 13:41:24 2019 (r352394)
@@ -1,6 +1,10 @@
# $FreeBSD$
+SUBDIR= dso
TESTS_SUBDIRS= dynamic
+TESTS_SUBDIRS+= dynamiclib
TESTS_SUBDIRS+= static
+
+SUBDIR_DEPEND_dynamiclib=dso
.include <bsd.test.mk>
Modified: stable/12/lib/csu/tests/Makefile.tests
==============================================================================
--- head/lib/csu/tests/Makefile.tests Thu Oct 25 17:39:41 2018 (r339738)
+++ stable/12/lib/csu/tests/Makefile.tests Mon Sep 16 13:41:24 2019 (r352394)
@@ -4,6 +4,8 @@ ATF_TESTS_C+= init_test
ATF_TESTS_C+= fini_test
ATF_TESTS_CXX+= cxx_constructors
+WARNS?= 3
+
.if exists(${.CURDIR:H:H}/${MACHINE_ARCH})
CFLAGS+= -I${.CURDIR:H:H}/${MACHINE_ARCH}
.else
Modified: stable/12/lib/csu/tests/cxx_constructors.cc
==============================================================================
--- head/lib/csu/tests/cxx_constructors.cc Thu Oct 25 17:39:41 2018 (r339738)
+++ stable/12/lib/csu/tests/cxx_constructors.cc Mon Sep 16 13:41:24 2019 (r352394)
@@ -39,10 +39,18 @@ __FBSDID("$FreeBSD$");
#include <stdlib.h>
#include <unistd.h>
+#ifndef DSO_LIB
#include <atf-c++.hpp>
+#endif
-static volatile int constructor_run;
-static bool run_destructor_test = false;
+extern volatile int constructor_run;
+extern bool run_destructor_test;
+
+#ifndef DSO_BASE
+volatile int constructor_run;
+bool run_destructor_test = false;
+#endif
+
struct Foo {
Foo() {
constructor_run = 1;
@@ -53,8 +61,12 @@ struct Foo {
}
};
extern Foo foo;
+
+#ifndef DSO_BASE
Foo foo;
+#endif
+#ifndef DSO_LIB
ATF_TEST_CASE_WITHOUT_HEAD(cxx_constructor);
ATF_TEST_CASE_BODY(cxx_constructor)
{
@@ -90,3 +102,4 @@ ATF_INIT_TEST_CASES(tcs)
ATF_ADD_TEST_CASE(tcs, cxx_constructor);
ATF_ADD_TEST_CASE(tcs, cxx_destructor);
}
+#endif
Modified: stable/12/lib/csu/tests/dynamic/Makefile
==============================================================================
--- head/lib/csu/tests/dynamic/Makefile Thu Oct 25 17:39:41 2018 (r339738)
+++ stable/12/lib/csu/tests/dynamic/Makefile Mon Sep 16 13:41:24 2019 (r352394)
@@ -1,7 +1,6 @@
# $FreeBSD$
.PATH: ${.CURDIR:H}
-WARNS?= 6
.include "../Makefile.tests"
.include <bsd.test.mk>
Modified: stable/12/lib/csu/tests/fini_test.c
==============================================================================
--- head/lib/csu/tests/fini_test.c Thu Oct 25 17:39:41 2018 (r339738)
+++ stable/12/lib/csu/tests/fini_test.c Mon Sep 16 13:41:24 2019 (r352394)
@@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
#include <sys/wait.h>
#include <errno.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <unistd.h>
@@ -43,10 +44,16 @@ __FBSDID("$FreeBSD$");
#include <crt.h>
+extern bool run_dtors_test;
+extern bool run_fini_array_test;
+void dso_handle_check(void);
+
+
+#ifndef DSO_BASE
typedef void (*func_ptr)(void);
-static bool run_dtors_test = false;
-static bool run_fini_array_test = false;
+bool run_dtors_test = false;
+bool run_fini_array_test = false;
static void
dtors_handler(void)
@@ -57,7 +64,9 @@ dtors_handler(void)
}
__section(".dtors") __used static func_ptr dtors_func =
&dtors_handler;
+#endif
+#ifndef DSO_LIB
ATF_TC_WITHOUT_HEAD(dtors_test);
ATF_TC_BODY(dtors_test, tc)
{
@@ -85,7 +94,9 @@ ATF_TC_BODY(dtors_test, tc)
break;
}
}
+#endif
+#ifndef DSO_BASE
static void
fini_array_handler(void)
{
@@ -95,7 +106,9 @@ fini_array_handler(void)
}
__section(".fini_array") __used static func_ptr fini_array_func =
&fini_array_handler;
+#endif
+#ifndef DSO_LIB
ATF_TC_WITHOUT_HEAD(fini_array_test);
ATF_TC_BODY(fini_array_test, tc)
{
@@ -118,12 +131,41 @@ ATF_TC_BODY(fini_array_test, tc)
break;
}
}
+#endif
+#ifndef DSO_BASE
+extern void *__dso_handle;
+
+void
+dso_handle_check(void)
+{
+ void *dso = __dso_handle;
+
+#ifdef DSO_LIB
+ ATF_REQUIRE_MSG(dso != NULL,
+ "Null __dso_handle in DSO");
+#else
+ ATF_REQUIRE_MSG(dso == NULL,
+ "Invalid __dso_handle in non-DSO");
+#endif
+}
+#endif
+
+#ifndef DSO_LIB
+ATF_TC_WITHOUT_HEAD(dso_handle_test);
+ATF_TC_BODY(dso_handle_test, tc)
+{
+
+ dso_handle_check();
+}
+
ATF_TP_ADD_TCS(tp)
{
ATF_TP_ADD_TC(tp, dtors_test);
ATF_TP_ADD_TC(tp, fini_array_test);
+ ATF_TP_ADD_TC(tp, dso_handle_test);
return (atf_no_error());
}
+#endif
Modified: stable/12/lib/csu/tests/init_test.c
==============================================================================
--- head/lib/csu/tests/init_test.c Thu Oct 25 17:39:41 2018 (r339738)
+++ stable/12/lib/csu/tests/init_test.c Mon Sep 16 13:41:24 2019 (r352394)
@@ -32,41 +32,58 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#ifndef DSO_LIB
#include <atf-c.h>
+#endif
#include <crt.h>
typedef void (*func_ptr)(void);
-static volatile int jcr_run;
-static const func_ptr *jcr_ptr;
-static volatile int ctors_run;
-static volatile int preinit_array_run;
-static volatile int preinit_array_state = -1;
-static volatile int init_array_run;
-static volatile int init_array_state = -1;
+extern volatile int jcr_run;
+extern const func_ptr *jcr_ptr;
+extern const void *jcr_func_ptr;
+extern volatile int ctors_run;
+extern volatile int preinit_array_run;
+extern volatile int preinit_array_state;
+extern volatile int init_array_run;
+extern volatile int init_array_state;
+#ifndef DSO_BASE
+volatile int jcr_run;
+const func_ptr *jcr_ptr;
+volatile int ctors_run;
+volatile int preinit_array_run;
+volatile int preinit_array_state = -1;
+volatile int init_array_run;
+volatile int init_array_state = -1;
+
void _Jv_RegisterClasses(const func_ptr *);
__section(".jcr") __used static func_ptr jcr_func = (func_ptr)1;
+const void *jcr_func_ptr = &jcr_func;
void
-_Jv_RegisterClasses(const func_ptr *jcr __unused)
+_Jv_RegisterClasses(const func_ptr *jcr)
{
jcr_run = 1;
jcr_ptr = jcr;
}
+#endif
+#ifndef DSO_LIB
ATF_TC_WITHOUT_HEAD(jcr_test);
ATF_TC_BODY(jcr_test, tc)
{
ATF_REQUIRE_MSG(jcr_run == 1, ".jcr not run");
- ATF_REQUIRE_MSG(jcr_ptr == &jcr_func,
+ ATF_REQUIRE_MSG(jcr_ptr == jcr_func_ptr,
"Incorrect pointer passed to _Jv_RegisterClasses");
}
+#endif
+#ifndef DSO_BASE
static void
ctors_handler(void)
{
@@ -75,7 +92,9 @@ ctors_handler(void)
}
__section(".ctors") __used static func_ptr ctors_func =
&ctors_handler;
+#endif
+#ifndef DSO_LIB
ATF_TC_WITHOUT_HEAD(ctors_test);
ATF_TC_BODY(ctors_test, tc)
{
@@ -86,7 +105,9 @@ ATF_TC_BODY(ctors_test, tc)
ATF_REQUIRE_MSG(ctors_run == 0, ".ctors run");
#endif
}
+#endif
+#if !defined(DSO_BASE) && !defined(DSO_LIB)
static void
preinit_array_handler(void)
{
@@ -96,16 +117,25 @@ preinit_array_handler(void)
}
__section(".preinit_array") __used static func_ptr preinit_array_func =
&preinit_array_handler;
+#endif
+#ifndef DSO_LIB
ATF_TC_WITHOUT_HEAD(preinit_array_test);
ATF_TC_BODY(preinit_array_test, tc)
{
+#ifdef DSO_BASE
+ /* Check .preinit_array wasn't run in a DSO */
+ ATF_REQUIRE_MSG(preinit_array_run == 0, ".preinit_array run in DSO");
+#else
ATF_REQUIRE_MSG(preinit_array_run == 1, ".preinit_array not run");
ATF_REQUIRE_MSG(preinit_array_state == 0,
".preinit_array was not run before .init_array");
+#endif
}
+#endif
+#ifndef DSO_BASE
static void
init_array_handler(void)
{
@@ -115,14 +145,18 @@ init_array_handler(void)
}
__section(".init_array") __used static func_ptr init_array_func =
&init_array_handler;
+#endif
+#ifndef DSO_LIB
ATF_TC_WITHOUT_HEAD(init_array_test);
ATF_TC_BODY(init_array_test, tc)
{
ATF_REQUIRE_MSG(init_array_run == 1, ".init_array not run");
+#ifndef DSO_BASE
ATF_REQUIRE_MSG(init_array_state == 1,
".init_array was not run after .preinit_array");
+#endif
}
ATF_TP_ADD_TCS(tp)
@@ -135,3 +169,4 @@ ATF_TP_ADD_TCS(tp)
return (atf_no_error());
}
+#endif
Modified: stable/12/lib/csu/tests/static/Makefile
==============================================================================
--- head/lib/csu/tests/static/Makefile Thu Oct 25 17:39:41 2018 (r339738)
+++ stable/12/lib/csu/tests/static/Makefile Mon Sep 16 13:41:24 2019 (r352394)
@@ -2,7 +2,6 @@
.PATH: ${.CURDIR:H}
NO_SHARED=
-WARNS?= 6
.include "../Makefile.tests"
.include <bsd.test.mk>
Modified: stable/12/share/mk/src.opts.mk
==============================================================================
--- stable/12/share/mk/src.opts.mk Mon Sep 16 13:26:27 2019 (r352393)
+++ stable/12/share/mk/src.opts.mk Mon Sep 16 13:41:24 2019 (r352394)
@@ -193,6 +193,7 @@ __DEFAULT_YES_OPTIONS = \
__DEFAULT_NO_OPTIONS = \
BEARSSL \
+ BSD_CRTBEGIN \
BSD_GREP \
CLANG_EXTRAS \
DTRACE_TESTS \
@@ -396,6 +397,11 @@ __DEFAULT_NO_OPTIONS+=HYPERV
__DEFAULT_YES_OPTIONS+=NVME
.else
__DEFAULT_NO_OPTIONS+=NVME
+.endif
+
+# Sparc64 need extra crt*.o files
+.if ${__T:Msparc64}
+BROKEN_OPTIONS+=BSD_CRTBEGIN
.endif
.if ${COMPILER_FEATURES:Mc++11} && (${__T} == "amd64" || ${__T} == "i386")
Copied: stable/12/tools/build/options/WITHOUT_BSD_CRTBEGIN (from r339738, head/tools/build/options/WITHOUT_BSD_CRTBEGIN)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ stable/12/tools/build/options/WITHOUT_BSD_CRTBEGIN Mon Sep 16 13:41:24 2019 (r352394, copy of r339738, head/tools/build/options/WITHOUT_BSD_CRTBEGIN)
@@ -0,0 +1,5 @@
+.\" $FreeBSD$
+Disable the BSD licensed
+.Pa crtbegin.o
+and
+.Pa crtend.o .
Copied: stable/12/tools/build/options/WITH_BSD_CRTBEGIN (from r339738, head/tools/build/options/WITH_BSD_CRTBEGIN)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ stable/12/tools/build/options/WITH_BSD_CRTBEGIN Mon Sep 16 13:41:24 2019 (r352394, copy of r339738, head/tools/build/options/WITH_BSD_CRTBEGIN)
@@ -0,0 +1,5 @@
+.\" $FreeBSD$
+Enable the BSD licensed
+.Pa crtbegin.o
+and
+.Pa crtend.o .
More information about the svn-src-stable-12
mailing list