Gentoo Archives: gentoo-commits

From: "Fabian Groffen (grobian)" <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sys-devel/binutils-apple/files: ld64-123.2.1-lto.patch ld64-123.2-Makefile libunwind-30-Makefile
Date: Sat, 03 Sep 2011 20:33:35
Message-Id: 20110903203322.31EE120051@flycatcher.gentoo.org
1 grobian 11/09/03 20:33:22
2
3 Modified: ld64-123.2-Makefile
4 Added: ld64-123.2.1-lto.patch libunwind-30-Makefile
5 Log:
6 Bump to version from Developer Tools 4.1, drop 4.0 version as it never compiled. Slot 4.x series as they are significantly different from 3.x series.
7
8 (Portage version: 2.2.01.19120-prefix/cvs/Darwin i386)
9
10 Revision Changes Path
11 1.2 sys-devel/binutils-apple/files/ld64-123.2-Makefile
12
13 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/binutils-apple/files/ld64-123.2-Makefile?rev=1.2&view=markup
14 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/binutils-apple/files/ld64-123.2-Makefile?rev=1.2&content-type=text/plain
15 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/binutils-apple/files/ld64-123.2-Makefile?r1=1.1&r2=1.2
16
17 Index: ld64-123.2-Makefile
18 ===================================================================
19 RCS file: /var/cvsroot/gentoo-x86/sys-devel/binutils-apple/files/ld64-123.2-Makefile,v
20 retrieving revision 1.1
21 retrieving revision 1.2
22 diff -u -r1.1 -r1.2
23 --- ld64-123.2-Makefile 11 May 2011 20:06:45 -0000 1.1
24 +++ ld64-123.2-Makefile 3 Sep 2011 20:33:22 -0000 1.2
25 @@ -1,12 +1,30 @@
26 -CPPFLAGS += -Iinclude -Iabstraction -Ild -Iother -I.
27 +CPPFLAGS += "-DCPU_SUBTYPE_X86_ALL=((cpu_subtype_t)3)" -Iinclude -Iabstraction -Ild -Ild/parsers -Iother -I.
28
29 # dropped machocheck due to compilation failures
30 -all: rebase unwinddump dyldinfo ObjectDump ld64
31 +all: rebase unwinddump dyldinfo ld64 ObjectDump
32
33 libprunetrie.a: other/PruneTrie.o other/prune_trie.h
34 $(AR) -s -r -c libprunetrie.a other/PruneTrie.o
35
36 -ld64: libprunetrie.a ld/ld.o ld/Options.o ld/debugline.o version.o
37 +LD64LIBS=ld/parsers/archive_file.o ld/parsers/macho_relocatable_file.o \
38 + ld/parsers/opaque_section_file.o \
39 + ld/parsers/macho_dylib_file.o \
40 + ld/passes/branch_island.o ld/passes/dylibs.o ld/passes/order_file.o \
41 + ld/passes/branch_shim.o ld/passes/got.o ld/passes/tlvp.o \
42 + ld/passes/compact_unwind.o ld/passes/huge.o \
43 + ld/passes/dtrace_dof.o ld/passes/objc.o \
44 + ld/passes/stubs/stubs.o \
45 + ld/InputFiles.o ld/OutputFile.o ld/SymbolTable.o \
46 + ld/Options.o ld/Resolver.o ld/debugline.o ld/ld.o
47 +
48 +ifeq ($(LTO),1)
49 +LD64LIBS += ld/parsers/lto_file.o
50 +CPPFLAGS += "-DLTO"
51 +else
52 +CPPFLAGS += "-ULTO"
53 +endif
54 +
55 +ld64: libprunetrie.a $(LD64LIBS) version.o
56 $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
57
58 rebase: other/rebase.o
59
60
61
62 1.1 sys-devel/binutils-apple/files/ld64-123.2.1-lto.patch
63
64 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/binutils-apple/files/ld64-123.2.1-lto.patch?rev=1.1&view=markup
65 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/binutils-apple/files/ld64-123.2.1-lto.patch?rev=1.1&content-type=text/plain
66
67 Index: ld64-123.2.1-lto.patch
68 ===================================================================
69 diff -ur ld.orig/InputFiles.cpp ld/InputFiles.cpp
70 --- ld.orig/InputFiles.cpp 2010-10-05 01:57:50.000000000 +0200
71 +++ ld/InputFiles.cpp 2011-09-03 20:33:40.000000000 +0200
72 @@ -58,7 +58,9 @@
73 #include "macho_relocatable_file.h"
74 #include "macho_dylib_file.h"
75 #include "archive_file.h"
76 +#ifdef LTO
77 #include "lto_file.h"
78 +#endif
79 #include "opaque_section_file.h"
80
81
82 @@ -175,9 +177,11 @@
83 if ( result != NULL )
84 return result;
85
86 +#ifdef LTO
87 result = lto::archName(p, len);
88 if ( result != NULL )
89 return result;
90 +#endif
91
92 if ( strncmp((const char*)p, "!<arch>\n", 8) == 0 )
93 return "archive";
94 @@ -264,10 +268,12 @@
95 if ( objResult != NULL )
96 return this->addObject(objResult, info, len);
97
98 +#if LTO
99 // see if it is an llvm object file
100 objResult = lto::parse(p, len, info.path, info.modTime, _nextInputOrdinal, _options.architecture(), _options.subArchitecture(), _options.logAllFiles());
101 if ( objResult != NULL )
102 return this->addObject(objResult, info, len);
103 +#endif
104
105 // see if it is a dynamic library
106 ld::dylib::File* dylibResult = mach_o::dylib::parse(p, len, info.path, info.modTime, _options, _nextInputOrdinal, info.options.fBundleLoader);
107 @@ -286,6 +292,7 @@
108 if ( archiveResult != NULL )
109 return this->addArchive(archiveResult, info, len);
110
111 +#ifdef LTO
112 // does not seem to be any valid linker input file, check LTO misconfiguration problems
113 if ( lto::archName((uint8_t*)p, len) != NULL ) {
114 if ( lto::libLTOisLoaded() ) {
115 @@ -310,6 +317,7 @@
116 throwf("could not process llvm bitcode object file, because %s could not be loaded", libLTO);
117 }
118 }
119 +#endif
120
121 // error handling
122 if ( ((fat_header*)p)->magic == OSSwapBigToHostInt32(FAT_MAGIC) ) {
123 diff -ur ld.orig/Options.cpp ld/Options.cpp
124 --- ld.orig/Options.cpp 2011-03-08 03:06:35.000000000 +0100
125 +++ ld/Options.cpp 2011-09-03 21:06:28.000000000 +0200
126 @@ -36,10 +36,12 @@
127 #include "Architectures.hpp"
128 #include "MachOFileAbstraction.hpp"
129
130 +#ifdef LTO
131 // upward dependency on lto::version()
132 namespace lto {
133 extern const char* version();
134 }
135 +#endif
136
137 // magic to place command line in crash reports
138 const int crashreporterBufferSize = 2000;
139 @@ -2786,9 +2788,11 @@
140 fprintf(stderr, "%s", ldVersionString);
141 // if only -v specified, exit cleanly
142 if ( argc == 2 ) {
143 +#ifdef LTO
144 const char* ltoVers = lto::version();
145 if ( ltoVers != NULL )
146 fprintf(stderr, "%s\n", ltoVers);
147 +#endif
148 exit(0);
149 }
150 }
151 diff -ur ld.orig/Resolver.cpp ld/Resolver.cpp
152 --- ld.orig/Resolver.cpp 2010-12-10 23:39:41.000000000 +0100
153 +++ ld/Resolver.cpp 2011-09-03 20:38:24.000000000 +0200
154 @@ -58,7 +58,9 @@
155 #include "InputFiles.h"
156 #include "SymbolTable.h"
157 #include "Resolver.h"
158 +#ifdef LTO
159 #include "parsers/lto_file.h"
160 +#endif
161
162
163 namespace ld {
164 @@ -1275,6 +1277,7 @@
165
166 void Resolver::linkTimeOptimize()
167 {
168 +#ifdef LTO
169 // only do work here if some llvm obj files where loaded
170 if ( ! _haveLLVMObjs )
171 return;
172 @@ -1375,6 +1378,9 @@
173 // check new code does not override some dylib
174 this->checkDylibSymbolCollisions();
175 }
176 +#else
177 + return;
178 +#endif
179 }
180
181
182 diff -ur ld.orig/ld.cpp ld/ld.cpp
183 --- ld.orig/ld.cpp 2011-09-03 20:24:07.000000000 +0200
184 +++ ld/ld.cpp 2011-09-03 20:40:06.000000000 +0200
185 @@ -85,7 +85,9 @@
186 #include "parsers/archive_file.h"
187 #include "parsers/macho_relocatable_file.h"
188 #include "parsers/macho_dylib_file.h"
189 +#ifdef LTO
190 #include "parsers/lto_file.h"
191 +#endif
192 #include "parsers/opaque_section_file.h"
193
194
195 diff -ur ld.orig/parsers/archive_file.cpp ld/parsers/archive_file.cpp
196 --- ld.orig/parsers/archive_file.cpp 2010-09-29 02:26:13.000000000 +0200
197 +++ ld/parsers/archive_file.cpp 2011-09-03 21:01:55.000000000 +0200
198 @@ -38,7 +38,9 @@
199 #include "Architectures.hpp"
200
201 #include "macho_relocatable_file.h"
202 +#ifdef LTO
203 #include "lto_file.h"
204 +#endif
205 #include "archive_file.h"
206
207
208 @@ -87,8 +89,10 @@
209 private:
210 static bool validMachOFile(const uint8_t* fileContent, uint64_t fileLength,
211 const mach_o::relocatable::ParserOptions& opts);
212 +#ifdef LTO
213 static bool validLTOFile(const uint8_t* fileContent, uint64_t fileLength,
214 const mach_o::relocatable::ParserOptions& opts);
215 +#endif
216 static cpu_type_t architecture();
217
218
219 @@ -232,12 +236,13 @@
220 return mach_o::relocatable::isObjectFile(fileContent, fileLength, opts);
221 }
222
223 +#ifdef LTO
224 template <typename A>
225 bool File<A>::validLTOFile(const uint8_t* fileContent, uint64_t fileLength, const mach_o::relocatable::ParserOptions& opts)
226 {
227 return lto::isObjectFile(fileContent, fileLength, opts.architecture, opts.subType);
228 }
229 -
230 +#endif
231
232
233 template <typename A>
234 @@ -256,7 +261,11 @@
235 if ( (p==start) && ((strcmp(memberName, SYMDEF_SORTED) == 0) || (strcmp(memberName, SYMDEF) == 0)) )
236 continue;
237 // archive is valid if first .o file is valid
238 - return (validMachOFile(p->content(), p->contentSize(), opts) || validLTOFile(p->content(), p->contentSize(), opts));
239 + return (validMachOFile(p->content(), p->contentSize(), opts)
240 +#ifdef LTO
241 + || validLTOFile(p->content(), p->contentSize(), opts)
242 +#endif
243 + );
244 }
245 // empty archive
246 return true;
247 @@ -342,12 +351,14 @@
248 this->ordinal() + memberIndex, _objOpts);
249 if ( result != NULL )
250 return result;
251 +#ifdef LTO
252 // see if member is llvm bitcode file
253 result = lto::parse(member->content(), member->contentSize(),
254 mPath, member->modificationTime(), this->ordinal() + memberIndex,
255 _objOpts.architecture, _objOpts.subType, _logAllFiles);
256 if ( result != NULL )
257 return result;
258 +#endif
259
260 throwf("archive member '%s' with length %d is not mach-o or llvm bitcode", memberName, member->contentSize());
261 }
262 --- other/ObjectDump.cpp.orig 2011-09-03 21:15:10.000000000 +0200
263 +++ other/ObjectDump.cpp 2011-09-03 21:14:37.000000000 +0200
264 @@ -33,7 +33,9 @@
265
266 #include "MachOFileAbstraction.hpp"
267 #include "parsers/macho_relocatable_file.h"
268 +#ifdef LTO
269 #include "parsers/lto_file.h"
270 +#endif
271
272 static bool sDumpContent= true;
273 static bool sDumpStabs = false;
274 @@ -1121,10 +1123,12 @@
275 if ( objResult != NULL )
276 return objResult;
277
278 +#ifdef LTO
279 // see if it is an llvm object file
280 objResult = lto::parse(p, fileLen, path, stat_buf.st_mtime, 0, sPreferredArch, sPreferredSubArch, false);
281 if ( objResult != NULL )
282 return objResult;
283 +#endif
284
285 throwf("not a mach-o object file: %s", path);
286 #else
287
288
289
290 1.1 sys-devel/binutils-apple/files/libunwind-30-Makefile
291
292 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/binutils-apple/files/libunwind-30-Makefile?rev=1.1&view=markup
293 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/binutils-apple/files/libunwind-30-Makefile?rev=1.1&content-type=text/plain
294
295 Index: libunwind-30-Makefile
296 ===================================================================
297 CPPFLAGS += -I../include
298
299 all: libunwind.a
300
301 OBJS=Registers.o unw_getcontext.o libuwind.o UnwindLevel1-gcc-ext.o UnwindLevel1.o Unwind-sjlj.o
302
303 libunwind.a: $(OBJS)
304 libtool -static -o $@ $^
305
306 libunwind.dylib: $(OBJS)
307 $(CXX) $(CXXFLAGS) -dynamiclib -single_module -compatibility_version 1 -o $@ $^
308
309 Registers.o: Registers.s
310 $(CXX) $(CPPFLAGS) $(CFLAGS) -c -o $@ $^
311
312 unw_getcontext.o: unw_getcontext.s
313 $(CXX) $(CPPFLAGS) $(CFLAGS) -c -o $@ $^
314
315 libuwind.o: libuwind.cxx
316 $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(DYLDINCS) -c -o $@ $^
317
318 %.o: %.c
319 $(CXX) $(CPPFLAGS) $(CFLAGS) -c -o $@ $^