source: patches/gcc-5.2.0-pure64-1.patch@ 07215b1

sysvinit
Last change on this file since 07215b1 was cc49a21, checked in by William Harrington <kb0iic@…>, 9 years ago

Update GCC 5.2.0 from GCC 4.8.0.

  • Property mode set to 100644
File size: 36.7 KB
RevLine 
[cc49a21]1Submitted By: William Harrington <kb0iic at cross-lfs dot org>
2Date: 05-04-2015
3Initial Package Version: 5.1.0
4Origin: Idea originally developed by Ryan Oliver and Greg Schafer for
5 the Pure LFS project with help from
6 Martin Ward
7Upstream Status: Not Applied - CLFS Specific
8Description: This patch makes changes to the paths for pure64, eg 64bit libs
9 in /usr/lib, 32bit in /usr/lib32.
10
11diff -Naur gcc-5.1.0.orig/gcc/config/i386/linux64.h gcc-5.1.0/gcc/config/i386/linux64.h
12--- gcc-5.1.0.orig/gcc/config/i386/linux64.h 2015-01-05 12:33:28.000000000 +0000
13+++ gcc-5.1.0/gcc/config/i386/linux64.h 2015-05-04 23:36:11.543831589 +0000
14@@ -27,6 +27,6 @@
15 #define GNU_USER_LINK_EMULATION64 "elf_x86_64"
16 #define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64"
17
18-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
19-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
20+#define GLIBC_DYNAMIC_LINKER32 "/lib32/ld-linux.so.2"
21+#define GLIBC_DYNAMIC_LINKER64 "/lib/ld-linux-x86-64.so.2"
22 #define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
23diff -Naur gcc-5.1.0.orig/gcc/config/i386/t-linux64 gcc-5.1.0/gcc/config/i386/t-linux64
24--- gcc-5.1.0.orig/gcc/config/i386/t-linux64 2015-01-05 12:33:28.000000000 +0000
25+++ gcc-5.1.0/gcc/config/i386/t-linux64 2015-05-04 23:36:11.543831589 +0000
26@@ -33,6 +33,6 @@
27 comma=,
28 MULTILIB_OPTIONS = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
29 MULTILIB_DIRNAMES = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
30-MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-linux-gnu)
31-MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-linux-gnu)
32+MULTILIB_OSDIRNAMES = m64=../lib$(call if_multiarch,:x86_64-linux-gnu)
33+MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib32)$(call if_multiarch,:i386-linux-gnu)
34 MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32)
35diff -Naur gcc-5.1.0.orig/gcc/config/linux.h gcc-5.1.0/gcc/config/linux.h
36--- gcc-5.1.0.orig/gcc/config/linux.h 2015-01-05 12:33:28.000000000 +0000
37+++ gcc-5.1.0/gcc/config/linux.h 2015-05-04 23:36:11.547164681 +0000
38@@ -74,7 +74,7 @@
39 GLIBC_DYNAMIC_LINKER32 and GLIBC_DYNAMIC_LINKER64 for targets
40 supporting both 32-bit and 64-bit compilation. */
41 #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
42-#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
43+#define UCLIBC_DYNAMIC_LINKER32 "/lib32/ld-uClibc.so.0"
44 #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
45 #define UCLIBC_DYNAMIC_LINKERX32 "/lib/ldx32-uClibc.so.0"
46 #define BIONIC_DYNAMIC_LINKER "/system/bin/linker"
47diff -Naur gcc-5.1.0.orig/gcc/config/mips/t-linux64 gcc-5.1.0/gcc/config/mips/t-linux64
48--- gcc-5.1.0.orig/gcc/config/mips/t-linux64 2015-01-05 12:33:28.000000000 +0000
49+++ gcc-5.1.0/gcc/config/mips/t-linux64 2015-05-04 23:36:38.128588557 +0000
50@@ -22,5 +22,5 @@
51 MIPS_SOFT = $(if $(strip $(filter MASK_SOFT_FLOAT_ABI, $(target_cpu_default)) $(filter soft, $(with_float))),soft)
52 MULTILIB_OSDIRNAMES = \
53 ../lib32$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \
54- ../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
55- ../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
56+ ../lib32$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
57+ ../lib$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
58diff -Naur gcc-5.1.0.orig/gcc/config/rs6000/linux64.h gcc-5.1.0/gcc/config/rs6000/linux64.h
59--- gcc-5.1.0.orig/gcc/config/rs6000/linux64.h 2015-03-09 23:18:57.000000000 +0000
60+++ gcc-5.1.0/gcc/config/rs6000/linux64.h 2015-05-04 23:36:38.128588557 +0000
61@@ -357,13 +357,13 @@
62 #undef LINK_OS_DEFAULT_SPEC
63 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
64
65-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
66+#define GLIBC_DYNAMIC_LINKER32 "/lib32/ld.so.1"
67 #ifdef LINUX64_DEFAULT_ABI_ELFv2
68-#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv1:/lib64/ld64.so.1;:/lib64/ld64.so.2}"
69+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv1:/lib/ld64.so.1;:/lib/ld64.so.2}"
70 #else
71-#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:/lib64/ld64.so.2;:/lib64/ld64.so.1}"
72+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:/lib/ld64.so.2;:/lib/ld64.so.1}"
73 #endif
74-#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
75+#define UCLIBC_DYNAMIC_LINKER32 "/lib32/ld-uClibc.so.0"
76 #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
77 #if DEFAULT_LIBC == LIBC_UCLIBC
78 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
79diff -Naur gcc-5.1.0.orig/gcc/config/rs6000/linux64.h.orig gcc-5.1.0/gcc/config/rs6000/linux64.h.orig
80--- gcc-5.1.0.orig/gcc/config/rs6000/linux64.h.orig 1970-01-01 00:00:00.000000000 +0000
81+++ gcc-5.1.0/gcc/config/rs6000/linux64.h.orig 2015-03-09 23:18:57.000000000 +0000
82@@ -0,0 +1,562 @@
83+/* Definitions of target machine for GNU compiler,
84+ for 64 bit PowerPC linux.
85+ Copyright (C) 2000-2015 Free Software Foundation, Inc.
86+
87+ This file is part of GCC.
88+
89+ GCC is free software; you can redistribute it and/or modify it
90+ under the terms of the GNU General Public License as published
91+ by the Free Software Foundation; either version 3, or (at your
92+ option) any later version.
93+
94+ GCC is distributed in the hope that it will be useful, but WITHOUT
95+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
96+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
97+ License for more details.
98+
99+ Under Section 7 of GPL version 3, you are granted additional
100+ permissions described in the GCC Runtime Library Exception, version
101+ 3.1, as published by the Free Software Foundation.
102+
103+ You should have received a copy of the GNU General Public License and
104+ a copy of the GCC Runtime Library Exception along with this program;
105+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
106+ <http://www.gnu.org/licenses/>. */
107+
108+#ifndef RS6000_BI_ARCH
109+
110+#undef TARGET_64BIT
111+#define TARGET_64BIT 1
112+
113+#define DEFAULT_ARCH64_P 1
114+#define RS6000_BI_ARCH_P 0
115+
116+#else
117+
118+#define DEFAULT_ARCH64_P (TARGET_DEFAULT & MASK_64BIT)
119+#define RS6000_BI_ARCH_P 1
120+
121+#endif
122+
123+#ifdef IN_LIBGCC2
124+#undef TARGET_64BIT
125+#ifdef __powerpc64__
126+#define TARGET_64BIT 1
127+#else
128+#define TARGET_64BIT 0
129+#endif
130+#endif
131+
132+#undef TARGET_AIX
133+#define TARGET_AIX TARGET_64BIT
134+
135+#ifdef HAVE_LD_NO_DOT_SYMS
136+/* New ABI uses a local sym for the function entry point. */
137+extern int dot_symbols;
138+#undef DOT_SYMBOLS
139+#define DOT_SYMBOLS dot_symbols
140+#endif
141+
142+#define TARGET_PROFILE_KERNEL profile_kernel
143+
144+#define TARGET_USES_LINUX64_OPT 1
145+#ifdef HAVE_LD_LARGE_TOC
146+#undef TARGET_CMODEL
147+#define TARGET_CMODEL rs6000_current_cmodel
148+#define SET_CMODEL(opt) rs6000_current_cmodel = opt
149+#else
150+#define SET_CMODEL(opt) do {} while (0)
151+#endif
152+
153+#undef PROCESSOR_DEFAULT
154+#define PROCESSOR_DEFAULT PROCESSOR_POWER7
155+#undef PROCESSOR_DEFAULT64
156+#define PROCESSOR_DEFAULT64 PROCESSOR_POWER8
157+
158+/* We don't need to generate entries in .fixup, except when
159+ -mrelocatable or -mrelocatable-lib is given. */
160+#undef RELOCATABLE_NEEDS_FIXUP
161+#define RELOCATABLE_NEEDS_FIXUP \
162+ (rs6000_isa_flags & rs6000_isa_flags_explicit & OPTION_MASK_RELOCATABLE)
163+
164+#undef RS6000_ABI_NAME
165+#define RS6000_ABI_NAME "linux"
166+
167+#define INVALID_64BIT "-m%s not supported in this configuration"
168+#define INVALID_32BIT INVALID_64BIT
169+
170+#ifdef LINUX64_DEFAULT_ABI_ELFv2
171+#define ELFv2_ABI_CHECK (rs6000_elf_abi != 1)
172+#else
173+#define ELFv2_ABI_CHECK (rs6000_elf_abi == 2)
174+#endif
175+
176+#undef SUBSUBTARGET_OVERRIDE_OPTIONS
177+#define SUBSUBTARGET_OVERRIDE_OPTIONS \
178+ do \
179+ { \
180+ if (!global_options_set.x_rs6000_alignment_flags) \
181+ rs6000_alignment_flags = MASK_ALIGN_NATURAL; \
182+ if (rs6000_isa_flags & OPTION_MASK_64BIT) \
183+ { \
184+ if (DEFAULT_ABI != ABI_AIX) \
185+ { \
186+ rs6000_current_abi = ABI_AIX; \
187+ error (INVALID_64BIT, "call"); \
188+ } \
189+ dot_symbols = !strcmp (rs6000_abi_name, "aixdesc"); \
190+ if (ELFv2_ABI_CHECK) \
191+ { \
192+ rs6000_current_abi = ABI_ELFv2; \
193+ if (dot_symbols) \
194+ error ("-mcall-aixdesc incompatible with -mabi=elfv2"); \
195+ } \
196+ if (rs6000_isa_flags & OPTION_MASK_RELOCATABLE) \
197+ { \
198+ rs6000_isa_flags &= ~OPTION_MASK_RELOCATABLE; \
199+ error (INVALID_64BIT, "relocatable"); \
200+ } \
201+ if (rs6000_isa_flags & OPTION_MASK_EABI) \
202+ { \
203+ rs6000_isa_flags &= ~OPTION_MASK_EABI; \
204+ error (INVALID_64BIT, "eabi"); \
205+ } \
206+ if (TARGET_PROTOTYPE) \
207+ { \
208+ target_prototype = 0; \
209+ error (INVALID_64BIT, "prototype"); \
210+ } \
211+ if ((rs6000_isa_flags & OPTION_MASK_POWERPC64) == 0) \
212+ { \
213+ rs6000_isa_flags |= OPTION_MASK_POWERPC64; \
214+ error ("-m64 requires a PowerPC64 cpu"); \
215+ } \
216+ if ((rs6000_isa_flags_explicit \
217+ & OPTION_MASK_MINIMAL_TOC) != 0) \
218+ { \
219+ if (global_options_set.x_rs6000_current_cmodel \
220+ && rs6000_current_cmodel != CMODEL_SMALL) \
221+ error ("-mcmodel incompatible with other toc options"); \
222+ SET_CMODEL (CMODEL_SMALL); \
223+ } \
224+ else \
225+ { \
226+ if (!global_options_set.x_rs6000_current_cmodel) \
227+ SET_CMODEL (CMODEL_MEDIUM); \
228+ if (rs6000_current_cmodel != CMODEL_SMALL) \
229+ { \
230+ if (!global_options_set.x_TARGET_NO_FP_IN_TOC) \
231+ TARGET_NO_FP_IN_TOC \
232+ = rs6000_current_cmodel == CMODEL_MEDIUM; \
233+ if (!global_options_set.x_TARGET_NO_SUM_IN_TOC) \
234+ TARGET_NO_SUM_IN_TOC = 0; \
235+ } \
236+ } \
237+ } \
238+ else \
239+ { \
240+ if (!RS6000_BI_ARCH_P) \
241+ error (INVALID_32BIT, "32"); \
242+ if (TARGET_PROFILE_KERNEL) \
243+ { \
244+ TARGET_PROFILE_KERNEL = 0; \
245+ error (INVALID_32BIT, "profile-kernel"); \
246+ } \
247+ if (global_options_set.x_rs6000_current_cmodel) \
248+ { \
249+ SET_CMODEL (CMODEL_SMALL); \
250+ error (INVALID_32BIT, "cmodel"); \
251+ } \
252+ } \
253+ } \
254+ while (0)
255+
256+#undef ASM_DEFAULT_SPEC
257+#undef ASM_SPEC
258+#undef LINK_OS_LINUX_SPEC
259+
260+#ifndef RS6000_BI_ARCH
261+#define ASM_DEFAULT_SPEC "-mppc64"
262+#define ASM_SPEC "%(asm_spec64) %(asm_spec_common)"
263+#define LINK_OS_LINUX_SPEC "%(link_os_linux_spec64)"
264+#else
265+#if DEFAULT_ARCH64_P
266+#define ASM_DEFAULT_SPEC "-mppc%{!m32:64}"
267+#define ASM_SPEC "%{m32:%(asm_spec32)}%{!m32:%(asm_spec64)} %(asm_spec_common)"
268+#define LINK_OS_LINUX_SPEC "%{m32:%(link_os_linux_spec32)}%{!m32:%(link_os_linux_spec64)}"
269+#else
270+#define ASM_DEFAULT_SPEC "-mppc%{m64:64}"
271+#define ASM_SPEC "%{!m64:%(asm_spec32)}%{m64:%(asm_spec64)} %(asm_spec_common)"
272+#define LINK_OS_LINUX_SPEC "%{!m64:%(link_os_linux_spec32)}%{m64:%(link_os_linux_spec64)}"
273+#endif
274+#endif
275+
276+#define ASM_SPEC32 "-a32 \
277+%{mrelocatable} %{mrelocatable-lib} %{fpic|fpie|fPIC|fPIE:-K PIC} \
278+%{memb|msdata=eabi: -memb}"
279+
280+#define ASM_SPEC64 "-a64"
281+
282+#define ASM_SPEC_COMMON "%(asm_cpu) \
283+%{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}}" \
284+ ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN)
285+
286+#undef SUBSUBTARGET_EXTRA_SPECS
287+#define SUBSUBTARGET_EXTRA_SPECS \
288+ { "asm_spec_common", ASM_SPEC_COMMON }, \
289+ { "asm_spec32", ASM_SPEC32 }, \
290+ { "asm_spec64", ASM_SPEC64 }, \
291+ { "link_os_linux_spec32", LINK_OS_LINUX_SPEC32 }, \
292+ { "link_os_linux_spec64", LINK_OS_LINUX_SPEC64 },
293+
294+#undef MULTILIB_DEFAULTS
295+#if DEFAULT_ARCH64_P
296+#define MULTILIB_DEFAULTS { "m64" }
297+#else
298+#define MULTILIB_DEFAULTS { "m32" }
299+#endif
300+
301+#ifndef RS6000_BI_ARCH
302+
303+/* 64-bit PowerPC Linux always has a TOC. */
304+#undef TARGET_TOC
305+#define TARGET_TOC 1
306+
307+/* Some things from sysv4.h we don't do when 64 bit. */
308+#undef OPTION_RELOCATABLE
309+#define OPTION_RELOCATABLE 0
310+#undef OPTION_EABI
311+#define OPTION_EABI 0
312+#undef OPTION_PROTOTYPE
313+#define OPTION_PROTOTYPE 0
314+#undef RELOCATABLE_NEEDS_FIXUP
315+#define RELOCATABLE_NEEDS_FIXUP 0
316+
317+#endif
318+
319+/* We use glibc _mcount for profiling. */
320+#define NO_PROFILE_COUNTERS 1
321+#define PROFILE_HOOK(LABEL) \
322+ do { if (TARGET_64BIT) output_profile_hook (LABEL); } while (0)
323+
324+/* PowerPC64 Linux word-aligns FP doubles when -malign-power is given. */
325+#undef ADJUST_FIELD_ALIGN
326+#define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
327+ (rs6000_special_adjust_field_align_p ((FIELD), (COMPUTED)) \
328+ ? 128 \
329+ : (TARGET_64BIT \
330+ && TARGET_ALIGN_NATURAL == 0 \
331+ && TYPE_MODE (strip_array_types (TREE_TYPE (FIELD))) == DFmode) \
332+ ? MIN ((COMPUTED), 32) \
333+ : (COMPUTED))
334+
335+/* PowerPC64 Linux increases natural record alignment to doubleword if
336+ the first field is an FP double, only if in power alignment mode. */
337+#undef ROUND_TYPE_ALIGN
338+#define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \
339+ ((TARGET_64BIT \
340+ && (TREE_CODE (STRUCT) == RECORD_TYPE \
341+ || TREE_CODE (STRUCT) == UNION_TYPE \
342+ || TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \
343+ && TARGET_ALIGN_NATURAL == 0) \
344+ ? rs6000_special_round_type_align (STRUCT, COMPUTED, SPECIFIED) \
345+ : MAX ((COMPUTED), (SPECIFIED)))
346+
347+/* Use the default for compiling target libs. */
348+#ifdef IN_TARGET_LIBS
349+#undef TARGET_ALIGN_NATURAL
350+#define TARGET_ALIGN_NATURAL 1
351+#endif
352+
353+/* Indicate that jump tables go in the text section. */
354+#undef JUMP_TABLES_IN_TEXT_SECTION
355+#define JUMP_TABLES_IN_TEXT_SECTION TARGET_64BIT
356+
357+/* The linux ppc64 ABI isn't explicit on whether aggregates smaller
358+ than a doubleword should be padded upward or downward. You could
359+ reasonably assume that they follow the normal rules for structure
360+ layout treating the parameter area as any other block of memory,
361+ then map the reg param area to registers. i.e. pad upward.
362+ Setting both of the following defines results in this behavior.
363+ Setting just the first one will result in aggregates that fit in a
364+ doubleword being padded downward, and others being padded upward.
365+ Not a bad idea as this results in struct { int x; } being passed
366+ the same way as an int. */
367+#define AGGREGATE_PADDING_FIXED TARGET_64BIT
368+#define AGGREGATES_PAD_UPWARD_ALWAYS 0
369+
370+/* Specify padding for the last element of a block move between
371+ registers and memory. FIRST is nonzero if this is the only
372+ element. */
373+#define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \
374+ (!(FIRST) ? upward : FUNCTION_ARG_PADDING (MODE, TYPE))
375+
376+/* Linux doesn't support saving and restoring 64-bit regs in a 32-bit
377+ process. */
378+#define OS_MISSING_POWERPC64 !TARGET_64BIT
379+
380+#ifdef SINGLE_LIBC
381+#define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
382+#define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
383+#define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
384+#else
385+#define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
386+#define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
387+#define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
388+#endif
389+
390+/* Determine what functions are present at the runtime;
391+ this includes full c99 runtime and sincos. */
392+#undef TARGET_LIBC_HAS_FUNCTION
393+#define TARGET_LIBC_HAS_FUNCTION linux_libc_has_function
394+
395+#undef TARGET_OS_CPP_BUILTINS
396+#define TARGET_OS_CPP_BUILTINS() \
397+ do \
398+ { \
399+ if (TARGET_64BIT) \
400+ { \
401+ builtin_define ("__PPC__"); \
402+ builtin_define ("__PPC64__"); \
403+ builtin_define ("__powerpc__"); \
404+ builtin_define ("__powerpc64__"); \
405+ if (!DOT_SYMBOLS) \
406+ builtin_define ("_CALL_LINUX"); \
407+ builtin_assert ("cpu=powerpc64"); \
408+ builtin_assert ("machine=powerpc64"); \
409+ } \
410+ else \
411+ { \
412+ builtin_define_std ("PPC"); \
413+ builtin_define_std ("powerpc"); \
414+ builtin_assert ("cpu=powerpc"); \
415+ builtin_assert ("machine=powerpc"); \
416+ TARGET_OS_SYSV_CPP_BUILTINS (); \
417+ } \
418+ } \
419+ while (0)
420+
421+#undef CPP_OS_DEFAULT_SPEC
422+#define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)"
423+
424+#undef LINK_SHLIB_SPEC
425+#define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}"
426+
427+#undef LIB_DEFAULT_SPEC
428+#define LIB_DEFAULT_SPEC "%(lib_linux)"
429+
430+#undef STARTFILE_DEFAULT_SPEC
431+#define STARTFILE_DEFAULT_SPEC "%(startfile_linux)"
432+
433+#undef ENDFILE_DEFAULT_SPEC
434+#define ENDFILE_DEFAULT_SPEC "%(endfile_linux)"
435+
436+#undef LINK_START_DEFAULT_SPEC
437+#define LINK_START_DEFAULT_SPEC "%(link_start_linux)"
438+
439+#undef LINK_OS_DEFAULT_SPEC
440+#define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
441+
442+#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
443+#ifdef LINUX64_DEFAULT_ABI_ELFv2
444+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv1:/lib64/ld64.so.1;:/lib64/ld64.so.2}"
445+#else
446+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:/lib64/ld64.so.2;:/lib64/ld64.so.1}"
447+#endif
448+#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
449+#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
450+#if DEFAULT_LIBC == LIBC_UCLIBC
451+#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
452+#elif DEFAULT_LIBC == LIBC_GLIBC
453+#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
454+#else
455+#error "Unsupported DEFAULT_LIBC"
456+#endif
457+#define GNU_USER_DYNAMIC_LINKER32 \
458+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32)
459+#define GNU_USER_DYNAMIC_LINKER64 \
460+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64)
461+
462+#undef DEFAULT_ASM_ENDIAN
463+#if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
464+#define DEFAULT_ASM_ENDIAN " -mlittle"
465+#define LINK_OS_LINUX_EMUL32 ENDIAN_SELECT(" -m elf32ppclinux", \
466+ " -m elf32lppclinux", \
467+ " -m elf32lppclinux")
468+#define LINK_OS_LINUX_EMUL64 ENDIAN_SELECT(" -m elf64ppc", \
469+ " -m elf64lppc", \
470+ " -m elf64lppc")
471+#else
472+#define DEFAULT_ASM_ENDIAN " -mbig"
473+#define LINK_OS_LINUX_EMUL32 ENDIAN_SELECT(" -m elf32ppclinux", \
474+ " -m elf32lppclinux", \
475+ " -m elf32ppclinux")
476+#define LINK_OS_LINUX_EMUL64 ENDIAN_SELECT(" -m elf64ppc", \
477+ " -m elf64lppc", \
478+ " -m elf64ppc")
479+#endif
480+
481+#define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " %{!shared: %{!static: \
482+ %{rdynamic:-export-dynamic} \
483+ -dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}}"
484+
485+#define LINK_OS_LINUX_SPEC64 LINK_OS_LINUX_EMUL64 " %{!shared: %{!static: \
486+ %{rdynamic:-export-dynamic} \
487+ -dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "}}"
488+
489+#undef TOC_SECTION_ASM_OP
490+#define TOC_SECTION_ASM_OP \
491+ (TARGET_64BIT \
492+ ? "\t.section\t\".toc\",\"aw\"" \
493+ : "\t.section\t\".got\",\"aw\"")
494+
495+#undef MINIMAL_TOC_SECTION_ASM_OP
496+#define MINIMAL_TOC_SECTION_ASM_OP \
497+ (TARGET_64BIT \
498+ ? "\t.section\t\".toc1\",\"aw\"" \
499+ : ((TARGET_RELOCATABLE || flag_pic) \
500+ ? "\t.section\t\".got2\",\"aw\"" \
501+ : "\t.section\t\".got1\",\"aw\""))
502+
503+/* Must be at least as big as our pointer type. */
504+#undef SIZE_TYPE
505+#define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int")
506+
507+#undef PTRDIFF_TYPE
508+#define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int")
509+
510+#undef WCHAR_TYPE
511+#define WCHAR_TYPE (TARGET_64BIT ? "int" : "long int")
512+#undef WCHAR_TYPE_SIZE
513+#define WCHAR_TYPE_SIZE 32
514+
515+#undef RS6000_MCOUNT
516+#define RS6000_MCOUNT "_mcount"
517+
518+#ifdef __powerpc64__
519+/* _init and _fini functions are built from bits spread across many
520+ object files, each potentially with a different TOC pointer. For
521+ that reason, place a nop after the call so that the linker can
522+ restore the TOC pointer if a TOC adjusting call stub is needed. */
523+#if DOT_SYMBOLS
524+#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \
525+ asm (SECTION_OP "\n" \
526+" bl ." #FUNC "\n" \
527+" nop\n" \
528+" .previous");
529+#else
530+#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \
531+ asm (SECTION_OP "\n" \
532+" bl " #FUNC "\n" \
533+" nop\n" \
534+" .previous");
535+#endif
536+#endif
537+
538+/* FP save and restore routines. */
539+#undef SAVE_FP_PREFIX
540+#define SAVE_FP_PREFIX (TARGET_64BIT ? "._savef" : "_savefpr_")
541+#undef SAVE_FP_SUFFIX
542+#define SAVE_FP_SUFFIX ""
543+#undef RESTORE_FP_PREFIX
544+#define RESTORE_FP_PREFIX (TARGET_64BIT ? "._restf" : "_restfpr_")
545+#undef RESTORE_FP_SUFFIX
546+#define RESTORE_FP_SUFFIX ""
547+
548+/* Dwarf2 debugging. */
549+#undef PREFERRED_DEBUGGING_TYPE
550+#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
551+
552+/* This is how to declare the size of a function. */
553+#undef ASM_DECLARE_FUNCTION_SIZE
554+#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
555+ do \
556+ { \
557+ if (!flag_inhibit_size_directive) \
558+ { \
559+ fputs ("\t.size\t", (FILE)); \
560+ if (TARGET_64BIT && DOT_SYMBOLS) \
561+ putc ('.', (FILE)); \
562+ assemble_name ((FILE), (FNAME)); \
563+ fputs (",.-", (FILE)); \
564+ rs6000_output_function_entry (FILE, FNAME); \
565+ putc ('\n', (FILE)); \
566+ } \
567+ } \
568+ while (0)
569+
570+/* Return nonzero if this entry is to be written into the constant
571+ pool in a special way. We do so if this is a SYMBOL_REF, LABEL_REF
572+ or a CONST containing one of them. If -mfp-in-toc (the default),
573+ we also do this for floating-point constants. We actually can only
574+ do this if the FP formats of the target and host machines are the
575+ same, but we can't check that since not every file that uses
576+ the macros includes real.h. We also do this when we can write the
577+ entry into the TOC and the entry is not larger than a TOC entry. */
578+
579+#undef ASM_OUTPUT_SPECIAL_POOL_ENTRY_P
580+#define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE) \
581+ (TARGET_TOC \
582+ && (GET_CODE (X) == SYMBOL_REF \
583+ || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \
584+ && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF) \
585+ || GET_CODE (X) == LABEL_REF \
586+ || (GET_CODE (X) == CONST_INT \
587+ && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode)) \
588+ || (GET_CODE (X) == CONST_DOUBLE \
589+ && ((TARGET_64BIT \
590+ && (TARGET_MINIMAL_TOC \
591+ || (SCALAR_FLOAT_MODE_P (GET_MODE (X)) \
592+ && ! TARGET_NO_FP_IN_TOC))) \
593+ || (!TARGET_64BIT \
594+ && !TARGET_NO_FP_IN_TOC \
595+ && !TARGET_RELOCATABLE \
596+ && SCALAR_FLOAT_MODE_P (GET_MODE (X)) \
597+ && BITS_PER_WORD == HOST_BITS_PER_INT)))))
598+
599+/* Select a format to encode pointers in exception handling data. CODE
600+ is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is
601+ true if the symbol may be affected by dynamic relocations. */
602+#undef ASM_PREFERRED_EH_DATA_FORMAT
603+#define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \
604+ ((TARGET_64BIT || flag_pic || TARGET_RELOCATABLE) \
605+ ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel \
606+ | (TARGET_64BIT ? DW_EH_PE_udata8 : DW_EH_PE_sdata4)) \
607+ : DW_EH_PE_absptr)
608+
609+/* For backward compatibility, we must continue to use the AIX
610+ structure return convention. */
611+#undef DRAFT_V4_STRUCT_RET
612+#define DRAFT_V4_STRUCT_RET (!TARGET_64BIT)
613+
614+#ifdef TARGET_LIBC_PROVIDES_SSP
615+/* ppc32 glibc provides __stack_chk_guard in -0x7008(2),
616+ ppc64 glibc provides it at -0x7010(13). */
617+#define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? -0x7010 : -0x7008)
618+#endif
619+
620+#define POWERPC_LINUX
621+
622+/* ppc{32,64} linux has 128-bit long double support in glibc 2.4 and later. */
623+#ifdef TARGET_DEFAULT_LONG_DOUBLE_128
624+#define RS6000_DEFAULT_LONG_DOUBLE_SIZE 128
625+#endif
626+
627+/* Static stack checking is supported by means of probes. */
628+#define STACK_CHECK_STATIC_BUILTIN 1
629+
630+/* The default value isn't sufficient in 64-bit mode. */
631+#define STACK_CHECK_PROTECT (TARGET_64BIT ? 16 * 1024 : 12 * 1024)
632+
633+/* Software floating point support for exceptions and rounding modes
634+ depends on the C library in use. */
635+#undef TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P
636+#define TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P \
637+ rs6000_linux_float_exceptions_rounding_supported_p
638+
639+/* Support for TARGET_ATOMIC_ASSIGN_EXPAND_FENV without FPRs depends
640+ on glibc 2.19 or greater. */
641+#if TARGET_GLIBC_MAJOR > 2 \
642+ || (TARGET_GLIBC_MAJOR == 2 && TARGET_GLIBC_MINOR >= 19)
643+#define RS6000_GLIBC_ATOMIC_FENV 1
644+#endif
645diff -Naur gcc-5.1.0.orig/gcc/config/rs6000/t-linux64 gcc-5.1.0/gcc/config/rs6000/t-linux64
646--- gcc-5.1.0.orig/gcc/config/rs6000/t-linux64 2015-01-05 12:33:28.000000000 +0000
647+++ gcc-5.1.0/gcc/config/rs6000/t-linux64 2015-05-04 23:36:38.128588557 +0000
648@@ -28,8 +28,8 @@
649 MULTILIB_OPTIONS := m64/m32
650 MULTILIB_DIRNAMES := 64 32
651 MULTILIB_EXTRA_OPTS :=
652-MULTILIB_OSDIRNAMES := m64=../lib64$(call if_multiarch,:powerpc64-linux-gnu)
653-MULTILIB_OSDIRNAMES += m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:powerpc-linux-gnu)
654+MULTILIB_OSDIRNAMES := m64=../lib$(call if_multiarch,:powerpc64-linux-gnu)
655+MULTILIB_OSDIRNAMES += m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib32)$(call if_multiarch,:powerpc-linux-gnu)
656
657 rs6000-linux.o: $(srcdir)/config/rs6000/rs6000-linux.c
658 $(COMPILE) $<
659diff -Naur gcc-5.1.0.orig/gcc/config/s390/linux.h gcc-5.1.0/gcc/config/s390/linux.h
660--- gcc-5.1.0.orig/gcc/config/s390/linux.h 2015-01-05 12:33:28.000000000 +0000
661+++ gcc-5.1.0/gcc/config/s390/linux.h 2015-05-04 23:36:38.131921640 +0000
662@@ -60,7 +60,7 @@
663 #define MULTILIB_DEFAULTS { "m31" }
664 #endif
665
666-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
667+#define GLIBC_DYNAMIC_LINKER32 "/lib32/ld.so.1"
668 #define GLIBC_DYNAMIC_LINKER64 "/lib/ld64.so.1"
669
670 #undef LINK_SPEC
671diff -Naur gcc-5.1.0.orig/gcc/config/s390/t-linux64 gcc-5.1.0/gcc/config/s390/t-linux64
672--- gcc-5.1.0.orig/gcc/config/s390/t-linux64 2012-11-21 16:13:28.000000000 +0000
673+++ gcc-5.1.0/gcc/config/s390/t-linux64 2015-05-04 23:36:38.131921640 +0000
674@@ -7,5 +7,5 @@
675
676 MULTILIB_OPTIONS = m64/m31
677 MULTILIB_DIRNAMES = 64 32
678-MULTILIB_OSDIRNAMES = ../lib64$(call if_multiarch,:s390x-linux-gnu)
679-MULTILIB_OSDIRNAMES += $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:s390-linux-gnu)
680+MULTILIB_OSDIRNAMES = ../lib$(call if_multiarch,:s390x-linux-gnu)
681+MULTILIB_OSDIRNAMES += $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib32)$(call if_multiarch,:s390-linux-gnu)
682diff -Naur gcc-5.1.0.orig/gcc/config/sparc/linux.h gcc-5.1.0/gcc/config/sparc/linux.h
683--- gcc-5.1.0.orig/gcc/config/sparc/linux.h 2015-01-05 12:33:28.000000000 +0000
684+++ gcc-5.1.0/gcc/config/sparc/linux.h 2015-05-04 23:36:38.131921640 +0000
685@@ -83,7 +83,7 @@
686 When the -shared link option is used a final link is not being
687 done. */
688
689-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
690+#define GLIBC_DYNAMIC_LINKER "/lib32/ld-linux.so.2"
691
692 #undef LINK_SPEC
693 #define LINK_SPEC "-m elf32_sparc %{shared:-shared} \
694diff -Naur gcc-5.1.0.orig/gcc/config/sparc/linux64.h gcc-5.1.0/gcc/config/sparc/linux64.h
695--- gcc-5.1.0.orig/gcc/config/sparc/linux64.h 2015-01-05 12:33:28.000000000 +0000
696+++ gcc-5.1.0/gcc/config/sparc/linux64.h 2015-05-04 23:36:38.131921640 +0000
697@@ -84,8 +84,8 @@
698 When the -shared link option is used a final link is not being
699 done. */
700
701-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
702-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux.so.2"
703+#define GLIBC_DYNAMIC_LINKER32 "/lib32/ld-linux.so.2"
704+#define GLIBC_DYNAMIC_LINKER64 "/lib/ld-linux.so.2"
705
706 #ifdef SPARC_BI_ARCH
707
708@@ -193,7 +193,7 @@
709 #else /* !SPARC_BI_ARCH */
710
711 #undef LINK_SPEC
712-#define LINK_SPEC "-m elf64_sparc -Y P,%R/usr/lib64 %{shared:-shared} \
713+#define LINK_SPEC "-m elf64_sparc -Y P,%R/lib %{shared:-shared} \
714 %{!shared: \
715 %{!static: \
716 %{rdynamic:-export-dynamic} \
717diff -Naur gcc-5.1.0.orig/gcc/config/sparc/linux64.h.orig gcc-5.1.0/gcc/config/sparc/linux64.h.orig
718--- gcc-5.1.0.orig/gcc/config/sparc/linux64.h.orig 1970-01-01 00:00:00.000000000 +0000
719+++ gcc-5.1.0/gcc/config/sparc/linux64.h.orig 2015-01-05 12:33:28.000000000 +0000
720@@ -0,0 +1,276 @@
721+/* Definitions for 64-bit SPARC running Linux-based GNU systems with ELF.
722+ Copyright (C) 1996-2015 Free Software Foundation, Inc.
723+ Contributed by David S. Miller (davem@caip.rutgers.edu)
724+
725+This file is part of GCC.
726+
727+GCC is free software; you can redistribute it and/or modify
728+it under the terms of the GNU General Public License as published by
729+the Free Software Foundation; either version 3, or (at your option)
730+any later version.
731+
732+GCC is distributed in the hope that it will be useful,
733+but WITHOUT ANY WARRANTY; without even the implied warranty of
734+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
735+GNU General Public License for more details.
736+
737+You should have received a copy of the GNU General Public License
738+along with GCC; see the file COPYING3. If not see
739+<http://www.gnu.org/licenses/>. */
740+
741+#define TARGET_OS_CPP_BUILTINS() \
742+ do \
743+ { \
744+ GNU_USER_TARGET_OS_CPP_BUILTINS(); \
745+ if (TARGET_ARCH64) \
746+ builtin_define ("_LONGLONG"); \
747+ if (TARGET_ARCH32 \
748+ && TARGET_LONG_DOUBLE_128) \
749+ builtin_define ("__LONG_DOUBLE_128__"); \
750+ } \
751+ while (0)
752+
753+/* On Linux, the combination sparc64-* --with-cpu=v8 is supported and
754+ selects a 32-bit compiler. */
755+#if defined(TARGET_64BIT_DEFAULT) && TARGET_CPU_DEFAULT >= TARGET_CPU_v9
756+#undef TARGET_DEFAULT
757+#define TARGET_DEFAULT \
758+ (MASK_V9 + MASK_PTR64 + MASK_64BIT + MASK_STACK_BIAS + \
759+ MASK_APP_REGS + MASK_FPU + MASK_LONG_DOUBLE_128)
760+#endif
761+
762+/* This must be v9a not just v9 because by default we enable
763+ -mvis. */
764+#undef ASM_CPU64_DEFAULT_SPEC
765+#define ASM_CPU64_DEFAULT_SPEC "-Av9a"
766+
767+/* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on
768+ the GNU/Linux magical crtend.o file (see crtstuff.c) which
769+ provides part of the support for getting C++ file-scope static
770+ object constructed before entering `main', followed by a normal
771+ GNU/Linux "finalizer" file, `crtn.o'. */
772+
773+#undef ENDFILE_SPEC
774+#define ENDFILE_SPEC \
775+ "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s\
776+ %{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
777+
778+/* The default code model. */
779+#undef SPARC_DEFAULT_CMODEL
780+#define SPARC_DEFAULT_CMODEL CM_MEDLOW
781+
782+#undef WCHAR_TYPE
783+#define WCHAR_TYPE "int"
784+
785+#undef WCHAR_TYPE_SIZE
786+#define WCHAR_TYPE_SIZE 32
787+
788+/* Define for support of TFmode long double.
789+ SPARC ABI says that long double is 4 words. */
790+#undef LONG_DOUBLE_TYPE_SIZE
791+#define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64)
792+
793+#undef CPP_SUBTARGET_SPEC
794+#define CPP_SUBTARGET_SPEC "\
795+%{posix:-D_POSIX_SOURCE} \
796+%{pthread:-D_REENTRANT} \
797+"
798+
799+/* Provide a LINK_SPEC appropriate for GNU/Linux. Here we provide support
800+ for the special GCC options -static and -shared, which allow us to
801+ link things in one of these three modes by applying the appropriate
802+ combinations of options at link-time.
803+
804+ When the -shared link option is used a final link is not being
805+ done. */
806+
807+#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
808+#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux.so.2"
809+
810+#ifdef SPARC_BI_ARCH
811+
812+#undef SUBTARGET_EXTRA_SPECS
813+#define SUBTARGET_EXTRA_SPECS \
814+ { "link_arch32", LINK_ARCH32_SPEC }, \
815+ { "link_arch64", LINK_ARCH64_SPEC }, \
816+ { "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \
817+ { "link_arch", LINK_ARCH_SPEC },
818+
819+#define LINK_ARCH32_SPEC "-m elf32_sparc %{shared:-shared} \
820+ %{!shared: \
821+ %{!static: \
822+ %{rdynamic:-export-dynamic} \
823+ -dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "} \
824+ %{static:-static}} \
825+"
826+
827+#define LINK_ARCH64_SPEC "-m elf64_sparc %{shared:-shared} \
828+ %{!shared: \
829+ %{!static: \
830+ %{rdynamic:-export-dynamic} \
831+ -dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "} \
832+ %{static:-static}} \
833+"
834+
835+#define LINK_ARCH_SPEC "\
836+%{m32:%(link_arch32)} \
837+%{m64:%(link_arch64)} \
838+%{!m32:%{!m64:%(link_arch_default)}} \
839+"
840+
841+#define LINK_ARCH_DEFAULT_SPEC \
842+(DEFAULT_ARCH32_P ? LINK_ARCH32_SPEC : LINK_ARCH64_SPEC)
843+
844+#undef LINK_SPEC
845+#define LINK_SPEC "\
846+%(link_arch) \
847+%{!mno-relax:%{!r:-relax}} \
848+"
849+
850+/* -mcpu=native handling only makes sense with compiler running on
851+ a SPARC chip. */
852+#if defined(__sparc__) && defined(__linux__)
853+extern const char *host_detect_local_cpu (int argc, const char **argv);
854+# define EXTRA_SPEC_FUNCTIONS \
855+ { "local_cpu_detect", host_detect_local_cpu },
856+
857+# define MCPU_MTUNE_NATIVE_SPECS \
858+ " %{mcpu=native:%<mcpu=native %:local_cpu_detect(cpu)}" \
859+ " %{mtune=native:%<mtune=native %:local_cpu_detect(tune)}"
860+#else
861+# define MCPU_MTUNE_NATIVE_SPECS ""
862+#endif
863+
864+#define DRIVER_SELF_SPECS MCPU_MTUNE_NATIVE_SPECS
865+
866+#undef CC1_SPEC
867+#if DEFAULT_ARCH32_P
868+#define CC1_SPEC "%{profile:-p} \
869+%{m32:%{m64:%emay not use both -m32 and -m64}} \
870+%{m64:-mptr64 -mstack-bias -mlong-double-128 \
871+ %{!mcpu*:-mcpu=ultrasparc} \
872+ %{!mno-vis:%{!mcpu=v9:-mvis}}} \
873+"
874+#else
875+#define CC1_SPEC "%{profile:-p} \
876+%{m32:%{m64:%emay not use both -m32 and -m64}} \
877+%{m32:-mptr32 -mno-stack-bias %{!mlong-double-128:-mlong-double-64} \
878+ %{!mcpu*:-mcpu=cypress}} \
879+%{mv8plus:-mptr32 -mno-stack-bias %{!mlong-double-128:-mlong-double-64} \
880+ %{!mcpu*:-mcpu=v9}} \
881+%{!m32:%{!mcpu*:-mcpu=ultrasparc}} \
882+%{!mno-vis:%{!m32:%{!mcpu=v9:-mvis}}} \
883+"
884+#endif
885+
886+/* Support for a compile-time default CPU, et cetera. The rules are:
887+ --with-cpu is ignored if -mcpu is specified.
888+ --with-tune is ignored if -mtune is specified.
889+ --with-float is ignored if -mhard-float, -msoft-float, -mfpu, or -mno-fpu
890+ are specified.
891+ In the SPARC_BI_ARCH compiler we cannot pass %{!mcpu=*:-mcpu=%(VALUE)}
892+ here, otherwise say -mcpu=v7 would be passed even when -m64.
893+ CC1_SPEC above takes care of this instead. */
894+#undef OPTION_DEFAULT_SPECS
895+#if DEFAULT_ARCH32_P
896+#define OPTION_DEFAULT_SPECS \
897+ {"cpu", "%{!m64:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \
898+ {"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \
899+ {"float", "%{!msoft-float:%{!mhard-float:%{!mfpu:%{!mno-fpu:-m%(VALUE)-float}}}}" }
900+#else
901+#define OPTION_DEFAULT_SPECS \
902+ {"cpu", "%{!m32:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \
903+ {"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \
904+ {"float", "%{!msoft-float:%{!mhard-float:%{!mfpu:%{!mno-fpu:-m%(VALUE)-float}}}}" }
905+#endif
906+
907+#if DEFAULT_ARCH32_P
908+#define MULTILIB_DEFAULTS { "m32" }
909+#else
910+#define MULTILIB_DEFAULTS { "m64" }
911+#endif
912+
913+#else /* !SPARC_BI_ARCH */
914+
915+#undef LINK_SPEC
916+#define LINK_SPEC "-m elf64_sparc -Y P,%R/usr/lib64 %{shared:-shared} \
917+ %{!shared: \
918+ %{!static: \
919+ %{rdynamic:-export-dynamic} \
920+ -dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "} \
921+ %{static:-static}} \
922+%{!mno-relax:%{!r:-relax}} \
923+"
924+
925+#endif /* !SPARC_BI_ARCH */
926+
927+/* It's safe to pass -s always, even if -g is not used. */
928+#undef ASM_SPEC
929+#define ASM_SPEC "\
930+-s \
931+%{fpic|fPIC|fpie|fPIE:-K PIC} \
932+%{!.c:%{findirect-dispatch:-K PIC}} \
933+%(asm_cpu) %(asm_arch) %(asm_relax)"
934+
935+#undef ASM_OUTPUT_ALIGNED_LOCAL
936+#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
937+do { \
938+ fputs ("\t.local\t", (FILE)); \
939+ assemble_name ((FILE), (NAME)); \
940+ putc ('\n', (FILE)); \
941+ ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \
942+} while (0)
943+
944+#undef COMMON_ASM_OP
945+#define COMMON_ASM_OP "\t.common\t"
946+
947+#undef LOCAL_LABEL_PREFIX
948+#define LOCAL_LABEL_PREFIX "."
949+
950+/* DWARF bits. */
951+
952+/* Follow Irix 6 and not the Dwarf2 draft in using 64-bit offsets.
953+ Obviously the Dwarf2 folks haven't tried to actually build systems
954+ with their spec. On a 64-bit system, only 64-bit relocs become
955+ RELATIVE relocations. */
956+
957+/* #define DWARF_OFFSET_SIZE PTR_SIZE */
958+
959+#undef DITF_CONVERSION_LIBFUNCS
960+#define DITF_CONVERSION_LIBFUNCS 1
961+
962
963+#ifdef HAVE_AS_TLS
964+#undef TARGET_SUN_TLS
965+#undef TARGET_GNU_TLS
966+#define TARGET_SUN_TLS 0
967+#define TARGET_GNU_TLS 1
968+#endif
969+
970
971+/* We use GNU ld so undefine this so that attribute((init_priority)) works. */
972+#undef CTORS_SECTION_ASM_OP
973+#undef DTORS_SECTION_ASM_OP
974+
975+/* Static stack checking is supported by means of probes. */
976+#define STACK_CHECK_STATIC_BUILTIN 1
977+
978+/* Linux currently uses RMO in uniprocessor mode, which is equivalent to
979+ TMO, and TMO in multiprocessor mode. But they reserve the right to
980+ change their minds. */
981+#undef SPARC_RELAXED_ORDERING
982+#define SPARC_RELAXED_ORDERING true
983+
984+#undef NEED_INDICATE_EXEC_STACK
985+#define NEED_INDICATE_EXEC_STACK 1
986+
987+#ifdef TARGET_LIBC_PROVIDES_SSP
988+/* sparc glibc provides __stack_chk_guard in [%g7 + 0x14],
989+ sparc64 glibc provides it at [%g7 + 0x28]. */
990+#define TARGET_THREAD_SSP_OFFSET (TARGET_ARCH64 ? 0x28 : 0x14)
991+#endif
992+
993+/* Define if long doubles should be mangled as 'g'. */
994+#define TARGET_ALTERNATE_LONG_DOUBLE_MANGLING
995+
996+/* We use glibc _mcount for profiling. */
997+#undef NO_PROFILE_COUNTERS
998+#define NO_PROFILE_COUNTERS 1
999diff -Naur gcc-5.1.0.orig/gcc/config/sparc/t-linux64 gcc-5.1.0/gcc/config/sparc/t-linux64
1000--- gcc-5.1.0.orig/gcc/config/sparc/t-linux64 2015-01-05 12:33:28.000000000 +0000
1001+++ gcc-5.1.0/gcc/config/sparc/t-linux64 2015-05-04 23:36:38.135254715 +0000
1002@@ -25,5 +25,5 @@
1003
1004 MULTILIB_OPTIONS = m64/m32
1005 MULTILIB_DIRNAMES = 64 32
1006-MULTILIB_OSDIRNAMES = ../lib64$(call if_multiarch,:sparc64-linux-gnu)
1007-MULTILIB_OSDIRNAMES += $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:sparc-linux-gnu)
1008+MULTILIB_OSDIRNAMES = ../lib$(call if_multiarch,:sparc64-linux-gnu)
1009+MULTILIB_OSDIRNAMES += $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib32)$(call if_multiarch,:sparc-linux-gnu)
Note: See TracBrowser for help on using the repository browser.