Browse Source

Don't use crti.S/crtn.S

They are unnecessary because we use .init_array/.fini_array exclusively.
pull/6/head
Andrew Waterman 12 years ago
parent
commit
6c7ff4f040
  1. 4
      gcc/gcc/config/riscv/elf.h
  2. 43
      gcc/libgcc/config/riscv/crti.S
  3. 39
      gcc/libgcc/config/riscv/crtn.S
  4. 8
      gcc/libgcc/config/riscv/t-elf

4
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

43
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
<http://www.gnu.org/licenses/>. */
#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. */

39
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
<http://www.gnu.org/licenses/>. */
#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. */

8
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

Loading…
Cancel
Save