1 /* Definitions for ia64-linux target. */ 2 3 /* This macro is a C statement to print on `stderr' a string describing the 4 particular machine description choice. */ 5 6 #define TARGET_VERSION fprintf (stderr, " (IA-64) Linux"); 7 8 /* This is for -profile to use -lc_p instead of -lc. */ 9 #undef CC1_SPEC 10 #define CC1_SPEC "%{profile:-p} %{G*}" 11 12 /* Target OS builtins. */ 13 #define TARGET_OS_CPP_BUILTINS() \ 14 do { \ 15 builtin_assert("system=linux"); \ 16 builtin_define_std("linux"); \ 17 builtin_define_std("unix"); \ 18 builtin_define("__gnu_linux__"); \ 19 builtin_define("_LONGLONG"); \ 20 } while (0) 21 22 /* Need to override linux.h STARTFILE_SPEC, since it has crtbeginT.o in. */ 23 #undef STARTFILE_SPEC 24 #define STARTFILE_SPEC \ 25 "%{!shared: \ 26 %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \ 27 %{!p:%{profile:gcrt1.o%s} \ 28 %{!profile:crt1.o%s}}}} \ 29 crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}" 30 31 /* Similar to standard Linux, but adding -ffast-math support. */ 32 #undef ENDFILE_SPEC 33 #define ENDFILE_SPEC \ 34 "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ 35 %{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s" 36 37 /* Define this for shared library support because it isn't in the main 38 linux.h file. */ 39 40 #undef LINK_SPEC 41 #define LINK_SPEC "\ 42 %{shared:-shared} \ 43 %{!shared: \ 44 %{!static: \ 45 %{rdynamic:-export-dynamic} \ 46 %{!dynamic-linker:-dynamic-linker /lib/ld-linux-ia64.so.2}} \ 47 %{static:-static}}" 48 49 50 #define JMP_BUF_SIZE 76 51 52 /* Override linux.h LINK_EH_SPEC definition. 53 Signalize that because we have fde-glibc, we don't need all C shared libs 54 linked against -lgcc_s. */ 55 #undef LINK_EH_SPEC 56 #define LINK_EH_SPEC "" 57 58 /* Do code reading to identify a signal frame, and set the frame 59 state data appropriately. See unwind-dw2.c for the structs. */ 60 61 #ifdef IN_LIBGCC2 62 #include <signal.h> 63 #include <sys/ucontext.h> 64 65 #define IA64_GATE_AREA_START 0xa000000000000100LL 66 #define IA64_GATE_AREA_END 0xa000000000030000LL 67 68 #define MD_FALLBACK_FRAME_STATE_FOR(CONTEXT, FS, SUCCESS) \ 69 if ((CONTEXT)->rp >= IA64_GATE_AREA_START \ 70 && (CONTEXT)->rp < IA64_GATE_AREA_END) \ 71 { \ 72 struct sigframe { \ 73 char scratch[16]; \ 74 unsigned long sig_number; \ 75 struct siginfo *info; \ 76 struct sigcontext *sc; \ 77 } *frame_ = (struct sigframe *)(CONTEXT)->psp; \ 78 struct sigcontext *sc_ = frame_->sc; \ 79 \ 80 /* Restore scratch registers in case the unwinder needs to \ 81 refer to a value stored in one of them. */ \ 82 { \ 83 int i_; \ 84 \ 85 for (i_ = 2; i_ < 4; i_++) \ 86 (CONTEXT)->ireg[i_ - 2].loc = &sc_->sc_gr[i_]; \ 87 for (i_ = 8; i_ < 12; i_++) \ 88 (CONTEXT)->ireg[i_ - 2].loc = &sc_->sc_gr[i_]; \ 89 for (i_ = 14; i_ < 32; i_++) \ 90 (CONTEXT)->ireg[i_ - 2].loc = &sc_->sc_gr[i_]; \ 91 } \ 92 \ 93 (CONTEXT)->fpsr_loc = &(sc_->sc_ar_fpsr); \ 94 (CONTEXT)->pfs_loc = &(sc_->sc_ar_pfs); \ 95 (CONTEXT)->lc_loc = &(sc_->sc_ar_lc); \ 96 (CONTEXT)->unat_loc = &(sc_->sc_ar_unat); \ 97 (CONTEXT)->br_loc[0] = &(sc_->sc_br[0]); \ 98 (CONTEXT)->br_loc[6] = &(sc_->sc_br[6]); \ 99 (CONTEXT)->br_loc[7] = &(sc_->sc_br[7]); \ 100 (CONTEXT)->bsp = sc_->sc_ar_bsp; \ 101 (CONTEXT)->pr = sc_->sc_pr; \ 102 (CONTEXT)->psp = sc_->sc_gr[12]; \ 103 (CONTEXT)->gp = sc_->sc_gr[1]; \ 104 /* Signal frame doesn't have an associated reg. stack frame \ 105 other than what we adjust for below. */ \ 106 (FS) -> no_reg_stack_frame = 1; \ 107 \ 108 /* Don't touch the branch registers o.t. b0, b6 and b7. \ 109 The kernel doesn't pass the preserved branch registers \ 110 in the sigcontext but leaves them intact, so there's no \ 111 need to do anything with them here. */ \ 112 { \ 113 unsigned long sof = sc_->sc_cfm & 0x7f; \ 114 (CONTEXT)->bsp = (unsigned long) \ 115 ia64_rse_skip_regs ((unsigned long *)(sc_->sc_ar_bsp), -sof); \ 116 } \ 117 \ 118 (FS)->curr.reg[UNW_REG_RP].where = UNW_WHERE_SPREL; \ 119 (FS)->curr.reg[UNW_REG_RP].val \ 120 = (unsigned long)&(sc_->sc_ip) - (CONTEXT)->psp; \ 121 (FS)->curr.reg[UNW_REG_RP].when = -1; \ 122 \ 123 goto SUCCESS; \ 124 } 125 126 #define MD_HANDLE_UNWABI(CONTEXT, FS) \ 127 if ((FS)->unwabi == ((3 << 8) | 's') \ 128 || (FS)->unwabi == ((0 << 8) | 's')) \ 129 { \ 130 struct sigframe { \ 131 char scratch[16]; \ 132 unsigned long sig_number; \ 133 struct siginfo *info; \ 134 struct sigcontext *sc; \ 135 } *frame_ = (struct sigframe *)(CONTEXT)->psp; \ 136 struct sigcontext *sc_ = frame_->sc; \ 137 \ 138 /* Restore scratch registers in case the unwinder needs to \ 139 refer to a value stored in one of them. */ \ 140 { \ 141 int i_; \ 142 \ 143 for (i_ = 2; i_ < 4; i_++) \ 144 (CONTEXT)->ireg[i_ - 2].loc = &sc_->sc_gr[i_]; \ 145 for (i_ = 8; i_ < 12; i_++) \ 146 (CONTEXT)->ireg[i_ - 2].loc = &sc_->sc_gr[i_]; \ 147 for (i_ = 14; i_ < 32; i_++) \ 148 (CONTEXT)->ireg[i_ - 2].loc = &sc_->sc_gr[i_]; \ 149 } \ 150 \ 151 (CONTEXT)->pfs_loc = &(sc_->sc_ar_pfs); \ 152 (CONTEXT)->lc_loc = &(sc_->sc_ar_lc); \ 153 (CONTEXT)->unat_loc = &(sc_->sc_ar_unat); \ 154 (CONTEXT)->br_loc[0] = &(sc_->sc_br[0]); \ 155 (CONTEXT)->br_loc[6] = &(sc_->sc_br[6]); \ 156 (CONTEXT)->br_loc[7] = &(sc_->sc_br[7]); \ 157 (CONTEXT)->bsp = sc_->sc_ar_bsp; \ 158 (CONTEXT)->pr = sc_->sc_pr; \ 159 (CONTEXT)->gp = sc_->sc_gr[1]; \ 160 /* Signal frame doesn't have an associated reg. stack frame \ 161 other than what we adjust for below. */ \ 162 (FS) -> no_reg_stack_frame = 1; \ 163 \ 164 /* Don't touch the branch registers o.t. b0, b6 and b7. \ 165 The kernel doesn't pass the preserved branch registers \ 166 in the sigcontext but leaves them intact, so there's no \ 167 need to do anything with them here. */ \ 168 { \ 169 unsigned long sof = sc_->sc_cfm & 0x7f; \ 170 (CONTEXT)->bsp = (unsigned long) \ 171 ia64_rse_skip_regs ((unsigned long *)(sc_->sc_ar_bsp), -sof); \ 172 } \ 173 \ 174 /* pfs_loc already set above. Without this pfs_loc would point \ 175 incorrectly to sc_cfm instead of sc_ar_pfs. */ \ 176 (FS)->curr.reg[UNW_REG_PFS].where = UNW_WHERE_NONE; \ 177 } 178 179 #endif /* IN_LIBGCC2 */ 180