xref: /openbsd-src/gnu/usr.bin/gcc/gcc/config/alpha/linux.h (revision c87b03e512fc05ed6e0222f6fb0ae86264b1d05b)
1 /* Definitions of target machine for GNU compiler,
2    for Alpha Linux-based GNU systems.
3    Copyright (C) 1996, 1997, 1998, 2002 Free Software Foundation, Inc.
4    Contributed by Richard Henderson.
5 
6 This file is part of GNU CC.
7 
8 GNU CC 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 2, or (at your option)
11 any later version.
12 
13 GNU CC 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 GNU CC; see the file COPYING.  If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA.  */
22 
23 #undef TARGET_DEFAULT
24 #define TARGET_DEFAULT (MASK_FP | MASK_FPREGS | MASK_GAS)
25 
26 #define TARGET_OS_CPP_BUILTINS()				\
27     do {							\
28 	builtin_define ("__gnu_linux__");			\
29 	builtin_define ("_LONGLONG");				\
30 	builtin_define_std ("linux");				\
31 	builtin_define_std ("unix");				\
32 	builtin_assert ("system=linux");			\
33 	/* The GNU C++ standard library requires this.  */	\
34 	if (c_language == clk_cplusplus)			\
35 	  builtin_define ("_GNU_SOURCE");			\
36     } while (0)
37 
38 #undef LIB_SPEC
39 #define LIB_SPEC \
40   "%{pthread:-lpthread} \
41    %{shared:-lc} \
42    %{!shared: %{profile:-lc_p}%{!profile:-lc}}"
43 
44 /* Show that we need a GP when profiling.  */
45 #undef TARGET_PROFILING_NEEDS_GP
46 #define TARGET_PROFILING_NEEDS_GP 1
47 
48 /* Don't care about faults in the prologue.  */
49 #undef TARGET_CAN_FAULT_IN_PROLOGUE
50 #define TARGET_CAN_FAULT_IN_PROLOGUE 1
51 
52 /* OS fixes up EV5 data fault on prefetch.  */
53 #undef TARGET_FIXUP_EV5_PREFETCH
54 #define TARGET_FIXUP_EV5_PREFETCH 1
55 
56 #undef WCHAR_TYPE
57 #define WCHAR_TYPE "int"
58 
59 /* Define this so that all GNU/Linux targets handle the same pragmas.  */
60 #define HANDLE_PRAGMA_PACK_PUSH_POP
61 
62 #define TARGET_HAS_F_SETLKW
63 
64 #define LINK_GCC_C_SEQUENCE_SPEC \
65   "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
66 
67 /* Do code reading to identify a signal frame, and set the frame
68    state data appropriately.  See unwind-dw2.c for the structs.  */
69 
70 #ifdef IN_LIBGCC2
71 #include <signal.h>
72 #include <sys/ucontext.h>
73 #endif
74 
75 #define MD_FALLBACK_FRAME_STATE_FOR(CONTEXT, FS, SUCCESS)		\
76   do {									\
77     unsigned int *pc_ = (CONTEXT)->ra;					\
78     struct sigcontext *sc_;						\
79     long new_cfa_, i_;							\
80 									\
81     if (pc_[0] != 0x47fe0410		/* mov $30,$16 */		\
82         || pc_[2] != 0x00000083		/* callsys */)			\
83       break;								\
84     if ((CONTEXT)->cfa == 0)						\
85       break;								\
86     if (pc_[1] == 0x201f0067)		/* lda $0,NR_sigreturn */	\
87       sc_ = (CONTEXT)->cfa;						\
88     else if (pc_[1] == 0x201f015f)	/* lda $0,NR_rt_sigreturn */	\
89       {									\
90 	struct rt_sigframe {						\
91 	  struct siginfo info;						\
92 	  struct ucontext uc;						\
93 	} *rt_ = (CONTEXT)->cfa;					\
94 	sc_ = &rt_->uc.uc_mcontext;					\
95       }									\
96     else								\
97       break;								\
98     new_cfa_ = sc_->sc_regs[30];					\
99     (FS)->cfa_how = CFA_REG_OFFSET;					\
100     (FS)->cfa_reg = 30;							\
101     (FS)->cfa_offset = new_cfa_ - (long) (CONTEXT)->cfa;		\
102     for (i_ = 0; i_ < 30; ++i_)						\
103       {									\
104 	(FS)->regs.reg[i_].how = REG_SAVED_OFFSET;			\
105 	(FS)->regs.reg[i_].loc.offset					\
106 	  = (long)&sc_->sc_regs[i_] - new_cfa_;				\
107       }									\
108     for (i_ = 0; i_ < 31; ++i_)						\
109       {									\
110 	(FS)->regs.reg[i_+32].how = REG_SAVED_OFFSET;			\
111 	(FS)->regs.reg[i_+32].loc.offset				\
112 	  = (long)&sc_->sc_fpregs[i_] - new_cfa_;			\
113       }									\
114     (FS)->regs.reg[64].how = REG_SAVED_OFFSET;				\
115     (FS)->regs.reg[64].loc.offset = (long)&sc_->sc_pc - new_cfa_;	\
116     (FS)->retaddr_column = 64;						\
117     goto SUCCESS;							\
118   } while (0)
119