Index: stable/12/etc/mtree/BSD.tests.dist =================================================================== --- stable/12/etc/mtree/BSD.tests.dist (revision 352393) +++ stable/12/etc/mtree/BSD.tests.dist (revision 352394) @@ -1,1080 +1,1088 @@ # $FreeBSD$ # # Please see the file src/etc/mtree/README before making changes to this file. # /set type=dir uname=root gname=wheel mode=0755 . bin cat .. chflags .. chmod .. date .. dd .. echo .. expr .. ln .. ls .. mkdir .. mv .. pax .. pkill .. pwait .. rm .. rmdir .. sh builtins .. errors .. execution .. expansion .. invocation .. parameters .. parser .. set-e .. .. sleep .. test .. .. cddl lib .. sbin .. usr.bin ctfconvert .. ztest .. .. usr.sbin dtrace common aggs .. arithmetic .. arrays .. assocs .. begin .. bitfields .. buffering .. builtinvar .. cg .. clauses .. cpc .. decls .. drops .. dtraceUtil .. end .. env .. enum .. error .. exit .. fbtprovider .. funcs .. grammar .. include .. inline .. io .. ip .. java_api .. json .. lexer .. llquantize .. mdb .. mib .. misc .. multiaggs .. offsetof .. operators .. pid .. plockstat .. pointers .. pragma .. predicates .. preprocessor .. print .. printa .. printf .. privs .. probes .. proc .. profile-n .. providers .. raise .. rates .. safety .. scalars .. sched .. scripting .. sdt .. sizeof .. speculation .. stability .. stack .. stackdepth .. stop .. strlen .. strtoll .. struct .. sugar .. syscall .. sysevent .. tick-n .. trace .. tracemem .. translators .. typedef .. types .. uctf .. union .. usdt .. ustack .. vars .. version .. .. i386 arrays .. funcs .. pid .. ustack .. .. .. zfsd .. .. .. etc rc.d .. .. games .. gnu lib .. usr.bin diff .. .. .. lib atf libatf-c detail .. .. libatf-c++ detail .. .. test-programs .. .. + csu + dynamic + .. + dynamiclib + .. + static + .. + .. googletest gmock .. gmock_main .. gtest .. gtest_main .. .. libarchive .. libbe .. libc c063 .. db .. gen execve .. posix_spawn .. .. hash data .. .. iconv .. inet .. locale .. net getaddrinfo data .. .. .. nss .. regex data .. .. resolv .. rpc .. ssp .. setjmp .. stdio .. stdlib .. string .. sys .. time .. tls dso .. .. termios .. ttyio .. .. libcam .. libcasper services cap_dns .. cap_grp .. cap_pwd .. cap_sysctl .. .. .. libcrypt .. libdevdctl .. libkvm .. libmp .. libnv .. libproc .. libregex data .. .. librt .. libsbuf .. libthr dlopen .. .. libutil .. libxo .. msun .. .. libexec atf atf-check .. atf-sh .. .. rtld-elf .. tftpd .. .. sbin bectl .. dhclient .. devd .. growfs .. ifconfig .. mdconfig .. pfctl files .. .. ping .. .. secure lib .. libexec .. usr.bin .. usr.sbin .. .. share examples tests atf .. googletest .. plain .. tap .. .. .. zoneinfo .. .. sys acl .. aio .. audit .. auditpipe .. capsicum .. cddl zfs bin .. include .. tests acl cifs .. nontrivial .. trivial .. .. atime .. bootfs .. cache .. cachefile .. clean_mirror .. cli_root zfs_upgrade .. zfs_promote .. zfs_clone .. zfs_property .. zfs_destroy .. zpool_create .. zpool_history .. zpool_expand .. zpool_remove .. zfs_mount .. zfs_unshare .. zdb .. zpool_online .. zpool_get .. zpool_export .. zfs_copies .. zfs_get .. zfs .. zpool_clear .. zpool_import blockfiles .. .. zpool .. zpool_offline .. zpool_replace .. zfs_rollback .. zpool_set .. zfs_send .. zfs_set .. zpool_detach .. zfs_diff .. zpool_scrub .. zfs_inherit .. zfs_snapshot .. zfs_share .. zpool_destroy .. zpool_status .. zfs_unmount .. zfs_receive .. zfs_create .. zpool_upgrade blockfiles .. .. zpool_add .. zfs_rename .. zpool_attach .. zfs_reservation .. .. cli_user misc .. zfs_list .. zpool_iostat .. zpool_list .. .. compression .. ctime .. delegate .. devices .. exec .. grow_pool .. grow_replicas .. history .. hotplug .. hotspare .. inheritance .. interop .. inuse .. iscsi .. large_files .. largest_pool .. link_count .. migration .. mmap .. mount .. mv_files .. nestedfs .. no_space .. online_offline .. pool_names .. poolversion .. quota .. redundancy .. refquota .. refreserv .. rename_dirs .. replacement .. reservation .. rootpool .. rsend .. scrub_mirror .. slog .. snapshot .. snapused .. sparse .. threadsappend .. truncate .. txg_integrity .. userquota .. utils_test .. write_dirs .. xattr .. zfsd .. zil .. zinject .. zones .. zvol zvol_ENOSPC .. zvol_cli .. zvol_misc .. zvol_swap .. .. zvol_thrash .. .. .. .. dtrace .. fifo .. file .. fs fusefs .. tmpfs .. .. geom class concat .. eli .. gate .. gpt .. mirror .. nop .. part .. raid3 .. shsec .. stripe .. uzip etalon .. .. .. .. kern acct .. execve .. pipe .. .. kqueue libkqueue .. .. mac bsdextended .. portacl .. .. mqueue .. net .. netinet .. netipsec tunnel .. .. netmap .. netpfil pf ioctl .. .. .. opencrypto .. pjdfstest chflags .. chmod .. chown .. ftruncate .. granular .. link .. mkdir .. mkfifo .. mknod .. open .. rename .. rmdir .. symlink .. truncate .. unlink .. utimensat .. .. posixshm .. sys .. vfs .. vm .. .. usr.bin apply .. awk .. basename .. bmake archives fmt_44bsd .. fmt_44bsd_mod .. fmt_oldbsd .. .. basic t0 .. t1 .. t2 .. t3 .. .. execution ellipsis .. empty .. joberr .. plus .. .. shell builtin .. meta .. path .. path_select .. replace .. select .. .. suffixes basic .. src_wild1 .. src_wild2 .. .. syntax directive-t0 .. enl .. funny-targets .. semi .. .. sysmk t0 2 1 .. .. mk .. .. t1 2 1 .. .. mk .. .. t2 2 1 .. .. mk .. .. .. variables modifier_M .. modifier_t .. opt_V .. t0 .. .. .. bsdcat .. calendar .. cmp .. compress .. cpio .. col .. comm .. csplit .. cut .. dc .. diff .. dirname .. du .. file2c .. find .. fold .. getconf .. grep .. gzip .. head .. hexdump .. ident .. indent .. join .. jot .. lastcomm .. limits .. m4 .. mkimg .. ncal .. opensm .. pr .. printf .. procstat .. rs .. sdiff .. sed regress.multitest.out .. .. seq .. soelim .. stat .. tail .. tar .. timeout .. tr .. truncate .. units .. uudecode .. uuencode .. uniq .. vmstat .. xargs .. xinstall .. xo .. yacc yacc .. .. .. usr.sbin chown .. etcupdate .. extattr .. fstyp .. makefs .. newsyslog .. nmtree .. praudit .. pw .. rpcbind .. sa .. .. .. # vim: set expandtab ts=4 sw=4: Index: stable/12/gnu/lib/Makefile =================================================================== --- stable/12/gnu/lib/Makefile (revision 352393) +++ stable/12/gnu/lib/Makefile (revision 352394) @@ -1,32 +1,36 @@ # $FreeBSD$ .include -SUBDIR= csu +SUBDIR= SUBDIR.${MK_DIALOG}+= libdialog SUBDIR.${MK_GCC}+= libgcov .if ${MK_GCC} != "no" && ${MK_OPENMP} == "no" 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" SUBDIR+= libregex .endif .if ${MK_LLVM_LIBUNWIND} == "no" SUBDIR+= libgcc .endif # libsupc++ uses libstdc++ headers, although 'make includes' should # have taken care of that already. .if ${MK_GNUCXX} != "no" SUBDIR+= libstdc++ libsupc++ SUBDIR_DEPENDS_libsupc++:= libstdc++ .endif SUBDIR_PARALLEL= .include Index: stable/12/gnu/lib/csu/Makefile =================================================================== --- stable/12/gnu/lib/csu/Makefile (revision 352393) +++ stable/12/gnu/lib/csu/Makefile (revision 352394) @@ -1,77 +1,73 @@ # $FreeBSD$ .include MK_SSP= no GCCDIR= ${SRCTOP}/contrib/gcc GCCLIB= ${SRCTOP}/contrib/gcclibs CCDIR= ${SRCTOP}/gnu/usr.bin/cc .include "${CCDIR}/Makefile.tgt" .include "${CCDIR}/cc_tools/Makefile.hdrs" .PATH: ${GCCDIR}/config/${GCC_CPU} ${GCCDIR} SRCS= crtstuff.c ${COMMONHDRS} OBJS= crtbegin.o crtend.o crtbeginT.o SOBJS= crtbeginS.o crtendS.o CSTD?= gnu89 CFLAGS+= -DIN_GCC -DHAVE_LD_EH_FRAME_HDR -DDT_CONFIG -D__GLIBC__=3 CFLAGS.gcc+= -finhibit-size-directive -fno-toplevel-reorder CFLAGS+= -fno-inline-functions -fno-exceptions \ -fno-zero-initialized-in-bss -fno-asynchronous-unwind-tables \ -fno-omit-frame-pointer CFLAGS+= -I${GCCLIB}/include -I${GCCDIR}/config -I${GCCDIR} -I. \ -I${CCDIR}/cc_tools CRTS_CFLAGS= -DCRTSTUFFS_O -DSHARED ${PICFLAG} .if ${TARGET_CPUARCH} == "arm" 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 .endif BEGINSRC?= crtstuff.c ENDSRC?= crtstuff.c FILES= ${OBJS} ${SOBJS} ${TGTOBJS} FILESMODE= ${LIBMODE} FILESOWN= ${LIBOWN} FILESGRP= ${LIBGRP} FILESDIR= ${LIBDIR} # These FILES qualify as libraries for the purpose of LIBRARIES_ONLY. .undef LIBRARIES_ONLY ${OBJS} ${SOBJS}: ${SRCS:M*.h} CLEANFILES= ${OBJS} ${SOBJS} ${TGTOBJS} crtbegin.o: ${BEGINSRC} ${CC} ${CFLAGS} -g0 -DCRT_BEGIN \ -c -o ${.TARGET} ${.ALLSRC:N*.h} crtbeginT.o: ${BEGINSRC} ${CC} ${CFLAGS} -g0 -DCRT_BEGIN -DCRTSTUFFT_O \ -c -o ${.TARGET} ${.ALLSRC:N*.h} crtbeginS.o: ${BEGINSRC} ${CC} ${CFLAGS} -g0 -DCRT_BEGIN ${CRTS_CFLAGS} \ -c -o ${.TARGET} ${.ALLSRC:N*.h} crtend.o: ${ENDSRC} ${CC} ${CFLAGS} -g0 -DCRT_END \ -c -o ${.TARGET} ${.ALLSRC:N*.h} crtendS.o: ${ENDSRC} ${CC} ${CFLAGS} -g0 -DCRT_END ${CRTS_CFLAGS} \ -c -o ${.TARGET} ${.ALLSRC:N*.h} COMMONHDRS+= tm.h tconfig.h options.h CLEANFILES+= ${COMMONHDRS} optionlist cs-tconfig.h cs-tm.h .include Index: stable/12/lib/csu/Makefile =================================================================== --- stable/12/lib/csu/Makefile (revision 352393) +++ stable/12/lib/csu/Makefile (revision 352394) @@ -1,9 +1,14 @@ # $FreeBSD$ +.include + .if exists(${.CURDIR}/${MACHINE_ARCH}) SUBDIR+= ${MACHINE_ARCH} .else SUBDIR+= ${MACHINE_CPUARCH} .endif + +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests .include Index: stable/12/lib/csu/Makefile.inc =================================================================== --- stable/12/lib/csu/Makefile.inc (revision 352393) +++ stable/12/lib/csu/Makefile.inc (revision 352394) @@ -1,9 +1,32 @@ # $FreeBSD$ SSP_CFLAGS= SED_FIX_NOTE = -i "" -e '/\.note\.tag/s/progbits/note/' NO_WMISSING_VARIABLE_DECLARATIONS= +.include + +.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" Index: stable/12/lib/csu/aarch64/crt.h =================================================================== --- stable/12/lib/csu/aarch64/crt.h (nonexistent) +++ stable/12/lib/csu/aarch64/crt.h (revision 352394) @@ -0,0 +1,2 @@ +/* $FreeBSD$ */ +/* Empty so we can include this unconditionally */ Property changes on: stable/12/lib/csu/aarch64/crt.h ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: stable/12/lib/csu/amd64/crt.h =================================================================== --- stable/12/lib/csu/amd64/crt.h (nonexistent) +++ stable/12/lib/csu/amd64/crt.h (revision 352394) @@ -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 Property changes on: stable/12/lib/csu/amd64/crt.h ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: stable/12/lib/csu/arm/crt.h =================================================================== --- stable/12/lib/csu/arm/crt.h (nonexistent) +++ stable/12/lib/csu/arm/crt.h (revision 352394) @@ -0,0 +1,2 @@ +/* $FreeBSD$ */ +/* Empty so we can include this unconditionally */ Property changes on: stable/12/lib/csu/arm/crt.h ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: stable/12/lib/csu/common/crtbegin.c =================================================================== --- stable/12/lib/csu/common/crtbegin.c (nonexistent) +++ stable/12/lib/csu/common/crtbegin.c (revision 352394) @@ -0,0 +1,128 @@ +/*- + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +#include "crt.h" + +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; + +static crt_func __CTOR_LIST__[] __section(".ctors") __used = { + (crt_func)-1 +}; +static crt_func __DTOR_LIST__[] __section(".dtors") __used = { + (crt_func)-1 +}; + +static void +__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) + break; + fn(); + } +} + +asm ( + ".pushsection .fini \n" + "\t" INIT_CALL_SEQ(__do_global_dtors_aux) "\n" + ".popsection \n" +); +#endif + +/* + * Handler for gcj. These provide a _Jv_RegisterClasses function and fill + * out the .jcr section. We just need to call this function with a pointer + * to the appropriate section. + */ +extern void _Jv_RegisterClasses(void *) __weak_symbol; +static void register_classes(void) __used; + +static crt_func __JCR_LIST__[] __section(".jcr") __used = { }; + +#ifndef CTORS_CONSTRUCTORS +__attribute__((constructor)) +#endif +static void +register_classes(void) +{ + + if (_Jv_RegisterClasses != NULL && __JCR_LIST__[0] != 0) + _Jv_RegisterClasses(__JCR_LIST__); +} + +/* + * We can't use constructors when they use the .ctors section as they may be + * placed before __CTOR_LIST__. + */ +#ifdef CTORS_CONSTRUCTORS +asm ( + ".pushsection .init \n" + "\t" INIT_CALL_SEQ(register_classes) "\n" + ".popsection \n" +); +#endif Property changes on: stable/12/lib/csu/common/crtbegin.c ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: stable/12/lib/csu/common/crtend.c =================================================================== --- stable/12/lib/csu/common/crtend.c (nonexistent) +++ stable/12/lib/csu/common/crtend.c (revision 352394) @@ -0,0 +1,67 @@ +/*- + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "crt.h" + +#ifdef HAVE_CTORS +typedef void (*crt_func)(void); + +/* + * On some architectures and toolchains we may need to call the .ctors. + * These are called in the reverse order they are in the ELF file. + */ +static void __do_global_ctors_aux(void) __used; + +static crt_func __CTOR_END__[] __section(".ctors") __used = { + (crt_func)0 +}; +static crt_func __DTOR_END__[] __section(".dtors") __used = { + (crt_func)0 +}; +static crt_func __JCR_LIST__[] __section(".jcr") __used = { + (crt_func)0 +}; + +static void +__do_global_ctors_aux(void) +{ + crt_func fn; + int n; + + for (n = 1;; n++) { + fn = __CTOR_END__[-n]; + if (fn == (crt_func)0 || fn == (crt_func)-1) + break; + fn(); + } +} + +asm ( + ".pushsection .init \n" + "\t" INIT_CALL_SEQ(__do_global_ctors_aux) "\n" + ".popsection \n" +); +#endif Property changes on: stable/12/lib/csu/common/crtend.c ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: stable/12/lib/csu/i386/crt.h =================================================================== --- stable/12/lib/csu/i386/crt.h (nonexistent) +++ stable/12/lib/csu/i386/crt.h (revision 352394) @@ -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 Property changes on: stable/12/lib/csu/i386/crt.h ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: stable/12/lib/csu/mips/crt.h =================================================================== --- stable/12/lib/csu/mips/crt.h (nonexistent) +++ stable/12/lib/csu/mips/crt.h (revision 352394) @@ -0,0 +1,53 @@ +/*- + * 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 +#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 Property changes on: stable/12/lib/csu/mips/crt.h ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: stable/12/lib/csu/powerpc/Makefile =================================================================== --- stable/12/lib/csu/powerpc/Makefile (revision 352393) +++ stable/12/lib/csu/powerpc/Makefile (revision 352394) @@ -1,47 +1,47 @@ # $FreeBSD$ .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 \ -I${SRCTOP}/lib/libc/include CFLAGS+= -DCRT_IRELOC_SUPPRESS FILES= ${OBJS} FILESMODE= ${LIBMODE} FILESOWN= ${LIBOWN} FILESGRP= ${LIBGRP} FILESDIR= ${LIBDIR} # These FILES qualify as libraries for the purpose of LIBRARIES_ONLY. .undef LIBRARIES_ONLY CLEANFILES= ${OBJS} CLEANFILES+= crt1.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. crt1.s: crt1.c ${CC} ${CFLAGS} -S -o ${.TARGET} ${.CURDIR}/crt1.c sed ${SED_FIX_NOTE} ${.TARGET} crt1.o: crt1.s ${CC} ${CFLAGS:N-g} ${ACFLAGS} -c -o ${.TARGET} crt1.s gcrt1.s: crt1.c ${CC} ${CFLAGS} -DGCRT -S -o ${.TARGET} ${.CURDIR}/crt1.c sed ${SED_FIX_NOTE} ${.TARGET} gcrt1.o: gcrt1.s ${CC} ${CFLAGS:N-g} ${ACFLAGS} -c -o ${.TARGET} gcrt1.s Scrt1.s: crt1.c ${CC} ${CFLAGS} -fPIC -DPIC -S -o ${.TARGET} ${.CURDIR}/crt1.c sed ${SED_FIX_NOTE} ${.TARGET} Scrt1.o: Scrt1.s ${CC} ${CFLAGS:N-g} ${ACFLAGS} -c -o ${.TARGET} Scrt1.s .include Index: stable/12/lib/csu/powerpc/crt.h =================================================================== --- stable/12/lib/csu/powerpc/crt.h (nonexistent) +++ stable/12/lib/csu/powerpc/crt.h (revision 352394) @@ -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 Property changes on: stable/12/lib/csu/powerpc/crt.h ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: stable/12/lib/csu/powerpc/crtsavres.S =================================================================== --- stable/12/lib/csu/powerpc/crtsavres.S (nonexistent) +++ stable/12/lib/csu/powerpc/crtsavres.S (revision 352394) @@ -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 +__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,@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 Property changes on: stable/12/lib/csu/powerpc/crtsavres.S ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: stable/12/lib/csu/powerpc64/Makefile =================================================================== --- stable/12/lib/csu/powerpc64/Makefile (revision 352393) +++ stable/12/lib/csu/powerpc64/Makefile (revision 352394) @@ -1,47 +1,51 @@ # $FreeBSD$ .PATH: ${.CURDIR:H}/common 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 FILES= ${OBJS} FILESMODE= ${LIBMODE} FILESOWN= ${LIBOWN} FILESGRP= ${LIBGRP} FILESDIR= ${LIBDIR} # These FILES qualify as libraries for the purpose of LIBRARIES_ONLY. .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. 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 gcrt1.s: crt1.c ${CC} ${CFLAGS} -DGCRT -S -o ${.TARGET} ${.CURDIR}/crt1.c sed ${SED_FIX_NOTE} ${.TARGET} gcrt1.o: gcrt1.s ${CC} ${CFLAGS:N-g} ${ACFLAGS} -c -o ${.TARGET} gcrt1.s Scrt1.s: crt1.c ${CC} ${CFLAGS} -fPIC -DPIC -S -o ${.TARGET} ${.CURDIR}/crt1.c sed ${SED_FIX_NOTE} ${.TARGET} Scrt1.o: Scrt1.s ${CC} ${CFLAGS:N-g} ${ACFLAGS} -c -o ${.TARGET} Scrt1.s .include Index: stable/12/lib/csu/powerpc64/crt.h =================================================================== --- stable/12/lib/csu/powerpc64/crt.h (nonexistent) +++ stable/12/lib/csu/powerpc64/crt.h (revision 352394) @@ -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 Property changes on: stable/12/lib/csu/powerpc64/crt.h ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: stable/12/lib/csu/riscv/crt.h =================================================================== --- stable/12/lib/csu/riscv/crt.h (nonexistent) +++ stable/12/lib/csu/riscv/crt.h (revision 352394) @@ -0,0 +1,9 @@ +/* $FreeBSD$ */ + +#ifndef _CRT_H_ +#define _CRT_H_ + +#define HAVE_CTORS +#define INIT_CALL_SEQ(func) "call " __STRING(func) + +#endif Property changes on: stable/12/lib/csu/riscv/crt.h ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: stable/12/lib/csu/sparc64/crt.h =================================================================== --- stable/12/lib/csu/sparc64/crt.h (nonexistent) +++ stable/12/lib/csu/sparc64/crt.h (revision 352394) @@ -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) "call " __STRING(func) "; nop" + +#endif Property changes on: stable/12/lib/csu/sparc64/crt.h ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: stable/12/lib/csu/tests/Makefile =================================================================== --- stable/12/lib/csu/tests/Makefile (nonexistent) +++ stable/12/lib/csu/tests/Makefile (revision 352394) @@ -0,0 +1,10 @@ +# $FreeBSD$ + +SUBDIR= dso +TESTS_SUBDIRS= dynamic +TESTS_SUBDIRS+= dynamiclib +TESTS_SUBDIRS+= static + +SUBDIR_DEPEND_dynamiclib=dso + +.include Property changes on: stable/12/lib/csu/tests/Makefile ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: stable/12/lib/csu/tests/Makefile.tests =================================================================== --- stable/12/lib/csu/tests/Makefile.tests (nonexistent) +++ stable/12/lib/csu/tests/Makefile.tests (revision 352394) @@ -0,0 +1,13 @@ +# $FreeBSD$ + +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 +CFLAGS+= -I${.CURDIR:H:H}/${MACHINE_CPUARCH} +.endif Property changes on: stable/12/lib/csu/tests/Makefile.tests ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: stable/12/lib/csu/tests/cxx_constructors.cc =================================================================== --- stable/12/lib/csu/tests/cxx_constructors.cc (nonexistent) +++ stable/12/lib/csu/tests/cxx_constructors.cc (revision 352394) @@ -0,0 +1,105 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2018 Andrew Turner + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * 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. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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 +__FBSDID("$FreeBSD$"); + +#include +#include + +#include +#include +#include + +#ifndef DSO_LIB +#include +#endif + +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; + } + ~Foo() { + if (run_destructor_test) + _exit(1); + } +}; +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) +{ + + ATF_REQUIRE(constructor_run == 1); +} + +ATF_TEST_CASE_WITHOUT_HEAD(cxx_destructor); +ATF_TEST_CASE_BODY(cxx_destructor) +{ + pid_t pid, wpid; + int status; + + pid = fork(); + switch(pid) { + case -1: + break; + case 0: + run_destructor_test = true; + exit(0); + default: + while ((wpid = waitpid(pid, &status, 0)) == -1 && + errno == EINTR) + ; + ATF_REQUIRE(WEXITSTATUS(status) == 1); + break; + } +} + +ATF_INIT_TEST_CASES(tcs) +{ + + ATF_ADD_TEST_CASE(tcs, cxx_constructor); + ATF_ADD_TEST_CASE(tcs, cxx_destructor); +} +#endif Property changes on: stable/12/lib/csu/tests/cxx_constructors.cc ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: stable/12/lib/csu/tests/dso/Makefile =================================================================== --- stable/12/lib/csu/tests/dso/Makefile (nonexistent) +++ stable/12/lib/csu/tests/dso/Makefile (revision 352394) @@ -0,0 +1,25 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR:H} +SHLIB= h_csu +SHLIB_NAME= libh_csu.so +SHLIB_MAJOR= 1 + +WITHOUT_STATIC= +WITHOUT_PROFILE= +WITHOUT_PIC= + +CFLAGS+= -DDSO_LIB + +.include "../Makefile.tests" +SRCS= +.for src in ${ATF_TESTS_C} +SRCS+= ${src}.c +.endfor +.for src in ${ATF_TESTS_CXX} +SRCS+= ${src}.cc +.endfor + +LIBDIR= ${TESTSBASE}/lib/csu/dynamiclib/ + +.include Property changes on: stable/12/lib/csu/tests/dso/Makefile ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: stable/12/lib/csu/tests/dynamic/Makefile =================================================================== --- stable/12/lib/csu/tests/dynamic/Makefile (nonexistent) +++ stable/12/lib/csu/tests/dynamic/Makefile (revision 352394) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR:H} + +.include "../Makefile.tests" +.include Property changes on: stable/12/lib/csu/tests/dynamic/Makefile ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: stable/12/lib/csu/tests/dynamiclib/Makefile =================================================================== --- stable/12/lib/csu/tests/dynamiclib/Makefile (nonexistent) +++ stable/12/lib/csu/tests/dynamiclib/Makefile (revision 352394) @@ -0,0 +1,17 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR:H} +CFLAGS+= -DDSO_BASE +DPADD+= ${.OBJDIR:H}/dso/libh_csu.so +LDFLAGS+= -Wl,-rpath,${TESTSDIR} -L${.OBJDIR:H}/dso +LDADD+= -lh_csu + +.include "../Makefile.tests" + +.for test in ${ATF_TESTS_C} +ATF_TESTS_CXX+= ${test} +SRCS.${test}= ${test}.c +.endfor +ATF_TESTS_C:= + +.include Property changes on: stable/12/lib/csu/tests/dynamiclib/Makefile ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: stable/12/lib/csu/tests/fini_test.c =================================================================== --- stable/12/lib/csu/tests/fini_test.c (nonexistent) +++ stable/12/lib/csu/tests/fini_test.c (revision 352394) @@ -0,0 +1,171 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2018 Andrew Turner + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * 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. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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 +__FBSDID("$FreeBSD$"); + +#include +#include + +#include +#include +#include +#include + +#include + +#include + +extern bool run_dtors_test; +extern bool run_fini_array_test; +void dso_handle_check(void); + + +#ifndef DSO_BASE +typedef void (*func_ptr)(void); + +bool run_dtors_test = false; +bool run_fini_array_test = false; + +static void +dtors_handler(void) +{ + + if (run_dtors_test) + _exit(1); +} +__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) +{ + pid_t pid, wpid; + int status; + + pid = fork(); + switch(pid) { + case -1: + break; + case 0: + run_dtors_test = true; + exit(0); + default: + while ((wpid = waitpid(pid, &status, 0)) == -1 && + errno == EINTR) + ; +#ifdef HAVE_CTORS + ATF_REQUIRE_MSG(WEXITSTATUS(status) == 1, + ".dtors failed to run"); +#else + ATF_REQUIRE_MSG(WEXITSTATUS(status) == 0, + ".dtors incorrectly ran"); +#endif + break; + } +} +#endif + +#ifndef DSO_BASE +static void +fini_array_handler(void) +{ + + if (run_fini_array_test) + _exit(1); +} +__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) +{ + pid_t pid, wpid; + int status; + + pid = fork(); + switch(pid) { + case -1: + break; + case 0: + run_fini_array_test = true; + exit(0); + default: + while ((wpid = waitpid(pid, &status, 0)) == -1 && + errno == EINTR) + ; + ATF_REQUIRE_MSG(WEXITSTATUS(status) == 1, + ".fini_array failed to run"); + 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 Property changes on: stable/12/lib/csu/tests/fini_test.c ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: stable/12/lib/csu/tests/init_test.c =================================================================== --- stable/12/lib/csu/tests/init_test.c (nonexistent) +++ stable/12/lib/csu/tests/init_test.c (revision 352394) @@ -0,0 +1,172 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2018 Andrew Turner + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * 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. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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 +__FBSDID("$FreeBSD$"); + +#ifndef DSO_LIB +#include +#endif + +#include + +typedef void (*func_ptr)(void); + +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) +{ + + 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_ptr, + "Incorrect pointer passed to _Jv_RegisterClasses"); +} +#endif + +#ifndef DSO_BASE +static void +ctors_handler(void) +{ + + ctors_run = 1; +} +__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) +{ + +#ifdef HAVE_CTORS + ATF_REQUIRE_MSG(ctors_run == 1, ".ctors not run"); +#else + ATF_REQUIRE_MSG(ctors_run == 0, ".ctors run"); +#endif +} +#endif + +#if !defined(DSO_BASE) && !defined(DSO_LIB) +static void +preinit_array_handler(void) +{ + + preinit_array_run = 1; + preinit_array_state = init_array_run; +} +__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) +{ + + init_array_run = 1; + init_array_state = preinit_array_run; +} +__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) +{ + + ATF_TP_ADD_TC(tp, jcr_test); + ATF_TP_ADD_TC(tp, ctors_test); + ATF_TP_ADD_TC(tp, preinit_array_test); + ATF_TP_ADD_TC(tp, init_array_test); + + return (atf_no_error()); +} +#endif Property changes on: stable/12/lib/csu/tests/init_test.c ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: stable/12/lib/csu/tests/static/Makefile =================================================================== --- stable/12/lib/csu/tests/static/Makefile (nonexistent) +++ stable/12/lib/csu/tests/static/Makefile (revision 352394) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR:H} +NO_SHARED= + +.include "../Makefile.tests" +.include Property changes on: stable/12/lib/csu/tests/static/Makefile ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: stable/12/lib/csu/tests/Makefile.inc =================================================================== --- stable/12/lib/csu/tests/Makefile.inc (nonexistent) +++ stable/12/lib/csu/tests/Makefile.inc (revision 352394) @@ -0,0 +1,3 @@ +# $FreeBSD$ + +TESTSDIR:= ${TESTSBASE}/${RELDIR:C/csu\/tests/csu/} Property changes on: stable/12/lib/csu/tests/Makefile.inc ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: stable/12/share/mk/src.opts.mk =================================================================== --- stable/12/share/mk/src.opts.mk (revision 352393) +++ stable/12/share/mk/src.opts.mk (revision 352394) @@ -1,592 +1,598 @@ # $FreeBSD$ # # Option file for FreeBSD /usr/src builds. # # Users define WITH_FOO and WITHOUT_FOO on the command line or in /etc/src.conf # and /etc/make.conf files. These translate in the build system to MK_FOO={yes,no} # with sensible (usually) defaults. # # Makefiles must include bsd.opts.mk after defining specific MK_FOO options that # are applicable for that Makefile (typically there are none, but sometimes there # are exceptions). Recursive makes usually add MK_FOO=no for options that they wish # to omit from that make. # # Makefiles must include bsd.mkopt.mk before they test the value of any MK_FOO # variable. # # Makefiles may also assume that this file is included by src.opts.mk should it # need variables defined there prior to the end of the Makefile where # bsd.{subdir,lib.bin}.mk is traditionally included. # # The old-style YES_FOO and NO_FOO are being phased out. No new instances of them # should be added. Old instances should be removed since they were just to # bridge the gap between FreeBSD 4 and FreeBSD 5. # # Makefiles should never test WITH_FOO or WITHOUT_FOO directly (although an # exception is made for _WITHOUT_SRCONF which turns off this mechanism # completely inside bsd.*.mk files). # .if !target(____) ____: .include # # Define MK_* variables (which are either "yes" or "no") for users # to set via WITH_*/WITHOUT_* in /etc/src.conf and override in the # make(1) environment. # These should be tested with `== "no"' or `!= "no"' in makefiles. # The NO_* variables should only be set by makefiles for variables # that haven't been converted over. # # These options are used by the src builds. Those listed in # __DEFAULT_YES_OPTIONS default to 'yes' and will build unless turned # off. __DEFAULT_NO_OPTIONS will default to 'no' and won't build # unless turned on. Any options listed in 'BROKEN_OPTIONS' will be # hard-wired to 'no'. "Broken" here means not working or # not-appropriate and/or not supported. It doesn't imply something is # wrong with the code. There's not a single good word for this, so # BROKEN was selected as the least imperfect one considered at the # time. Options are added to BROKEN_OPTIONS list on a per-arch basis. # At this time, there's no provision for mutually incompatible options. __DEFAULT_YES_OPTIONS = \ ACCT \ ACPI \ AMD \ APM \ AT \ ATM \ AUDIT \ AUTHPF \ AUTOFS \ BHYVE \ BINUTILS \ BINUTILS_BOOTSTRAP \ BLACKLIST \ BLUETOOTH \ BOOT \ BOOTPARAMD \ BOOTPD \ BSD_CPIO \ BSDINSTALL \ BSNMP \ BZIP2 \ CALENDAR \ CAPSICUM \ CASPER \ CCD \ CDDL \ CPP \ CROSS_COMPILER \ CRYPT \ CTM \ CUSE \ CXX \ DIALOG \ DICT \ DMAGENT \ DYNAMICROOT \ ED_CRYPTO \ EE \ EFI \ ELFTOOLCHAIN_BOOTSTRAP \ EXAMPLES \ FDT \ FILE \ FINGER \ FLOPPY \ FMTREE \ FORTH \ FP_LIBC \ FREEBSD_UPDATE \ FTP \ GAMES \ GCOV \ GDB \ GNU_DIFF \ GNU_GREP \ GOOGLETEST \ GPIO \ HAST \ HTML \ ICONV \ INET \ INET6 \ INETD \ IPFILTER \ IPFW \ ISCSI \ JAIL \ KDUMP \ KVM \ LDNS \ LDNS_UTILS \ LEGACY_CONSOLE \ LIB32 \ LIBPTHREAD \ LIBTHR \ LLVM_COV \ LOADER_GELI \ LOADER_LUA \ LOADER_OFW \ LOADER_UBOOT \ LOCALES \ LOCATE \ LPR \ LS_COLORS \ LZMA_SUPPORT \ MAIL \ MAILWRAPPER \ MAKE \ NDIS \ NETCAT \ NETGRAPH \ NLS_CATALOGS \ NS_CACHING \ NTP \ OFED \ OPENSSL \ PAM \ PC_SYSINSTALL \ PF \ PKGBOOTSTRAP \ PMC \ PORTSNAP \ PPP \ QUOTAS \ RADIUS_SUPPORT \ RBOOTD \ REPRODUCIBLE_BUILD \ RESCUE \ ROUTED \ SENDMAIL \ SERVICESDB \ SETUID_LOGIN \ SHAREDOCS \ SOURCELESS \ SOURCELESS_HOST \ SOURCELESS_UCODE \ SVNLITE \ SYSCONS \ SYSTEM_COMPILER \ SYSTEM_LINKER \ TALK \ TCP_WRAPPERS \ TCSH \ TELNET \ TEXTPROC \ TFTP \ TIMED \ UNBOUND \ USB \ UTMPX \ VI \ VT \ WIRELESS \ WPA_SUPPLICANT_EAPOL \ ZFS \ LOADER_ZFS \ ZONEINFO __DEFAULT_NO_OPTIONS = \ BEARSSL \ + BSD_CRTBEGIN \ BSD_GREP \ CLANG_EXTRAS \ DTRACE_TESTS \ GNU_GREP_COMPAT \ HESIOD \ LIBSOFT \ LOADER_FIREWIRE \ LOADER_FORCE_LE \ LOADER_VERIEXEC_PASS_MANIFEST \ NAND \ OFED_EXTRA \ OPENLDAP \ RPCBIND_WARMSTART_SUPPORT \ SHARED_TOOLCHAIN \ SORT_THREADS \ SVN \ ZONEINFO_LEAPSECONDS_SUPPORT \ ZONEINFO_OLD_TIMEZONES_SUPPORT \ # LEFT/RIGHT. Left options which default to "yes" unless their corresponding # RIGHT option is disabled. __DEFAULT_DEPENDENT_OPTIONS= \ CLANG_FULL/CLANG \ LLVM_TARGET_ALL/CLANG \ LOADER_VERIEXEC/BEARSSL \ LOADER_EFI_SECUREBOOT/LOADER_VERIEXEC \ VERIEXEC/BEARSSL \ # MK_*_SUPPORT options which default to "yes" unless their corresponding # MK_* variable is set to "no". # .for var in \ BLACKLIST \ BZIP2 \ INET \ INET6 \ KERBEROS \ KVM \ NETGRAPH \ PAM \ TESTS \ WIRELESS __DEFAULT_DEPENDENT_OPTIONS+= ${var}_SUPPORT/${var} .endfor # # Default behaviour of some options depends on the architecture. Unfortunately # this means that we have to test TARGET_ARCH (the buildworld case) as well # as MACHINE_ARCH (the non-buildworld case). Normally TARGET_ARCH is not # used at all in bsd.*.mk, but we have to make an exception here if we want # to allow defaults for some things like clang to vary by target architecture. # Additional, per-target behavior should be rarely added only after much # gnashing of teeth and grinding of gears. # .if defined(TARGET_ARCH) __T=${TARGET_ARCH} .else __T=${MACHINE_ARCH} .endif .if defined(TARGET) __TT=${TARGET} .else __TT=${MACHINE} .endif # All supported backends for LLVM_TARGET_XXX __LLVM_TARGETS= \ aarch64 \ arm \ mips \ powerpc \ sparc \ x86 __LLVM_TARGET_FILT= C/(amd64|i386)/x86/:S/sparc64/sparc/:S/arm64/aarch64/ .for __llt in ${__LLVM_TARGETS} # Default the given TARGET's LLVM_TARGET support to the value of MK_CLANG. .if ${__TT:${__LLVM_TARGET_FILT}} == ${__llt} __DEFAULT_DEPENDENT_OPTIONS+= LLVM_TARGET_${__llt:${__LLVM_TARGET_FILT}:tu}/CLANG # Disable other targets for arm and armv6, to work around "relocation truncated # to fit" errors with BFD ld, since libllvm.a will get too large to link. .elif ${__T} == "arm" || ${__T} == "armv6" __DEFAULT_NO_OPTIONS+=LLVM_TARGET_${__llt:tu} # aarch64 needs arm for -m32 support. .elif ${__TT} == "arm64" && ${__llt} == "arm" __DEFAULT_DEPENDENT_OPTIONS+= LLVM_TARGET_ARM/LLVM_TARGET_AARCH64 # Default the rest of the LLVM_TARGETs to the value of MK_LLVM_TARGET_ALL # which is based on MK_CLANG. .else __DEFAULT_DEPENDENT_OPTIONS+= LLVM_TARGET_${__llt:${__LLVM_TARGET_FILT}:tu}/LLVM_TARGET_ALL .endif .endfor __DEFAULT_NO_OPTIONS+=LLVM_TARGET_BPF __DEFAULT_NO_OPTIONS+=LLVM_TARGET_RISCV .include # If the compiler is not C++11 capable, disable Clang and use GCC instead. # This means that architectures that have GCC 4.2 as default can not # build Clang without using an external compiler. .if ${COMPILER_FEATURES:Mc++11} && (${__T} == "aarch64" || \ ${__T} == "amd64" || ${__TT} == "arm" || ${__T} == "i386") # Clang is enabled, and will be installed as the default /usr/bin/cc. __DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_IS_CC LLD __DEFAULT_NO_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX GPL_DTC .elif ${COMPILER_FEATURES:Mc++11} && ${__T:Mriscv*} == "" && ${__T} != "sparc64" # If an external compiler that supports C++11 is used as ${CC} and Clang # supports the target, then Clang is enabled but GCC is installed as the # default /usr/bin/cc. __DEFAULT_YES_OPTIONS+=CLANG GCC GCC_BOOTSTRAP GNUCXX GPL_DTC LLD __DEFAULT_NO_OPTIONS+=CLANG_BOOTSTRAP CLANG_IS_CC .else # Everything else disables Clang, and uses GCC instead. __DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX GPL_DTC __DEFAULT_NO_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_IS_CC LLD .endif # In-tree binutils/gcc are older versions without modern architecture support. .if ${__T} == "aarch64" || ${__T:Mriscv*} != "" BROKEN_OPTIONS+=BINUTILS BINUTILS_BOOTSTRAP GCC GCC_BOOTSTRAP GDB .endif .if ${__T:Mriscv*} != "" BROKEN_OPTIONS+=OFED .endif .if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386" || \ ${__T:Mriscv*} != "" || ${__TT} == "mips" __DEFAULT_YES_OPTIONS+=LLVM_LIBUNWIND .else __DEFAULT_NO_OPTIONS+=LLVM_LIBUNWIND .endif .if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "armv7" || \ ${__T} == "i386" __DEFAULT_YES_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD .else __DEFAULT_NO_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD .endif .if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386" __DEFAULT_YES_OPTIONS+=LLDB .else __DEFAULT_NO_OPTIONS+=LLDB .endif # LLVM lacks support for FreeBSD 64-bit atomic operations for ARMv4/ARMv5 .if ${__T} == "arm" BROKEN_OPTIONS+=LLDB .endif # GDB in base is generally less functional than GDB in ports. Ports GDB # sparc64 kernel support has not been tested. .if ${__T} == "sparc64" __DEFAULT_NO_OPTIONS+=GDB_LIBEXEC .else __DEFAULT_YES_OPTIONS+=GDB_LIBEXEC .endif # Only doing soft float API stuff on armv6 and armv7 .if ${__T} != "armv6" && ${__T} != "armv7" BROKEN_OPTIONS+=LIBSOFT .endif .if ${__T:Mmips*} BROKEN_OPTIONS+=SSP .endif # EFI doesn't exist on mips, powerpc, sparc or riscv. .if ${__T:Mmips*} || ${__T:Mpowerpc*} || ${__T:Msparc64} || ${__T:Mriscv*} BROKEN_OPTIONS+=EFI .endif # OFW is only for powerpc and sparc64, exclude others .if ${__T:Mpowerpc*} == "" && ${__T:Msparc64} == "" BROKEN_OPTIONS+=LOADER_OFW .endif # UBOOT is only for arm, mips and powerpc, exclude others .if ${__T:Marm*} == "" && ${__T:Mmips*} == "" && ${__T:Mpowerpc*} == "" BROKEN_OPTIONS+=LOADER_UBOOT .endif # GELI and Lua in loader currently cause boot failures on sparc64 and powerpc. # Further debugging is required -- probably they are just broken on big # endian systems generically (they jump to null pointers or try to read # crazy high addresses, which is typical of endianness problems). .if ${__T} == "sparc64" || ${__T:Mpowerpc*} BROKEN_OPTIONS+=LOADER_GELI LOADER_LUA .endif .if ${__T:Mmips64*} # profiling won't work on MIPS64 because there is only assembly for o32 BROKEN_OPTIONS+=PROFILE .endif .if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386" || \ ${__T} == "powerpc64" || ${__T} == "sparc64" __DEFAULT_YES_OPTIONS+=CXGBETOOL __DEFAULT_YES_OPTIONS+=MLX5TOOL .else __DEFAULT_NO_OPTIONS+=CXGBETOOL __DEFAULT_NO_OPTIONS+=MLX5TOOL .endif # HyperV is currently x86-only .if ${__T} == "amd64" || ${__T} == "i386" __DEFAULT_YES_OPTIONS+=HYPERV .else __DEFAULT_NO_OPTIONS+=HYPERV .endif # NVME is only x86 and powerpc64 .if ${__T} == "amd64" || ${__T} == "i386" || ${__T} == "powerpc64" __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") __DEFAULT_YES_OPTIONS+=OPENMP .else __DEFAULT_NO_OPTIONS+=OPENMP .endif .include # # MK_* options that default to "yes" if the compiler is a C++11 compiler. # .for var in \ LIBCPLUSPLUS .if !defined(MK_${var}) .if ${COMPILER_FEATURES:Mc++11} .if defined(WITHOUT_${var}) MK_${var}:= no .else MK_${var}:= yes .endif .else .if defined(WITH_${var}) MK_${var}:= yes .else MK_${var}:= no .endif .endif .endif .endfor # # Force some options off if their dependencies are off. # Order is somewhat important. # .if !${COMPILER_FEATURES:Mc++11} MK_GOOGLETEST:= no MK_LLVM_LIBUNWIND:= no .endif .if ${MK_BINUTILS} == "no" MK_GDB:= no .endif .if ${MK_CAPSICUM} == "no" MK_CASPER:= no .endif .if ${MK_LIBPTHREAD} == "no" MK_LIBTHR:= no .endif .if ${MK_LDNS} == "no" MK_LDNS_UTILS:= no MK_UNBOUND:= no .endif .if ${MK_SOURCELESS} == "no" MK_SOURCELESS_HOST:= no MK_SOURCELESS_UCODE:= no .endif .if ${MK_CDDL} == "no" MK_ZFS:= no MK_LOADER_ZFS:= no MK_CTF:= no .endif .if ${MK_CRYPT} == "no" MK_OPENSSL:= no MK_OPENSSH:= no MK_KERBEROS:= no .endif .if ${MK_CXX} == "no" MK_CLANG:= no MK_GNUCXX:= no MK_TESTS:= no .endif .if ${MK_DIALOG} == "no" MK_BSDINSTALL:= no .endif .if ${MK_MAIL} == "no" MK_MAILWRAPPER:= no MK_SENDMAIL:= no MK_DMAGENT:= no .endif .if ${MK_NETGRAPH} == "no" MK_ATM:= no MK_BLUETOOTH:= no .endif .if ${MK_NLS} == "no" MK_NLS_CATALOGS:= no .endif .if ${MK_OPENSSL} == "no" MK_OPENSSH:= no MK_KERBEROS:= no .endif .if ${MK_PF} == "no" MK_AUTHPF:= no .endif .if ${MK_OFED} == "no" MK_OFED_EXTRA:= no .endif .if ${MK_PORTSNAP} == "no" # freebsd-update depends on phttpget from portsnap MK_FREEBSD_UPDATE:= no .endif .if ${MK_TESTS} == "no" MK_DTRACE_TESTS:= no .endif .if ${MK_TESTS_SUPPORT} == "no" MK_GOOGLETEST:= no .endif .if ${MK_ZONEINFO} == "no" MK_ZONEINFO_LEAPSECONDS_SUPPORT:= no MK_ZONEINFO_OLD_TIMEZONES_SUPPORT:= no .endif .if ${MK_CROSS_COMPILER} == "no" MK_BINUTILS_BOOTSTRAP:= no MK_CLANG_BOOTSTRAP:= no MK_ELFTOOLCHAIN_BOOTSTRAP:= no MK_GCC_BOOTSTRAP:= no MK_LLD_BOOTSTRAP:= no .endif .if ${MK_TOOLCHAIN} == "no" MK_BINUTILS:= no MK_CLANG:= no MK_GCC:= no MK_GDB:= no MK_INCLUDES:= no MK_LLD:= no MK_LLDB:= no .endif .if ${MK_CLANG} == "no" MK_CLANG_EXTRAS:= no MK_CLANG_FULL:= no MK_LLVM_COV:= no .endif .if ${MK_LOADER_VERIEXEC} == "no" MK_LOADER_VERIEXEC_PASS_MANIFEST := no .endif # # MK_* options whose default value depends on another option. # .for vv in \ GSSAPI/KERBEROS \ MAN_UTILS/MAN .if defined(WITH_${vv:H}) MK_${vv:H}:= yes .elif defined(WITHOUT_${vv:H}) MK_${vv:H}:= no .else MK_${vv:H}:= ${MK_${vv:T}} .endif .endfor # # Set defaults for the MK_*_SUPPORT variables. # .if !${COMPILER_FEATURES:Mc++11} MK_LLDB:= no .endif # gcc 4.8 and newer supports libc++, so suppress gnuc++ in that case. # while in theory we could build it with that, we don't want to do # that since it creates too much confusion for too little gain. # XXX: This is incomplete and needs X_COMPILER_TYPE/VERSION checks too # to prevent Makefile.inc1 from bootstrapping unneeded dependencies # and to support 'make delete-old' when supplying an external toolchain. .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 40800 MK_GNUCXX:=no MK_GCC:=no .endif .endif # !target(____) Index: stable/12/tools/build/options/WITHOUT_BSD_CRTBEGIN =================================================================== --- stable/12/tools/build/options/WITHOUT_BSD_CRTBEGIN (nonexistent) +++ stable/12/tools/build/options/WITHOUT_BSD_CRTBEGIN (revision 352394) @@ -0,0 +1,5 @@ +.\" $FreeBSD$ +Disable the BSD licensed +.Pa crtbegin.o +and +.Pa crtend.o . Property changes on: stable/12/tools/build/options/WITHOUT_BSD_CRTBEGIN ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: stable/12/tools/build/options/WITH_BSD_CRTBEGIN =================================================================== --- stable/12/tools/build/options/WITH_BSD_CRTBEGIN (nonexistent) +++ stable/12/tools/build/options/WITH_BSD_CRTBEGIN (revision 352394) @@ -0,0 +1,5 @@ +.\" $FreeBSD$ +Enable the BSD licensed +.Pa crtbegin.o +and +.Pa crtend.o . Property changes on: stable/12/tools/build/options/WITH_BSD_CRTBEGIN ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: stable/12 =================================================================== --- stable/12 (revision 352393) +++ stable/12 (revision 352394) Property changes on: stable/12 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /head:r339738,339744,339770,339773,339864-339866,339907-339908,339912-339913,339916,339954,340213,340395,340840,340910-340911,341424,342773,342974,351027,352073