Index: head/lib/csu/aarch64/Makefile =================================================================== --- head/lib/csu/aarch64/Makefile (revision 362588) +++ head/lib/csu/aarch64/Makefile (revision 362589) @@ -1,37 +1,38 @@ # $FreeBSD$ .PATH: ${.CURDIR:H}/common SRCS= crti.S crtn.S OBJS= ${SRCS:N*.h:R:S/$/.o/g} OBJS+= Scrt1.o crt1.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} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o +CLEANFILES+= crtbrand.o ignore_init_note.o gcrt1_c.o: crt1_c.c ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c -gcrt1.o: gcrt1_c.o crt1_s.o - ${LD} ${_LDFLAGS} -o gcrt1.o -r crt1_s.o gcrt1_c.o +gcrt1.o: gcrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o + ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC} -crt1.o: crt1_c.o crt1_s.o - ${LD} ${_LDFLAGS} -o crt1.o -r crt1_s.o crt1_c.o +crt1.o: crt1_c.o crt1_s.o crtbrand.o ignore_init_note.o + ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC} Scrt1_c.o: crt1_c.c ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c -Scrt1.o: Scrt1_c.o crt1_s.o - ${LD} ${_LDFLAGS} -o Scrt1.o -r crt1_s.o Scrt1_c.o +Scrt1.o: Scrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o + ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC} .include Index: head/lib/csu/aarch64/crt1_s.S =================================================================== --- head/lib/csu/aarch64/crt1_s.S (revision 362588) +++ head/lib/csu/aarch64/crt1_s.S (revision 362589) @@ -1,47 +1,44 @@ /* LINTLIBRARY */ /*- * Copyright 1996-1998 John D. Polstra. * Copyright 2014 Andrew Turner. * Copyright 2014-2015 The FreeBSD Foundation. * All rights reserved. * * Portions of this software were developed by Andrew Turner * under sponsorship from the FreeBSD Foundation. * * 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 ``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 "crtbrand.S" -#include "ignore_init_note.S" - ENTRY(_start) mov x3, x2 /* cleanup */ add x1, x0, #8 /* load argv */ ldr x0, [x0] /* load argc */ add x2, x1, x0, lsl #3 /* env is after argv */ add x2, x2, #8 /* argv is null terminated */ b __start END(_start) .section .note.GNU-stack,"",@progbits Index: head/lib/csu/arm/Makefile =================================================================== --- head/lib/csu/arm/Makefile (revision 362588) +++ head/lib/csu/arm/Makefile (revision 362589) @@ -1,40 +1,41 @@ # $FreeBSD$ .PATH: ${.CURDIR:H}/common SRCS= crti.S crtn.S OBJS= ${SRCS:N*.h:R:S/$/.o/g} OBJS+= Scrt1.o crt1.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} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o +CLEANFILES+= crtbrand.o ignore_init_note.o crt1_c.o: crt1_c.c ${CC} ${CFLAGS} ${STATIC_CFLAGS} -c -o ${.TARGET} ${.CURDIR}/crt1_c.c -crt1.o: crt1_c.o crt1_s.o - ${LD} ${_LDFLAGS} -o crt1.o -r crt1_s.o crt1_c.o +crt1.o: crt1_c.o crt1_s.o crtbrand.o ignore_init_note.o + ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC} gcrt1_c.o: crt1_c.c ${CC} ${CFLAGS} ${STATIC_CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c -gcrt1.o: gcrt1_c.o crt1_s.o - ${LD} ${_LDFLAGS} -o gcrt1.o -r crt1_s.o gcrt1_c.o +gcrt1.o: gcrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o + ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC} Scrt1_c.o: crt1_c.c ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c -Scrt1.o: Scrt1_c.o crt1_s.o - ${LD} ${_LDFLAGS} -o Scrt1.o -r crt1_s.o Scrt1_c.o +Scrt1.o: Scrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o + ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC} .include Index: head/lib/csu/arm/crt1_s.S =================================================================== --- head/lib/csu/arm/crt1_s.S (revision 362588) +++ head/lib/csu/arm/crt1_s.S (revision 362589) @@ -1,78 +1,79 @@ /* LINTLIBRARY */ /*- * SPDX-License-Identifier: BSD-4-Clause * * Copyright 2001 David E. O'Brien. * All rights reserved. * Copyright 1996-1998 John D. Polstra. * All rights reserved. * Copyright (c) 1997 Jason R. Thorpe. * Copyright (c) 1995 Christopher G. Demetriou * All rights reserved. * * 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. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed for the * FreeBSD Project. See https://www.freebsd.org/ for * information about FreeBSD. * This product includes software developed for the * NetBSD Project. See http://www.netbsd.org/ for * information about NetBSD. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission * * 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 "crtbrand.S" -#include "ignore_init_note.S" +#include +#include +#include "notes.h" ENTRY(_start) mov r5, r2 /* cleanup */ mov r4, r1 /* obj_main */ mov r3, r0 /* ps_strings */ /* Get argc, argv, and envp from stack */ ldr r0, [sp, #0x0000] add r1, sp, #0x0004 add r2, r1, r0, lsl #2 add r2, r2, #0x0004 /* Ensure the stack is properly aligned before calling C code. */ bic sp, sp, #7 sub sp, sp, #8 str r5, [sp, #4] str r4, [sp, #0] b __start END(_start) .section .note.tag,"a",%note .p2align 2 .4byte 2f-1f .4byte 4f-3f .4byte NT_FREEBSD_ARCH_TAG 1: .asciz NOTE_FREEBSD_VENDOR 2: .p2align 2 3: .asciz MACHINE_ARCH 4: .section .note.GNU-stack,"",%progbits Index: head/lib/csu/i386/Makefile =================================================================== --- head/lib/csu/i386/Makefile (revision 362588) +++ head/lib/csu/i386/Makefile (revision 362589) @@ -1,39 +1,40 @@ # $FreeBSD$ .PATH: ${.CURDIR:H}/common SRCS= crti.S crtn.S OBJS= ${SRCS:N*.h:R:S/$/.o/g} OBJS+= Scrt1.o crt1.o gcrt1.o CFLAGS+= -I${.CURDIR} -I${.CURDIR:H}/common \ -I${SRCTOP}/lib/libc/include CFLAGS+= -DCRT_IRELOC_REL 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} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o +CLEANFILES+= crtbrand.o ignore_init_note.o gcrt1_c.o: crt1_c.c ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c -gcrt1.o: gcrt1_c.o crt1_s.o - ${LD} ${_LDFLAGS} -o gcrt1.o -r crt1_s.o gcrt1_c.o +gcrt1.o: gcrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o + ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC} -crt1.o: crt1_c.o crt1_s.o - ${LD} ${_LDFLAGS} -o crt1.o -r crt1_s.o crt1_c.o +crt1.o: crt1_c.o crt1_s.o crtbrand.o ignore_init_note.o + ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC} ${OBJCOPY} --localize-symbol _start1 crt1.o Scrt1_c.o: crt1_c.c ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c -Scrt1.o: Scrt1_c.o crt1_s.o - ${LD} ${_LDFLAGS} -o Scrt1.o -r crt1_s.o Scrt1_c.o +Scrt1.o: Scrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o + ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC} ${OBJCOPY} --localize-symbol _start1 Scrt1.o .include Index: head/lib/csu/i386/crt1_s.S =================================================================== --- head/lib/csu/i386/crt1_s.S (revision 362588) +++ head/lib/csu/i386/crt1_s.S (revision 362589) @@ -1,54 +1,51 @@ /*- * Copyright 2009 Konstantin Belousov. * All rights reserved. * * 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$ */ #include __FBSDID("$FreeBSD$"); -#include "crtbrand.S" -#include "ignore_init_note.S" - .text .align 4 .globl _start .type _start, @function _start: .cfi_startproc xorl %ebp,%ebp pushl %ebp .cfi_def_cfa_offset 4 movl %esp,%ebp .cfi_offset %ebp,-8 .cfi_def_cfa_register %ebp andl $0xfffffff0,%esp # align stack leal 8(%ebp),%eax subl $4,%esp pushl %eax # argv pushl 4(%ebp) # argc pushl %edx # rtld cleanup call _start1 int3 .cfi_endproc .size _start, . - _start .section .note.GNU-stack,"",%progbits Index: head/lib/csu/riscv/Makefile =================================================================== --- head/lib/csu/riscv/Makefile (revision 362588) +++ head/lib/csu/riscv/Makefile (revision 362589) @@ -1,37 +1,38 @@ # $FreeBSD$ .PATH: ${.CURDIR:H}/common SRCS= crti.S crtn.S OBJS= ${SRCS:N*.h:R:S/$/.o/g} OBJS+= Scrt1.o crt1.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} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o +CLEANFILES+= crtbrand.o ignore_init_note.o gcrt1_c.o: crt1_c.c ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c -gcrt1.o: gcrt1_c.o crt1_s.o - ${LD} ${_LDFLAGS} -o gcrt1.o -r crt1_s.o gcrt1_c.o +gcrt1.o: gcrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o + ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC} -crt1.o: crt1_c.o crt1_s.o - ${LD} ${_LDFLAGS} -o crt1.o -r crt1_s.o crt1_c.o +crt1.o: crt1_c.o crt1_s.o crtbrand.o ignore_init_note.o + ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC} Scrt1_c.o: crt1_c.c ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c -Scrt1.o: Scrt1_c.o crt1_s.o - ${LD} ${_LDFLAGS} -o Scrt1.o -r crt1_s.o Scrt1_c.o +Scrt1.o: Scrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o + ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC} .include Index: head/lib/csu/riscv/crt1_s.S =================================================================== --- head/lib/csu/riscv/crt1_s.S (revision 362588) +++ head/lib/csu/riscv/crt1_s.S (revision 362589) @@ -1,56 +1,53 @@ /* LINTLIBRARY */ /*- * Copyright 1996-1998 John D. Polstra. * Copyright (c) 2015-2017 Ruslan Bukin * All rights reserved. * * Portions of this software were 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. * * Portions of this software were developed by the University of Cambridge * Computer Laboratory as part of the CTSRD Project, with support from the * UK Higher Education Innovation Fund (HEIF). * * 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 ``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 "crtbrand.S" -#include "ignore_init_note.S" - ENTRY(_start) mv a3, a2 # cleanup addi a1, a0, 8 # get argv ld a0, 0(a0) # load argc slli t0, a0, 3 # mult by arg size add a2, a1, t0 # env is after argv addi a2, a2, 8 # argv is null terminated .option push .option norelax lla gp, __global_pointer$ .option pop call __start END(_start) .section .note.GNU-stack,"",%progbits