source: patches/gcc-5.3.0-pure64-1.patch@ 03394ec

sysvinit
Last change on this file since 03394ec was 8633cac, checked in by William Harrington <kb0iic@…>, 9 years ago

GCC 5.3.0 patches renamed.

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