OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [config/] [sh/] [linux.h] - Blame information for rev 709

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 709 jeremybenn
/* Definitions for SH running Linux-based GNU systems using ELF
2
   Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2010, 2011
3
   Free Software Foundation, Inc.
4
   Contributed by Kazumoto Kojima <kkojima@rr.iij4u.or.jp>
5
 
6
This file is part of GCC.
7
 
8
GCC is free software; you can redistribute it and/or modify
9
it under the terms of the GNU General Public License as published by
10
the Free Software Foundation; either version 3, or (at your option)
11
any later version.
12
 
13
GCC is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
GNU General Public License for more details.
17
 
18
You should have received a copy of the GNU General Public License
19
along with GCC; see the file COPYING3.  If not see
20
<http://www.gnu.org/licenses/>.  */
21
 
22
/* Run-time Target Specification.  */
23
 
24
/* Enable DWARF 2 exceptions.  */
25
#undef DWARF2_UNWIND_INFO
26
#define DWARF2_UNWIND_INFO 1
27
 
28
#undef SUBTARGET_CPP_SPEC
29
#define SUBTARGET_CPP_SPEC "\
30
   %{posix:-D_POSIX_SOURCE} \
31
   %{pthread:-D_REENTRANT -D_PTHREADS} \
32
"
33
 
34
#define TARGET_OS_CPP_BUILTINS() \
35
  do                                            \
36
    {                                           \
37
      GNU_USER_TARGET_OS_CPP_BUILTINS();        \
38
    }                                           \
39
  while (0)
40
 
41
#undef TARGET_DEFAULT
42
#define TARGET_DEFAULT \
43
  (TARGET_CPU_DEFAULT | MASK_USERMODE | TARGET_ENDIAN_DEFAULT \
44
   | TARGET_OPT_DEFAULT | MASK_SOFT_ATOMIC)
45
 
46
#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
47
 
48
#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
49
 
50
#undef SUBTARGET_LINK_EMUL_SUFFIX
51
#define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
52
#undef SUBTARGET_LINK_SPEC
53
#define SUBTARGET_LINK_SPEC \
54
  "%{shared:-shared} \
55
   %{!static: \
56
     %{rdynamic:-export-dynamic} \
57
     -dynamic-linker " GNU_USER_DYNAMIC_LINKER "} \
58
   %{static:-static}"
59
 
60
/* Output assembler code to STREAM to call the profiler.  */
61
 
62
#undef FUNCTION_PROFILER
63
#define FUNCTION_PROFILER(STREAM,LABELNO)                               \
64
  do {                                                                  \
65
    if (TARGET_SHMEDIA)                                                 \
66
      {                                                                 \
67
        fprintf (STREAM, "\tpt\t1f,tr1\n");                             \
68
        fprintf (STREAM, "\taddi.l\tr15,-8,r15\n");                     \
69
        fprintf (STREAM, "\tst.l\tr15,0,r18\n");                 \
70
        if (flag_pic)                                                   \
71
          {                                                             \
72
            const char *gofs = "(datalabel _GLOBAL_OFFSET_TABLE_-(0f-.))"; \
73
            fprintf (STREAM, "\tmovi\t((%s>>16)&0xffff),r21\n", gofs);  \
74
            fprintf (STREAM, "\tshori\t(%s & 0xffff),r21\n", gofs);     \
75
            fprintf (STREAM, "0:\tptrel/u\tr21,tr0\n");                  \
76
            fprintf (STREAM, "\tmovi\t((mcount@GOTPLT)&0xffff),r22\n"); \
77
            fprintf (STREAM, "\tgettr\ttr0,r21\n");                     \
78
            fprintf (STREAM, "\tadd.l\tr21,r22,r21\n");                 \
79
            fprintf (STREAM, "\tld.l\tr21,0,r21\n");                     \
80
            fprintf (STREAM, "\tptabs\tr21,tr0\n");                     \
81
          }                                                             \
82
        else                                                            \
83
          fprintf (STREAM, "\tpt\tmcount,tr0\n");                       \
84
        fprintf (STREAM, "\tgettr\ttr1,r18\n");                         \
85
        fprintf (STREAM, "\tblink\ttr0,r63\n");                         \
86
        fprintf (STREAM, "1:\tld.l\tr15,0,r18\n");                       \
87
        fprintf (STREAM, "\taddi.l\tr15,8,r15\n");                      \
88
      }                                                                 \
89
    else                                                                \
90
      {                                                                 \
91
        if (flag_pic)                                                   \
92
          {                                                             \
93
            fprintf (STREAM, "\tmov.l\t3f,r1\n");                       \
94
            fprintf (STREAM, "\tmova\t3f,r0\n");                        \
95
            fprintf (STREAM, "\tadd\tr1,r0\n");                         \
96
            fprintf (STREAM, "\tmov.l\t1f,r1\n");                       \
97
            fprintf (STREAM, "\tmov.l\t@(r0,r1),r1\n");                 \
98
          }                                                             \
99
        else                                                            \
100
          fprintf (STREAM, "\tmov.l\t1f,r1\n");                         \
101
        fprintf (STREAM, "\tsts.l\tpr,@-r15\n");                        \
102
        fprintf (STREAM, "\tmova\t2f,r0\n");                            \
103
        fprintf (STREAM, "\tjmp\t@r1\n");                               \
104
        fprintf (STREAM, "\tlds\tr0,pr\n");                             \
105
        fprintf (STREAM, "\t.align\t2\n");                              \
106
        if (flag_pic)                                                   \
107
          {                                                             \
108
            fprintf (STREAM, "1:\t.long\tmcount@GOT\n");                \
109
            fprintf (STREAM, "3:\t.long\t_GLOBAL_OFFSET_TABLE_\n");     \
110
          }                                                             \
111
        else                                                            \
112
          fprintf (STREAM, "1:\t.long\tmcount\n");                      \
113
        fprintf (STREAM, "2:\tlds.l\t@r15+,pr\n");                      \
114
      }                                                                 \
115
  } while (0)
116
 
117
/* For SH3 and SH4, we use a slot of the unwind frame which correspond
118
   to a fake register number 16 as a placeholder for the return address
119
   in MD_FALLBACK_FRAME_STATE_FOR and its content will be read with
120
   _Unwind_GetGR which uses dwarf_reg_size_table to get the size of
121
   the register.  So the entry of dwarf_reg_size_table corresponding to
122
   this slot must be set.  To do this, we redefine DBX_REGISTER_NUMBER
123
   so as to return itself for 16.  */
124
#undef DBX_REGISTER_NUMBER
125
#define DBX_REGISTER_NUMBER(REGNO) \
126
  ((! TARGET_SH5 && (REGNO) == 16) ? 16 : SH_DBX_REGISTER_NUMBER (REGNO))
127
 
128
/* Since libgcc is compiled with -fpic for this target, we can't use
129
   __sdivsi3_1 as the division strategy for -O0 and -Os.  */
130
#undef SH_DIV_STRATEGY_DEFAULT
131
#define SH_DIV_STRATEGY_DEFAULT SH_DIV_CALL2
132
#undef SH_DIV_STR_FOR_SIZE
133
#define SH_DIV_STR_FOR_SIZE "call2"
134
 
135
/* Install the __sync libcalls.  */
136
#undef TARGET_INIT_LIBFUNCS
137
#define TARGET_INIT_LIBFUNCS  sh_init_sync_libfuncs

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.