MD_DO_NOT_NEED_FALLTHRU for sh5. Compile tested only.

This commit is contained in:
skrll 2007-03-31 21:12:37 +00:00
parent f44794b224
commit bd529f8818
1 changed files with 8 additions and 42 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: dot_init.h,v 1.5 2005/12/24 21:11:16 perry Exp $ */
/* $NetBSD: dot_init.h,v 1.6 2007/03/31 21:12:37 skrll Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
@ -69,47 +69,11 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
/*
* The SH5 toolchain generates a bogus GOT access in _init() if we use
* the traditional approach as used by other ports.
* Work-around this using a totally gross hack for now.
*/
#define INIT_FALLTHRU_DECL
#define FINI_FALLTHRU_DECL
#define INIT_FALLTHRU() \
__asm volatile(" addi r15, -16, r15 \n"\
" st.q r15, 0, r18 \n"\
" gettr tr0, r18 \n"\
" st.q r15, 8, r18 \n"\
" pt/u init_fallthru, tr0 \n"\
" gettr tr0, r18 \n"\
" ori r18, 1, r18 \n"\
" ptabs/l r18, tr0 \n"\
" blink tr0, r18 \n"\
" ld.q r15, 8, r18 \n"\
" ptabs/u r18, tr0 \n"\
" ld.q r15, 0, r18 \n"\
" addi r15, 16, r15")
#define FINI_FALLTHRU() \
__asm volatile(" addi r15, -16, r15 \n"\
" st.q r15, 0, r18 \n"\
" gettr tr0, r18 \n"\
" st.q r15, 8, r18 \n"\
" pt/u fini_fallthru, tr0 \n"\
" gettr tr0, r18 \n"\
" ori r18, 1, r18 \n"\
" ptabs/l r18, tr0 \n"\
" blink tr0, r18 \n"\
" ld.q r15, 8, r18 \n"\
" ptabs/u r18, tr0 \n"\
" ld.q r15, 0, r18 \n"\
" addi r15, 16, r15")
#define MD_SECTION_PROLOGUE(sect, entry_pt) \
__asm ( \
".section "#sect",\"ax\",@progbits \n"\
".align 5 \n"\
".global "#entry_pt" \n"\
".type "#entry_pt",@function \n"\
#entry_pt": \n"\
" addi r15, -16, r15 \n"\
@ -131,12 +95,14 @@
".previous")
#if __GNUC__ < 3
#define MD_INIT_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.init, _init_fallthru)
#define MD_FINI_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.fini, _fini_fallthru)
#define MD_INIT_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.init, __init)
#define MD_FINI_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.fini, __fini)
#else
#define MD_INIT_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.init, init_fallthru)
#define MD_FINI_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.fini, fini_fallthru)
#define MD_INIT_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.init, _init)
#define MD_FINI_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.fini, _fini)
#endif
#define MD_INIT_SECTION_EPILOGUE MD_SECTION_EPILOGUE(.init)
#define MD_FINI_SECTION_EPILOGUE MD_SECTION_EPILOGUE(.fini)
#define MD_DO_NOT_NEED_FALLTHRU