diff --git a/gcc/gcc/config/riscv/elf.h b/gcc/gcc/config/riscv/elf.h index 2dc837be..204288e7 100644 --- a/gcc/gcc/config/riscv/elf.h +++ b/gcc/gcc/config/riscv/elf.h @@ -23,9 +23,9 @@ along with GCC; see the file COPYING3. If not see #define LIB_SPEC "" #undef STARTFILE_SPEC -#define STARTFILE_SPEC "crti%O%s crtbegin%O%s" +#define STARTFILE_SPEC "crt0%O%s crtbegin%O%s" #undef ENDFILE_SPEC -#define ENDFILE_SPEC "crtend%O%s crtn%O%s" +#define ENDFILE_SPEC "crtend%O%s" #define NO_IMPLICIT_EXTERN_C 1 diff --git a/gcc/libgcc/config/riscv/crti.S b/gcc/libgcc/config/riscv/crti.S index ce9b3938..89bac706 100644 --- a/gcc/libgcc/config/riscv/crti.S +++ b/gcc/libgcc/config/riscv/crti.S @@ -1,42 +1 @@ -/* Copyright (C) 2001, 2002 Free Software Foundation, Inc. - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free -Software Foundation; either version 3, or (at your option) any later -version. - -GCC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -Under Section 7 of GPL version 3, you are granted additional -permissions described in the GCC Runtime Library Exception, version -3.1, as published by the Free Software Foundation. - -You should have received a copy of the GNU General Public License and -a copy of the GCC Runtime Library Exception along with this program; -see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -. */ - -#ifdef __riscv64 -# define SR sd -#else -# define SR sw -#endif - - .section .init,"ax",@progbits - .globl _init - .type _init,@function -_init: - add sp, sp, -8 - SR ra, 0(sp) - - .section .fini,"ax",@progbits - .globl _fini - .type _fini,@function -_fini: - add sp, sp, -8 - SR ra, 0(sp) +/* crti.S is empty because .init_array/.fini_array are used exclusively. */ diff --git a/gcc/libgcc/config/riscv/crtn.S b/gcc/libgcc/config/riscv/crtn.S index 2b82d24a..ca6ee7b6 100644 --- a/gcc/libgcc/config/riscv/crtn.S +++ b/gcc/libgcc/config/riscv/crtn.S @@ -1,38 +1 @@ -/* Copyright (C) 2001, 2002 Free Software Foundation, Inc. - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free -Software Foundation; either version 3, or (at your option) any later -version. - -GCC is distributed in the hope that it will be useful, but WITHOUT ANY -WARraNTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -Under Section 7 of GPL version 3, you are granted additional -permissions described in the GCC Runtime Library Exception, version -3.1, as published by the Free Software Foundation. - -You should have received a copy of the GNU General Public License and -a copy of the GCC Runtime Library Exception along with this program; -see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -. */ - -#ifdef __riscv64 -# define LR ld -#else -# define LR lw -#endif - - .section .init,"ax",@progbits - LR ra, 0(sp) - addi sp, sp, 8 - ret - - .section .fini,"ax",@progbits - LR ra, 0(sp) - addi sp, sp, 8 - ret +/* crtn.S is empty because .init_array/.fini_array are used exclusively. */ diff --git a/gcc/libgcc/config/riscv/t-elf b/gcc/libgcc/config/riscv/t-elf index 37d2bcae..6e93f065 100644 --- a/gcc/libgcc/config/riscv/t-elf +++ b/gcc/libgcc/config/riscv/t-elf @@ -1,10 +1,2 @@ # Assemble startup files. -$(T)crti.o: $(srcdir)/config/riscv/crti.asm $(GCC_PASSES) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \ - -c -o $(T)crti.o -x assembler-with-cpp $(srcdir)/config/riscv/crti.asm - -$(T)crtn.o: $(srcdir)/config/riscv/crtn.asm $(GCC_PASSES) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \ - -c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/riscv/crtn.asm - LIB2ADD += $(srcdir)/config/riscv/riscv-fp.c