Add i386 support for the amd64 ld.
[dragonfly.git] / gnu / usr.bin / cc41 / cc_prep / patches / gcc.c.patch
CommitLineData
ea87ee73 1$DragonFly: src/gnu/usr.bin/cc41/cc_prep/patches/gcc.c.patch,v 1.2 2007/08/23 06:19:20 corecode Exp $
ddf7cc86 2
ea87ee73
SS
3--- gcc.c.orig 2007-02-17 03:26:15 +0100
4+++ gcc.c 2007-08-22 11:56:58 +0200
5@@ -733,6 +733,7 @@
ddf7cc86
SS
6 static const char *asm_spec = ASM_SPEC;
7 static const char *asm_final_spec = ASM_FINAL_SPEC;
8 static const char *link_spec = LINK_SPEC;
9+static const char *pre_lib_spec = PRE_LIB_SPEC;
10 static const char *lib_spec = LIB_SPEC;
11 static const char *mfwrap_spec = MFWRAP_SPEC;
12 static const char *mflib_spec = MFLIB_SPEC;
ea87ee73
SS
13@@ -1441,30 +1442,10 @@
14 #define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/"
15 #endif
16
17-#ifdef CROSS_COMPILE /* Don't use these prefixes for a cross compiler. */
18-#undef MD_EXEC_PREFIX
19-#undef MD_STARTFILE_PREFIX
20-#undef MD_STARTFILE_PREFIX_1
21-#endif
22-
23-/* If no prefixes defined, use the null string, which will disable them. */
24-#ifndef MD_EXEC_PREFIX
25-#define MD_EXEC_PREFIX ""
26-#endif
27-#ifndef MD_STARTFILE_PREFIX
28-#define MD_STARTFILE_PREFIX ""
29-#endif
30-#ifndef MD_STARTFILE_PREFIX_1
31-#define MD_STARTFILE_PREFIX_1 ""
32-#endif
33-
34 static const char *const standard_exec_prefix = STANDARD_EXEC_PREFIX;
35 static const char *const standard_exec_prefix_1 = "/usr/libexec/gcc/";
36 static const char *const standard_exec_prefix_2 = "/usr/lib/gcc/";
37-static const char *md_exec_prefix = MD_EXEC_PREFIX;
38
39-static const char *md_startfile_prefix = MD_STARTFILE_PREFIX;
40-static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1;
41 static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
42 static const char *const standard_startfile_prefix_1
43 = STANDARD_STARTFILE_PREFIX_1;
44@@ -1530,6 +1511,7 @@
45 INIT_STATIC_SPEC ("link_ssp", &link_ssp_spec),
ddf7cc86
SS
46 INIT_STATIC_SPEC ("endfile", &endfile_spec),
47 INIT_STATIC_SPEC ("link", &link_spec),
48+ INIT_STATIC_SPEC ("pre_lib", &pre_lib_spec),
49 INIT_STATIC_SPEC ("lib", &lib_spec),
50 INIT_STATIC_SPEC ("mfwrap", &mfwrap_spec),
51 INIT_STATIC_SPEC ("mflib", &mflib_spec),
ea87ee73
SS
52@@ -1546,9 +1528,6 @@
53 INIT_STATIC_SPEC ("multilib_options", &multilib_options),
54 INIT_STATIC_SPEC ("linker", &linker_name_spec),
55 INIT_STATIC_SPEC ("link_libgcc", &link_libgcc_spec),
56- INIT_STATIC_SPEC ("md_exec_prefix", &md_exec_prefix),
57- INIT_STATIC_SPEC ("md_startfile_prefix", &md_startfile_prefix),
58- INIT_STATIC_SPEC ("md_startfile_prefix_1", &md_startfile_prefix_1),
59 INIT_STATIC_SPEC ("startfile_prefix_spec", &startfile_prefix_spec),
60 INIT_STATIC_SPEC ("sysroot_spec", &sysroot_spec),
61 INIT_STATIC_SPEC ("sysroot_suffix_spec", &sysroot_suffix_spec),
62@@ -3278,8 +3257,6 @@
ddf7cc86
SS
63 set_std_prefix (gcc_exec_prefix, len);
64 add_prefix (&exec_prefixes, gcc_libexec_prefix, "GCC",
65 PREFIX_PRIORITY_LAST, 0, 0);
66- add_prefix (&startfile_prefixes, gcc_exec_prefix, "GCC",
67- PREFIX_PRIORITY_LAST, 0, 0);
68 }
69
70 /* COMPILER_PATH and LIBRARY_PATH have values
ea87ee73 71@@ -3827,11 +3804,6 @@
ddf7cc86
SS
72 PREFIX_PRIORITY_LAST, 2, 0);
73 #endif
74
75- add_prefix (&startfile_prefixes, standard_exec_prefix, "BINUTILS",
76- PREFIX_PRIORITY_LAST, 1, 0);
77- add_prefix (&startfile_prefixes, standard_exec_prefix_2, "BINUTILS",
78- PREFIX_PRIORITY_LAST, 1, 0);
79-
80 tooldir_prefix = concat (tooldir_base_prefix, spec_machine,
81 dir_separator_str, NULL);
82
ea87ee73 83@@ -3854,10 +3826,6 @@
ddf7cc86
SS
84 concat (gcc_exec_tooldir_prefix, "bin",
85 dir_separator_str, NULL),
86 NULL, PREFIX_PRIORITY_LAST, 0, 0);
87- add_prefix (&startfile_prefixes,
88- concat (gcc_exec_tooldir_prefix, "lib",
89- dir_separator_str, NULL),
90- NULL, PREFIX_PRIORITY_LAST, 0, 1);
91 }
92
93 tooldir_prefix = concat (standard_exec_prefix, spec_machine,
ea87ee73 94@@ -3865,13 +3833,6 @@
ddf7cc86
SS
95 dir_separator_str, tooldir_prefix, NULL);
96 }
97
98- add_prefix (&exec_prefixes,
99- concat (tooldir_prefix, "bin", dir_separator_str, NULL),
100- "BINUTILS", PREFIX_PRIORITY_LAST, 0, 0);
101- add_prefix (&startfile_prefixes,
102- concat (tooldir_prefix, "lib", dir_separator_str, NULL),
103- "BINUTILS", PREFIX_PRIORITY_LAST, 0, 1);
104-
105 #if defined(TARGET_SYSTEM_ROOT_RELOCATABLE) && !defined(VMS)
106 /* If the normal TARGET_SYSTEM_ROOT is inside of $exec_prefix,
107 then consider it to relocate with the rest of the GCC installation
ea87ee73 108@@ -6138,10 +6099,6 @@
ddf7cc86
SS
109
110 /* Read specs from a file if there is one. */
111
112- machine_suffix = concat (spec_machine, dir_separator_str,
113- spec_version, dir_separator_str, NULL);
114- just_machine_suffix = concat (spec_machine, dir_separator_str, NULL);
115-
116 specs_file = find_a_file (&startfile_prefixes, "specs", R_OK, 0);
117 /* Read the specs file unless it is a default one. */
118 if (specs_file != 0 && strcmp (specs_file, "specs"))
ea87ee73 119@@ -6151,11 +6108,9 @@
ddf7cc86
SS
120
121 /* We need to check standard_exec_prefix/just_machine_suffix/specs
122 for any override of as, ld and libraries. */
123- specs_file = alloca (strlen (standard_exec_prefix)
124- + strlen (just_machine_suffix) + sizeof ("specs"));
125+ specs_file = alloca (strlen (standard_exec_prefix) + sizeof ("specs"));
126
127 strcpy (specs_file, standard_exec_prefix);
128- strcat (specs_file, just_machine_suffix);
129 strcat (specs_file, "specs");
130 if (access (specs_file, R_OK) == 0)
131 read_specs (specs_file, TRUE);
ea87ee73
SS
132@@ -6172,17 +6127,6 @@
133 for (i = 0; i < ARRAY_SIZE (driver_self_specs); i++)
134 do_self_spec (driver_self_specs[i]);
ddf7cc86 135
ea87ee73
SS
136- /* If not cross-compiling, look for executables in the standard
137- places. */
138- if (*cross_compile == '0')
139- {
140- if (*md_exec_prefix)
141- {
142- add_prefix (&exec_prefixes, md_exec_prefix, "GCC",
143- PREFIX_PRIORITY_LAST, 0, 0);
144- }
145- }
146-
147 /* Process sysroot_suffix_spec. */
148 if (*sysroot_suffix_spec != 0
149 && do_spec_2 (sysroot_suffix_spec) == 0)
150@@ -6228,49 +6172,12 @@
151 }
152 /* We should eventually get rid of all these and stick to
153 startfile_prefix_spec exclusively. */
154- else if (*cross_compile == '0' || target_system_root)
155+ else
156 {
157- if (*md_startfile_prefix)
158- add_sysrooted_prefix (&startfile_prefixes, md_startfile_prefix,
159- "GCC", PREFIX_PRIORITY_LAST, 0, 1);
160-
161- if (*md_startfile_prefix_1)
162- add_sysrooted_prefix (&startfile_prefixes, md_startfile_prefix_1,
163- "GCC", PREFIX_PRIORITY_LAST, 0, 1);
164-
ddf7cc86
SS
165- /* If standard_startfile_prefix is relative, base it on
166- standard_exec_prefix. This lets us move the installed tree
167- as a unit. If GCC_EXEC_PREFIX is defined, base
168- standard_startfile_prefix on that as well.
169-
170- If the prefix is relative, only search it for native compilers;
171- otherwise we will search a directory containing host libraries. */
172- if (IS_ABSOLUTE_PATH (standard_startfile_prefix))
173- add_sysrooted_prefix (&startfile_prefixes,
174- standard_startfile_prefix, "BINUTILS",
175- PREFIX_PRIORITY_LAST, 0, 1);
176- else if (*cross_compile == '0')
177- {
178- if (gcc_exec_prefix)
179- add_prefix (&startfile_prefixes,
180- concat (gcc_exec_prefix, machine_suffix,
181- standard_startfile_prefix, NULL),
182- NULL, PREFIX_PRIORITY_LAST, 0, 1);
183- add_prefix (&startfile_prefixes,
184- concat (standard_exec_prefix,
185- machine_suffix,
186- standard_startfile_prefix, NULL),
187- NULL, PREFIX_PRIORITY_LAST, 0, 1);
188- }
189-
190- if (*standard_startfile_prefix_1)
191- add_sysrooted_prefix (&startfile_prefixes,
192- standard_startfile_prefix_1, "BINUTILS",
193- PREFIX_PRIORITY_LAST, 0, 1);
194- if (*standard_startfile_prefix_2)
195- add_sysrooted_prefix (&startfile_prefixes,
196- standard_startfile_prefix_2, "BINUTILS",
197- PREFIX_PRIORITY_LAST, 0, 1);
198+ add_prefix (&startfile_prefixes, standard_startfile_prefix,
199+ "GCC", PREFIX_PRIORITY_LAST, 0, 1);
200+ add_prefix (&startfile_prefixes, standard_startfile_prefix_1,
201+ "GCC", PREFIX_PRIORITY_LAST, 0, 1);
202 }
203
204 /* Process any user specified specs in the order given on the command
ea87ee73 205@@ -6306,7 +6213,7 @@
ddf7cc86
SS
206
207 if (print_search_dirs)
208 {
209- printf (_("install: %s%s\n"), standard_exec_prefix, machine_suffix);
210+ printf (_("install: %s\n"), standard_exec_prefix);
211 printf (_("programs: %s\n"), build_search_list (&exec_prefixes, "", 0));
212 printf (_("libraries: %s\n"), build_search_list (&startfile_prefixes, "", 0));
213 return (0);