Page MenuHomeFreeBSD

D25211.id73002.diff
No OneTemporary

D25211.id73002.diff

Index: lib/csu/Makefile.inc
===================================================================
--- lib/csu/Makefile.inc
+++ lib/csu/Makefile.inc
@@ -2,8 +2,6 @@
SSP_CFLAGS=
-SED_FIX_NOTE = -i "" -e '/\.note\.tag/s/progbits/note/'
-
NO_WMISSING_VARIABLE_DECLARATIONS=
.include <src.opts.mk>
Index: lib/csu/aarch64/Makefile
===================================================================
--- lib/csu/aarch64/Makefile
+++ lib/csu/aarch64/Makefile
@@ -18,30 +18,11 @@
.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.
+gcrt1.o: crt1.c
+ ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1.c
-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
+Scrt1.o: crt1.c
+ ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1.c
.include <bsd.lib.mk>
Index: lib/csu/amd64/Makefile
===================================================================
--- lib/csu/amd64/Makefile
+++ lib/csu/amd64/Makefile
@@ -18,30 +18,11 @@
.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.
+gcrt1.o: crt1.c
+ ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1.c
-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
+Scrt1.o: crt1.c
+ ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1.c
.include <bsd.lib.mk>
Index: lib/csu/arm/Makefile
===================================================================
--- lib/csu/arm/Makefile
+++ lib/csu/arm/Makefile
@@ -18,30 +18,14 @@
.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.o: crt1.c
+ ${CC} ${CFLAGS} ${STATIC_CFLAGS} -c -o ${.TARGET} ${.CURDIR}/crt1.c
-crt1.s: crt1.c
- ${CC} ${CFLAGS} ${STATIC_CFLAGS} -S -o ${.TARGET} ${.CURDIR}/crt1.c
- sed ${SED_FIX_NOTE} ${.TARGET}
+gcrt1.o: crt1.c
+ ${CC} ${CFLAGS} ${STATIC_CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1.c
-crt1.o: crt1.s
- ${CC} ${CFLAGS:N-g} ${ACFLAGS} -c -o ${.TARGET} crt1.s
-
-gcrt1.s: crt1.c
- ${CC} ${CFLAGS} ${STATIC_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
+Scrt1.o: crt1.c
+ ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1.c
.include <bsd.lib.mk>
Index: lib/csu/common/crtbrand.S
===================================================================
--- lib/csu/common/crtbrand.S
+++ lib/csu/common/crtbrand.S
@@ -25,9 +25,11 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
+#include <machine/asm.h>
__FBSDID("$FreeBSD$");
+#define LOCORE
+
#include <sys/param.h>
#include <sys/elf_common.h>
#include "notes.h"
@@ -36,49 +38,24 @@
* Special ".note" entry specifying the ABI version. See
* http://www.netbsd.org/Documentation/kernel/elf-notes.html
* for more information.
- *
- * For all arches except sparc, gcc emits the section directive for the
- * following struct with a PROGBITS type. However, newer versions of binutils
- * (after 2.16.90) require the section to be of NOTE type, to guarantee that the
- * .note.ABI-tag section correctly ends up in the first page of the final
- * executable.
- *
- * Unfortunately, there is no clean way to tell gcc to use another section type,
- * so this C file (or the C file that includes it) must be compiled in multiple
- * steps:
- *
- * - Compile the .c file to a .s file.
- * - Edit the .s file to change the 'progbits' type to 'note', for the section
- * directive that defines the .note.ABI-tag section.
- * - Compile the .s file to an object file.
- *
- * These steps are done in the invididual Makefiles for each applicable arch.
*/
-static const struct {
- int32_t namesz;
- int32_t descsz;
- int32_t type;
- char name[sizeof(NOTE_FREEBSD_VENDOR)];
- int32_t desc;
-} abitag __attribute__ ((section (NOTE_SECTION), aligned(4))) __used = {
- .namesz = sizeof(NOTE_FREEBSD_VENDOR),
- .descsz = sizeof(int32_t),
- .type = NT_FREEBSD_ABI_TAG,
- .name = NOTE_FREEBSD_VENDOR,
- .desc = __FreeBSD_version
-};
-static const struct {
- int32_t namesz;
- int32_t descsz;
- int32_t type;
- char name[sizeof(NOTE_FREEBSD_VENDOR)];
- uint32_t desc[1];
-} crt_feature_ctl __attribute__ ((section (NOTE_SECTION),
- aligned(4))) __used = {
- .namesz = sizeof(NOTE_FREEBSD_VENDOR),
- .descsz = sizeof(uint32_t),
- .type = NT_FREEBSD_FEATURE_CTL,
- .name = NOTE_FREEBSD_VENDOR,
- .desc = { 0 }
-};
+ .section .note.tag,"a",@note
+ .p2align 2
+ .word 2f-1f
+ .word 4f-3f
+ .word NT_FREEBSD_ABI_TAG
+1: .asciz NOTE_FREEBSD_VENDOR
+2: .p2align 2
+3: .word __FreeBSD_version
+4:
+
+ .section .note.tag,"a",@note
+ .p2align 2
+ .word 2f-1f
+ .word 4f-3f
+ .word NT_FREEBSD_FEATURE_CTL
+1: .asciz NOTE_FREEBSD_VENDOR
+2: .p2align 2
+3: .word 0
+4:
Index: lib/csu/common/ignore_init.c
===================================================================
--- lib/csu/common/ignore_init.c
+++ lib/csu/common/ignore_init.c
@@ -32,8 +32,6 @@
#include <sys/elf.h>
#include <sys/elf_common.h>
-#include "notes.h"
-
extern int main(int, char **, char **);
extern void (*__preinit_array_start[])(int, char **, char **) __hidden;
@@ -140,18 +138,3 @@
}
}
}
-
-static const struct {
- int32_t namesz;
- int32_t descsz;
- int32_t type;
- char name[sizeof(NOTE_FREEBSD_VENDOR)];
- uint32_t desc;
-} crt_noinit_tag __attribute__ ((section (NOTE_SECTION),
- aligned(4))) __used = {
- .namesz = sizeof(NOTE_FREEBSD_VENDOR),
- .descsz = sizeof(uint32_t),
- .type = NT_FREEBSD_NOINIT_TAG,
- .name = NOTE_FREEBSD_VENDOR,
- .desc = 0
-};
Index: lib/csu/common/ignore_init_note.S
===================================================================
--- /dev/null
+++ lib/csu/common/ignore_init_note.S
@@ -0,0 +1,45 @@
+/*-
+ * SPDX-License-Identifier: BSD-1-Clause
+ *
+ * Copyright 2012 Konstantin Belousov <kib@FreeBSD.org>
+ * Copyright (c) 2018 The FreeBSD Foundation
+ *
+ * Parts of this software was developed by Konstantin Belousov
+ * <kib@FreeBSD.org> 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.
+ *
+ * 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$");
+
+#define LOCORE
+
+#include <sys/elf_common.h>
+
+#include "notes.h"
+
+ .section .note.tag,"a",@note
+ .p2align 2
+ .word 2f-1f
+ .word 4f-3f
+ .word NT_FREEBSD_NOINIT_TAG
+1: .asciz NOTE_FREEBSD_VENDOR
+2: .p2align 2
+3: .word 0
+4:
Index: lib/csu/i386/Makefile
===================================================================
--- lib/csu/i386/Makefile
+++ lib/csu/i386/Makefile
@@ -18,38 +18,19 @@
.undef LIBRARIES_ONLY
CLEANFILES= ${OBJS} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o
-CLEANFILES+= crt1_c.s gcrt1_c.s Scrt1_c.s
-# See the comment in lib/csu/common/crtbrand.c for the reason crt1_c.c is not
-# directly compiled to .o files.
-
-gcrt1_c.s: crt1_c.c
- ${CC} ${CFLAGS} -DGCRT -S -o ${.TARGET} ${.CURDIR}/crt1_c.c
- sed ${SED_FIX_NOTE} ${.TARGET}
-
-gcrt1_c.o: gcrt1_c.s
- ${CC} ${CFLAGS:N-g} ${ACFLAGS} -c -o ${.TARGET} gcrt1_c.s
+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
-crt1_c.s: crt1_c.c
- ${CC} ${CFLAGS} -S -o ${.TARGET} ${.CURDIR}/crt1_c.c
- sed ${SED_FIX_NOTE} ${.TARGET}
-
-crt1_c.o: crt1_c.s
- ${CC} ${CFLAGS:N-g} ${ACFLAGS} -c -o ${.TARGET} crt1_c.s
-
crt1.o: crt1_c.o crt1_s.o
${LD} ${_LDFLAGS} -o crt1.o -r crt1_s.o crt1_c.o
${OBJCOPY} --localize-symbol _start1 crt1.o
-Scrt1_c.s: crt1_c.c
- ${CC} ${CFLAGS} -fPIC -DPIC -S -o ${.TARGET} ${.CURDIR}/crt1_c.c
- sed ${SED_FIX_NOTE} ${.TARGET}
-
-Scrt1_c.o: Scrt1_c.s
- ${CC} ${CFLAGS:N-g} ${ACFLAGS} -c -o ${.TARGET} Scrt1_c.s
+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
Index: lib/csu/mips/Makefile
===================================================================
--- lib/csu/mips/Makefile
+++ lib/csu/mips/Makefile
@@ -20,28 +20,10 @@
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.
+gcrt1.o: crt1.c
+ ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1.c
-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
+Scrt1.o: crt1.c
+ ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1.c
.include <bsd.lib.mk>
Index: lib/csu/powerpc/Makefile
===================================================================
--- lib/csu/powerpc/Makefile
+++ lib/csu/powerpc/Makefile
@@ -18,30 +18,11 @@
.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.
+gcrt1.o: crt1.c
+ ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1.c
-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
+Scrt1.o: crt1.c
+ ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1.c
.include <bsd.lib.mk>
Index: lib/csu/powerpc64/Makefile
===================================================================
--- lib/csu/powerpc64/Makefile
+++ lib/csu/powerpc64/Makefile
@@ -18,34 +18,19 @@
.undef LIBRARIES_ONLY
CLEANFILES= ${OBJS}
-CLEANFILES+= crt1.s crtsavres.S gcrt1.s Scrt1.s
+CLEANFILES+= crtsavres.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.c
+ ${CC} ${CFLAGS} -c -o ${.TARGET} ${.CURDIR}/crt1.c
# 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.o: crt1.c
+ ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1.c
-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
+Scrt1.o: crt1.c
+ ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1.c
.include <bsd.lib.mk>
Index: lib/csu/riscv/Makefile
===================================================================
--- lib/csu/riscv/Makefile
+++ lib/csu/riscv/Makefile
@@ -2,9 +2,9 @@
.PATH: ${.CURDIR:H}/common
-SRCS= crt1.c crti.S crtn.S
+SRCS= crti.S crtn.S
OBJS= ${SRCS:N*.h:R:S/$/.o/g}
-OBJS+= Scrt1.o gcrt1.o
+OBJS+= crt1.o Scrt1.o gcrt1.o
CFLAGS+= -I${.CURDIR:H}/common \
-I${SRCTOP}/lib/libc/include
CFLAGS+= -DCRT_IRELOC_SUPPRESS
@@ -17,31 +17,21 @@
# These FILES qualify as libraries for the purpose of LIBRARIES_ONLY.
.undef LIBRARIES_ONLY
-CLEANFILES= ${OBJS}
-CLEANFILES+= crt1.s gcrt1.s Scrt1.s
+CLEANFILES= ${OBJS} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o
-# See the comment in lib/csu/common/crtbrand.c for the reason crt1.c is not
-# directly compiled to .o files.
+gcrt1_c.o: crt1_c.c
+ ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
-crt1.s: crt1.c
- ${CC} ${CFLAGS} -S -o ${.TARGET} ${.CURDIR}/crt1.c
- sed ${SED_FIX_NOTE} ${.TARGET}
+gcrt1.o: gcrt1_c.o crt1_s.o
+ ${LD} ${_LDFLAGS} -o gcrt1.o -r crt1_s.o gcrt1_c.o
-crt1.o: crt1.s
- ${CC} ${CFLAGS:N-g} ${ACFLAGS} -c -o ${.TARGET} crt1.s
+crt1.o: crt1_c.o crt1_s.o
+ ${LD} ${_LDFLAGS} -o crt1.o -r crt1_s.o crt1_c.o
-gcrt1.s: crt1.c
- ${CC} ${CFLAGS} -DGCRT -S -o ${.TARGET} ${.CURDIR}/crt1.c
- sed ${SED_FIX_NOTE} ${.TARGET}
+Scrt1_c.o: crt1_c.c
+ ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
-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
+Scrt1.o: Scrt1_c.o crt1_s.o
+ ${LD} ${_LDFLAGS} -o Scrt1.o -r crt1_s.o Scrt1_c.o
.include <bsd.lib.mk>
Index: lib/csu/riscv/crt1_c.c
===================================================================
--- lib/csu/riscv/crt1_c.c
+++ lib/csu/riscv/crt1_c.c
@@ -39,7 +39,6 @@
#include <stdlib.h>
#include "libc_private.h"
-#include "crtbrand.c"
#include "ignore_init.c"
typedef void (*fptr)(void);
@@ -53,23 +52,6 @@
void __start(int argc, char **argv, char **env, void (*cleanup)(void));
-/* The entry function. */
-__asm(" .text \n"
-" .align 0 \n"
-" .globl _start \n"
-" _start: \n"
-" mv a3, a2 \n" /* cleanup */
-" addi a1, a0, 8 \n" /* get argv */
-" ld a0, 0(a0) \n" /* load argc */
-" slli t0, a0, 3 \n" /* mult by arg size */
-" add a2, a1, t0 \n" /* env is after argv */
-" addi a2, a2, 8 \n" /* argv is null terminated */
-" .option push \n"
-" .option norelax \n"
-" lla gp, __global_pointer$\n"
-" .option pop \n"
-" call __start");
-
void
__start(int argc, char **argv, char **env, void (*cleanup)(void))
{
Index: lib/csu/riscv/crt1_s.S
===================================================================
--- lib/csu/riscv/crt1_s.S
+++ lib/csu/riscv/crt1_s.S
@@ -33,60 +33,24 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
+#include <machine/asm.h>
__FBSDID("$FreeBSD$");
-#include <stdlib.h>
-
-#include "libc_private.h"
-#include "crtbrand.c"
-#include "ignore_init.c"
-
-typedef void (*fptr)(void);
-
-#ifdef GCRT
-extern void _mcleanup(void);
-extern void monstartup(void *, void *);
-extern int eprol;
-extern int etext;
-#endif
-
-void __start(int argc, char **argv, char **env, void (*cleanup)(void));
-
-/* The entry function. */
-__asm(" .text \n"
-" .align 0 \n"
-" .globl _start \n"
-" _start: \n"
-" mv a3, a2 \n" /* cleanup */
-" addi a1, a0, 8 \n" /* get argv */
-" ld a0, 0(a0) \n" /* load argc */
-" slli t0, a0, 3 \n" /* mult by arg size */
-" add a2, a1, t0 \n" /* env is after argv */
-" addi a2, a2, 8 \n" /* argv is null terminated */
-" .option push \n"
-" .option norelax \n"
-" lla gp, __global_pointer$\n"
-" .option pop \n"
-" call __start");
-
-void
-__start(int argc, char **argv, char **env, void (*cleanup)(void))
-{
-
- handle_argv(argc, argv, env);
-
- if (&_DYNAMIC != NULL)
- atexit(cleanup);
- else
- _init_tls();
-
-#ifdef GCRT
- atexit(_mcleanup);
- monstartup(&eprol, &etext);
-__asm__("eprol:");
-#endif
-
- handle_static_init(argc, argv, env);
- exit(main(argc, argv, env));
-}
+#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
Index: sys/sys/elf_common.h
===================================================================
--- sys/sys/elf_common.h
+++ sys/sys/elf_common.h
@@ -46,12 +46,14 @@
* not include the padding.
*/
+#ifndef LOCORE
typedef struct {
u_int32_t n_namesz; /* Length of name. */
u_int32_t n_descsz; /* Length of descriptor. */
u_int32_t n_type; /* Type of this note. */
} Elf_Note;
typedef Elf_Note Elf_Nhdr;
+#endif
/*
* Option kinds.
@@ -112,12 +114,14 @@
* The header for GNU-style hash sections.
*/
+#ifndef LOCORE
typedef struct {
u_int32_t gh_nbuckets; /* Number of hash buckets. */
u_int32_t gh_symndx; /* First visible symbol in .dynsym. */
u_int32_t gh_maskwords; /* #maskwords used in bloom filter. */
u_int32_t gh_shift2; /* Bloom filter shift count. */
} Elf_GNU_Hash_Header;
+#endif
/* Indexes into the e_ident array. Keep synced with
http://www.sco.com/developers/gabi/latest/ch4.eheader.html */
Index: sys/sys/param.h
===================================================================
--- sys/sys/param.h
+++ sys/sys/param.h
@@ -136,9 +136,11 @@
#endif
#ifndef _KERNEL
+#ifndef LOCORE
/* Signals. */
#include <sys/signal.h>
#endif
+#endif
/* Machine type dependent parameters. */
#include <machine/param.h>

File Metadata

Mime Type
text/plain
Expires
Sun, May 24, 2:17 PM (18 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33474103
Default Alt Text
D25211.id73002.diff (19 KB)

Event Timeline