Deleted Added
full compact
linux64.h (90075) linux64.h (96263)
1/* Definitions for AMD x86-64 running Linux-based GNU systems with ELF format.
1/* Definitions for AMD x86-64 running Linux-based GNU systems with ELF format.
2 Copyright (C) 2001 Free Software Foundation, Inc.
2 Copyright (C) 2001, 2002 Free Software Foundation, Inc.
3 Contributed by Jan Hubicka <jh@suse.cz>, based on linux.h.
4
5This file is part of GNU CC.
6
7GNU CC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.

--- 9 unchanged lines hidden (view full) ---

20Boston, MA 02111-1307, USA. */
21
22#define LINUX_DEFAULT_ELF
23
24#undef TARGET_VERSION
25#define TARGET_VERSION fprintf (stderr, " (x86-64 Linux/ELF)");
26
27#undef CPP_PREDEFINES
3 Contributed by Jan Hubicka <jh@suse.cz>, based on linux.h.
4
5This file is part of GNU CC.
6
7GNU CC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.

--- 9 unchanged lines hidden (view full) ---

20Boston, MA 02111-1307, USA. */
21
22#define LINUX_DEFAULT_ELF
23
24#undef TARGET_VERSION
25#define TARGET_VERSION fprintf (stderr, " (x86-64 Linux/ELF)");
26
27#undef CPP_PREDEFINES
28#define CPP_PREDEFINES "-D__ELF__ -Dunix -Dlinux -Asystem(posix)"
28#define CPP_PREDEFINES "-D__ELF__ -Dunix -D__gnu_linux__ -Dlinux -Asystem(posix)"
29
30#undef CPP_SPEC
31#define CPP_SPEC "%(cpp_cpu) %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT} %{!m32:-D__LONG_MAX__=9223372036854775807L}"
32
33/* Provide a LINK_SPEC. Here we provide support for the special GCC
34 options -static and -shared, which allow us to link things in one
35 of these three modes by applying the appropriate combinations of
36 options at link-time.
37
38 When the -shared link option is used a final link is not being
39 done. */
40
41#undef LINK_SPEC
29
30#undef CPP_SPEC
31#define CPP_SPEC "%(cpp_cpu) %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT} %{!m32:-D__LONG_MAX__=9223372036854775807L}"
32
33/* Provide a LINK_SPEC. Here we provide support for the special GCC
34 options -static and -shared, which allow us to link things in one
35 of these three modes by applying the appropriate combinations of
36 options at link-time.
37
38 When the -shared link option is used a final link is not being
39 done. */
40
41#undef LINK_SPEC
42#define LINK_SPEC "%{!m32:-m elf_x86_64} %{m32:-m elf_i386} %{shared:-shared} \
42#define LINK_SPEC "%{!m32:-m elf_x86_64 -Y P,/usr/lib64} %{m32:-m elf_i386} \
43 %{shared:-shared} \
43 %{!shared: \
44 %{!static: \
45 %{rdynamic:-export-dynamic} \
44 %{!shared: \
45 %{!static: \
46 %{rdynamic:-export-dynamic} \
46 %{!dynamic-linker:-dynamic-linker /lib64/ld-linux-x86-64.so.2}} \
47 %{static:-static}}"
47 %{m32:%{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
48 %{!m32:%{!dynamic-linker:-dynamic-linker /lib64/ld-linux-x86-64.so.2}}} \
49 %{static:-static}}"
48
50
51#undef STARTFILE_SPEC
52#define STARTFILE_SPEC \
53 "%{m32:%{!shared: \
54 %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \
55 %{!p:%{profile:gcrt1.o%s} %{!profile:crt1.o%s}}}} \
56 crti.o%s %{static:crtbeginT.o%s}\
57 %{!static:%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}}} \
58 %{!m32:%{!shared: \
59 %{pg:/usr/lib64/gcrt1.o%s} %{!pg:%{p:/usr/lib64/gcrt1.o%s} \
60 %{!p:%{profile:/usr/lib64/gcrt1.o%s} %{!profile:/usr/lib64/crt1.o%s}}}}\
61 /usr/lib64/crti.o%s %{static:crtbeginT.o%s} \
62 %{!static:%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}}}"
63
64#undef ENDFILE_SPEC
65#define ENDFILE_SPEC "\
66 %{m32:%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s} \
67 %{!m32:%{!shared:crtend.o%s} %{shared:crtendS.o%s} /usr/lib64/crtn.o%s}"
68
69#define MULTILIB_DEFAULTS { "m64" }
70
71/* Do code reading to identify a signal frame, and set the frame
72 state data appropriately. See unwind-dw2.c for the structs. */
73
74#ifdef IN_LIBGCC2
75#include <signal.h>
76#include <sys/ucontext.h>
77#endif
78
79#define MD_FALLBACK_FRAME_STATE_FOR(CONTEXT, FS, SUCCESS) \
80 do { \
81 unsigned char *pc_ = (CONTEXT)->ra; \
82 struct sigcontext *sc_; \
83 long new_cfa_; \
84 \
85 /* movq __NR_rt_sigreturn, %rax ; syscall */ \
86 if (*(unsigned char *)(pc_+0) == 0x48 \
87 && *(unsigned long *)(pc_+1) == 0x050f0000000fc0c7) \
88 { \
89 struct ucontext *uc_ = (CONTEXT)->cfa; \
90 sc_ = (struct sigcontext *) &uc_->uc_mcontext; \
91 } \
92 else \
93 break; \
94 \
95 new_cfa_ = sc_->rsp; \
96 (FS)->cfa_how = CFA_REG_OFFSET; \
97 /* Register 7 is rsp */ \
98 (FS)->cfa_reg = 7; \
99 (FS)->cfa_offset = new_cfa_ - (long) (CONTEXT)->cfa; \
100 \
101 /* The SVR4 register numbering macros aren't usable in libgcc. */ \
102 (FS)->regs.reg[0].how = REG_SAVED_OFFSET; \
103 (FS)->regs.reg[0].loc.offset = (long)&sc_->rax - new_cfa_; \
104 (FS)->regs.reg[1].how = REG_SAVED_OFFSET; \
105 (FS)->regs.reg[1].loc.offset = (long)&sc_->rbx - new_cfa_; \
106 (FS)->regs.reg[2].how = REG_SAVED_OFFSET; \
107 (FS)->regs.reg[2].loc.offset = (long)&sc_->rcx - new_cfa_; \
108 (FS)->regs.reg[3].how = REG_SAVED_OFFSET; \
109 (FS)->regs.reg[3].loc.offset = (long)&sc_->rdx - new_cfa_; \
110 (FS)->regs.reg[4].how = REG_SAVED_OFFSET; \
111 (FS)->regs.reg[4].loc.offset = (long)&sc_->rbp - new_cfa_; \
112 (FS)->regs.reg[5].how = REG_SAVED_OFFSET; \
113 (FS)->regs.reg[5].loc.offset = (long)&sc_->rsi - new_cfa_; \
114 (FS)->regs.reg[6].how = REG_SAVED_OFFSET; \
115 (FS)->regs.reg[6].loc.offset = (long)&sc_->rdi - new_cfa_; \
116 (FS)->regs.reg[8].how = REG_SAVED_OFFSET; \
117 (FS)->regs.reg[8].loc.offset = (long)&sc_->r8 - new_cfa_; \
118 (FS)->regs.reg[9].how = REG_SAVED_OFFSET; \
119 (FS)->regs.reg[9].loc.offset = (long)&sc_->r9 - new_cfa_; \
120 (FS)->regs.reg[10].how = REG_SAVED_OFFSET; \
121 (FS)->regs.reg[10].loc.offset = (long)&sc_->r10 - new_cfa_; \
122 (FS)->regs.reg[11].how = REG_SAVED_OFFSET; \
123 (FS)->regs.reg[11].loc.offset = (long)&sc_->r11 - new_cfa_; \
124 (FS)->regs.reg[12].how = REG_SAVED_OFFSET; \
125 (FS)->regs.reg[12].loc.offset = (long)&sc_->r12 - new_cfa_; \
126 (FS)->regs.reg[13].how = REG_SAVED_OFFSET; \
127 (FS)->regs.reg[13].loc.offset = (long)&sc_->r13 - new_cfa_; \
128 (FS)->regs.reg[14].how = REG_SAVED_OFFSET; \
129 (FS)->regs.reg[14].loc.offset = (long)&sc_->r14 - new_cfa_; \
130 (FS)->regs.reg[15].how = REG_SAVED_OFFSET; \
131 (FS)->regs.reg[15].loc.offset = (long)&sc_->r15 - new_cfa_; \
132 (FS)->retaddr_column = 16; \
133 goto SUCCESS; \
134 } while (0)