gcc/libgcc/config/bfin/crti.S

60 lines
1.8 KiB
ArmAsm
Raw Normal View History

/* Specialized code needed to support construction and destruction of
file-scope objects in C++ and Java code, and to support exception handling.
Copyright (C) 2005-2015 Free Software Foundation, Inc.
Contributed by Analog Devices.
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/>. */
/*
* This file just supplies function prologues for the .init and .fini
* sections. It is linked in before crtbegin.o.
*/
.ident "GNU C crti.o"
.section .init
.globl __init
.type __init,@function
__init:
#if defined __ID_SHARED_LIB__
[--SP] = P5;
bfin.opt (mfdpic): New option. * config/bfin/bfin.opt (mfdpic): New option. * config/bfin/t-bfin-elf (EXTRA_PARTS): Add crtbeginS.o and crtendS.o. (EXTRA_MULTILIB_PARTS): Likewise. (CRTSTUFF_T_CFLAGS, TARGET_LIBGCC2_CFLAGS): Use -fpic. (MULTILIB_OPTIONS, MULTILIB_EXCEPTIONS): Build one extra -mfdpic multilib. * config/bfin/elf.h (STARTFILE_SPEC): Don't link in crt0.o if -shared. (CRT_CALL_STATIC_FUNCTION): New. * config/bfin/uclinux.h (STARTFILE_SPEC): Don't link in crt0.o if -shared. (CRT_CALL_STATIC_FUNCTION): New. * config/bfin/bfin.c (legitimize_pic_address): Now static. Handle FD-PIC moves. (n_pregs_to_save): PIC register doesn't need to be saved with FD-PIC. (print_operand): Handle UNSPEC_MOVE_FDPIC and UNSPEC_FUNCDESC_GOT17M4. (initialize_trampoline): Changed to handle FD-PIC code generation. (expand_move): If TARGET_FDPIC, use emit_pic_move as needed. (bfin_expand_call): Generate FD-PIC calls if TARGET_FDPIC. (override_options): Disallow -mid-shared-library -mfdpic combination. Can't do unaligned ops if FD-PIC. Turn off flag_pic if trying to generate non-id-shared-library non-fdpic code, since it's not supported. (bfin_assemble_integer): New function. (TARGET_ASM_INTEGER): Define. * config/bfin/crti.s (__init, __fini): Save P3 on the stack if __BFIN_FDPIC__. * config/bfin/crtn.s: Restore them. * config/bfin/bfin.h (TARGET_CPU_CPP_BUILTINS): Define __BFIN_FDPIC__ if TARGET_FDPIC. (DRIVER_SELF_SPECS, SUBTARGET_DRIVER_SELF_SPECS, LINK_GCC_C_SEQUENCE_SPEC, ASM_SPEC, LINK_SPEC): New macros. (FDPIC_FPTR_REGNO, FDPIC_REGNO, OUR_FDPIC_REG): New macros. (TRAMPOLINE_SIZE, TRAMPOLINE_TEMPLATE): Adjust for FD-PIC. (CONDITIONAL_REGISTER_USAGE): If TARGET_FDPIC, FDPIC_REGNO is call-used. (enum reg_class, REG_CLASS_CONTENTS, REG_CLASS_NAMES): Add FDPIC_REGS and FDPIC_FPTR_REGS. (REG_CLASS_FROM_LETTER): Use 'Z' and 'Y' for them. * config/bfin/bfin.md (UNSPEC_MOVE_FDPIC, UNSPEC_FUNCDESC_GOT17M4, UNSPEC_VOLATILE_LOAD_FUNCDESC): New constants. (load_funcdescsi): New pattern. (call_symbol_fdpic, sibcall_symbol_fdpic, call_value_symbol_fdpic, sibcall_value_symbol_fdpic, call_insn_fdpic, sibcall_insn_fdpic, call_value_insn_fdpic, sibcall_value_insn_fdpic): New patterns. From-SVN: r114199
2006-05-29 16:11:07 +02:00
#elif defined __BFIN_FDPIC__
[--SP] = P3;
#endif
LINK 12;
#if defined __ID_SHARED_LIB__
P5 = [P5 + _current_shared_library_p5_offset_]
#endif
.section .fini
.globl __fini
.type __fini,@function
__fini:
#if defined __ID_SHARED_LIB__
[--SP] = P5;
bfin.opt (mfdpic): New option. * config/bfin/bfin.opt (mfdpic): New option. * config/bfin/t-bfin-elf (EXTRA_PARTS): Add crtbeginS.o and crtendS.o. (EXTRA_MULTILIB_PARTS): Likewise. (CRTSTUFF_T_CFLAGS, TARGET_LIBGCC2_CFLAGS): Use -fpic. (MULTILIB_OPTIONS, MULTILIB_EXCEPTIONS): Build one extra -mfdpic multilib. * config/bfin/elf.h (STARTFILE_SPEC): Don't link in crt0.o if -shared. (CRT_CALL_STATIC_FUNCTION): New. * config/bfin/uclinux.h (STARTFILE_SPEC): Don't link in crt0.o if -shared. (CRT_CALL_STATIC_FUNCTION): New. * config/bfin/bfin.c (legitimize_pic_address): Now static. Handle FD-PIC moves. (n_pregs_to_save): PIC register doesn't need to be saved with FD-PIC. (print_operand): Handle UNSPEC_MOVE_FDPIC and UNSPEC_FUNCDESC_GOT17M4. (initialize_trampoline): Changed to handle FD-PIC code generation. (expand_move): If TARGET_FDPIC, use emit_pic_move as needed. (bfin_expand_call): Generate FD-PIC calls if TARGET_FDPIC. (override_options): Disallow -mid-shared-library -mfdpic combination. Can't do unaligned ops if FD-PIC. Turn off flag_pic if trying to generate non-id-shared-library non-fdpic code, since it's not supported. (bfin_assemble_integer): New function. (TARGET_ASM_INTEGER): Define. * config/bfin/crti.s (__init, __fini): Save P3 on the stack if __BFIN_FDPIC__. * config/bfin/crtn.s: Restore them. * config/bfin/bfin.h (TARGET_CPU_CPP_BUILTINS): Define __BFIN_FDPIC__ if TARGET_FDPIC. (DRIVER_SELF_SPECS, SUBTARGET_DRIVER_SELF_SPECS, LINK_GCC_C_SEQUENCE_SPEC, ASM_SPEC, LINK_SPEC): New macros. (FDPIC_FPTR_REGNO, FDPIC_REGNO, OUR_FDPIC_REG): New macros. (TRAMPOLINE_SIZE, TRAMPOLINE_TEMPLATE): Adjust for FD-PIC. (CONDITIONAL_REGISTER_USAGE): If TARGET_FDPIC, FDPIC_REGNO is call-used. (enum reg_class, REG_CLASS_CONTENTS, REG_CLASS_NAMES): Add FDPIC_REGS and FDPIC_FPTR_REGS. (REG_CLASS_FROM_LETTER): Use 'Z' and 'Y' for them. * config/bfin/bfin.md (UNSPEC_MOVE_FDPIC, UNSPEC_FUNCDESC_GOT17M4, UNSPEC_VOLATILE_LOAD_FUNCDESC): New constants. (load_funcdescsi): New pattern. (call_symbol_fdpic, sibcall_symbol_fdpic, call_value_symbol_fdpic, sibcall_value_symbol_fdpic, call_insn_fdpic, sibcall_insn_fdpic, call_value_insn_fdpic, sibcall_value_insn_fdpic): New patterns. From-SVN: r114199
2006-05-29 16:11:07 +02:00
#elif defined __BFIN_FDPIC__
[--SP] = P3;
#endif
LINK 12;
#if defined __ID_SHARED_LIB__
P5 = [P5 + _current_shared_library_p5_offset_]
#endif