comparison gcc/config/mips/linux.h @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents f6334be47118
children 84e7813d76e9
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 /* Definitions for MIPS running Linux-based GNU systems with ELF format. 1 /* Definitions for MIPS running Linux-based GNU systems with ELF format.
2 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2 Copyright (C) 1998-2017 Free Software Foundation, Inc.
3 2007, 2008, 2010, 2011 Free Software Foundation, Inc.
4 3
5 This file is part of GCC. 4 This file is part of GCC.
6 5
7 GCC is free software; you can redistribute it and/or modify 6 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
16 15
17 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see 17 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */ 18 <http://www.gnu.org/licenses/>. */
20 19
21 #undef WCHAR_TYPE 20 #define GNU_USER_LINK_EMULATION32 "elf32%{EB:b}%{EL:l}tsmip"
22 #define WCHAR_TYPE "int" 21 #define GNU_USER_LINK_EMULATION64 "elf64%{EB:b}%{EL:l}tsmip"
22 #define GNU_USER_LINK_EMULATIONN32 "elf32%{EB:b}%{EL:l}tsmipn32"
23 23
24 #undef WCHAR_TYPE_SIZE 24 #define GLIBC_DYNAMIC_LINKER32 \
25 #define WCHAR_TYPE_SIZE 32 25 "%{mnan=2008:/lib/ld-linux-mipsn8.so.1;:/lib/ld.so.1}"
26 #define GLIBC_DYNAMIC_LINKER64 \
27 "%{mnan=2008:/lib64/ld-linux-mipsn8.so.1;:/lib64/ld.so.1}"
28 #define GLIBC_DYNAMIC_LINKERN32 \
29 "%{mnan=2008:/lib32/ld-linux-mipsn8.so.1;:/lib32/ld.so.1}"
26 30
27 #undef ASM_DECLARE_OBJECT_NAME 31 #undef UCLIBC_DYNAMIC_LINKER32
28 #define ASM_DECLARE_OBJECT_NAME mips_declare_object_name 32 #define UCLIBC_DYNAMIC_LINKER32 \
33 "%{mnan=2008:/lib/ld-uClibc-mipsn8.so.0;:/lib/ld-uClibc.so.0}"
34 #undef UCLIBC_DYNAMIC_LINKER64
35 #define UCLIBC_DYNAMIC_LINKER64 \
36 "%{mnan=2008:/lib/ld64-uClibc-mipsn8.so.0;:/lib/ld64-uClibc.so.0}"
37 #define UCLIBC_DYNAMIC_LINKERN32 \
38 "%{mnan=2008:/lib32/ld-uClibc-mipsn8.so.0;:/lib32/ld-uClibc.so.0}"
29 39
30 #undef TARGET_VERSION 40 #undef MUSL_DYNAMIC_LINKER32
31 #if TARGET_ENDIAN_DEFAULT == 0 41 #define MUSL_DYNAMIC_LINKER32 \
32 #define TARGET_VERSION fprintf (stderr, " (MIPSel GNU/Linux with ELF)"); 42 "/lib/ld-musl-mips%{mips32r6|mips64r6:r6}%{EL:el}%{msoft-float:-sf}.so.1"
33 #else 43 #undef MUSL_DYNAMIC_LINKER64
34 #define TARGET_VERSION fprintf (stderr, " (MIPS GNU/Linux with ELF)"); 44 #define MUSL_DYNAMIC_LINKER64 \
35 #endif 45 "/lib/ld-musl-mips64%{mips64r6:r6}%{EL:el}%{msoft-float:-sf}.so.1"
46 #define MUSL_DYNAMIC_LINKERN32 \
47 "/lib/ld-musl-mipsn32%{mips64r6:r6}%{EL:el}%{msoft-float:-sf}.so.1"
36 48
37 /* If we don't set MASK_ABICALLS, we can't default to PIC. */ 49 #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
38 #undef TARGET_DEFAULT 50 #define GNU_USER_DYNAMIC_LINKERN32 \
39 #define TARGET_DEFAULT MASK_ABICALLS 51 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \
40 52 BIONIC_DYNAMIC_LINKERN32, MUSL_DYNAMIC_LINKERN32)
41 #define TARGET_OS_CPP_BUILTINS() \
42 do { \
43 LINUX_TARGET_OS_CPP_BUILTINS(); \
44 /* The GNU C++ standard library requires this. */ \
45 if (c_dialect_cxx ()) \
46 builtin_define ("_GNU_SOURCE"); \
47 } while (0)
48
49 #undef SUBTARGET_CPP_SPEC
50 #define SUBTARGET_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
51
52 /* A standard GNU/Linux mapping. On most targets, it is included in
53 CC1_SPEC itself by config/linux.h, but mips.h overrides CC1_SPEC
54 and provides this hook instead. */
55 #undef SUBTARGET_CC1_SPEC
56 #define SUBTARGET_CC1_SPEC "%{profile:-p}"
57
58 /* From iris5.h */
59 /* -G is incompatible with -KPIC which is the default, so only allow objects
60 in the small data section if the user explicitly asks for it. */
61 #undef MIPS_DEFAULT_GVALUE
62 #define MIPS_DEFAULT_GVALUE 0
63
64 #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
65
66 /* Borrowed from sparc/linux.h */
67 #undef LINK_SPEC
68 #define LINK_SPEC \
69 "%(endian_spec) \
70 %{shared:-shared} \
71 %{!shared: \
72 %{!static: \
73 %{rdynamic:-export-dynamic} \
74 -dynamic-linker " LINUX_DYNAMIC_LINKER "} \
75 %{static:-static}}"
76
77 #undef SUBTARGET_ASM_SPEC
78 #define SUBTARGET_ASM_SPEC \
79 "%{!mno-abicalls:%{mplt:-call_nonpic;:-KPIC}}"
80
81 /* The MIPS assembler has different syntax for .set. We set it to
82 .dummy to trap any errors. */
83 #undef SET_ASM_OP
84 #define SET_ASM_OP "\t.dummy\t"
85
86 #undef ASM_OUTPUT_DEF
87 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
88 do { \
89 fputc ( '\t', FILE); \
90 assemble_name (FILE, LABEL1); \
91 fputs ( " = ", FILE); \
92 assemble_name (FILE, LABEL2); \
93 fputc ( '\n', FILE); \
94 } while (0)
95
96 /* The glibc _mcount stub will save $v0 for us. Don't mess with saving
97 it, since ASM_OUTPUT_REG_PUSH/ASM_OUTPUT_REG_POP do not work in the
98 presence of $gp-relative calls. */
99 #undef ASM_OUTPUT_REG_PUSH
100 #undef ASM_OUTPUT_REG_POP
101
102 #undef LIB_SPEC
103 #define LIB_SPEC "\
104 %{pthread:-lpthread} \
105 %{shared:-lc} \
106 %{!shared: \
107 %{profile:-lc_p} %{!profile:-lc}}"
108
109 #define MD_UNWIND_SUPPORT "config/mips/linux-unwind.h"
110
111 #ifdef HAVE_AS_NO_SHARED
112 /* Default to -mno-shared for non-PIC. */
113 # define NO_SHARED_SPECS \
114 "%{mshared|mno-shared|fpic|fPIC|fpie|fPIE:;:-mno-shared}"
115 #else
116 # define NO_SHARED_SPECS ""
117 #endif
118
119 /* -march=native handling only makes sense with compiler running on
120 a MIPS chip. */
121 #if defined(__mips__)
122 extern const char *host_detect_local_cpu (int argc, const char **argv);
123 # define EXTRA_SPEC_FUNCTIONS \
124 { "local_cpu_detect", host_detect_local_cpu },
125
126 # define MARCH_MTUNE_NATIVE_SPECS \
127 " %{march=native:%<march=native %:local_cpu_detect(arch)}" \
128 " %{mtune=native:%<mtune=native %:local_cpu_detect(tune)}"
129 #else
130 # define MARCH_MTUNE_NATIVE_SPECS ""
131 #endif
132
133 #define LINUX_DRIVER_SELF_SPECS \
134 NO_SHARED_SPECS \
135 MARCH_MTUNE_NATIVE_SPECS, \
136 /* -mplt has no effect without -mno-shared. Simplify later \
137 specs handling by removing a redundant option. */ \
138 "%{!mno-shared:%<mplt}", \
139 /* -mplt likewise has no effect for -mabi=64 without -msym32. */ \
140 "%{mabi=64:%{!msym32:%<mplt}}"
141
142 #undef DRIVER_SELF_SPECS
143 #define DRIVER_SELF_SPECS \
144 BASE_DRIVER_SELF_SPECS, \
145 LINUX_DRIVER_SELF_SPECS
146
147 /* Similar to standard Linux, but adding -ffast-math support. */
148 #undef ENDFILE_SPEC
149 #define ENDFILE_SPEC \
150 "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
151 %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"