summaryrefslogtreecommitdiff
blob: f484111ab34b51d0b3fafb8a236f4a11547aa7e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
Allow to disable snapshot support because of missing Block API on OS X < 10.6.

--- ld64-241.9/src/ld/InputFiles.cpp.orig	2015-01-16 15:26:31.000000000 -0800
+++ ld64-241.9/src/ld/InputFiles.cpp	2015-01-16 15:26:54.000000000 -0800
@@ -1144,7 +1144,9 @@
 			case ld::File::Reloc:
 			{
 				ld::relocatable::File* reloc = (ld::relocatable::File*)file;
+#ifdef SUPPORT_SNAPSHOTS
 				_options.snapshot().recordObjectFile(reloc->path());
+#endif
 				if ( _options.dumpDependencyInfo() )
 					_options.dumpDependency(Options::depObjectFile, reloc->path());
 			}
@@ -1244,7 +1246,9 @@
                 if ( dylibFile->justInTimeforEachAtom(name, handler) ) {
                     // we found a definition in this dylib
                     // done, unless it is a weak definition in which case we keep searching
+#ifdef SUPPORT_SNAPSHOTS
                     _options.snapshot().recordDylibSymbol(dylibFile, name);
+#endif
                     if ( !dylibFile->hasWeakExternals() || !dylibFile->hasWeakDefinition(name)) {
                         return true;
                     }
@@ -1258,7 +1262,9 @@
                     if ( archiveFile->justInTimeDataOnlyforEachAtom(name, handler) ) {
                         if ( _options.traceArchives() ) 
                             logArchive(archiveFile);
+#ifdef SUPPORT_SNAPSHOTS
                         _options.snapshot().recordArchive(archiveFile->path());
+#endif
                         // found data definition in static library, done
                        return true;
                     }
@@ -1267,7 +1273,9 @@
                     if ( archiveFile->justInTimeforEachAtom(name, handler) ) {
                         if ( _options.traceArchives() ) 
                             logArchive(archiveFile);
+#ifdef SUPPORT_SNAPSHOTS
                         _options.snapshot().recordArchive(archiveFile->path());
+#endif
                         // found definition in static library, done
                         return true;
                     }
@@ -1294,7 +1302,9 @@
 				if ( dylibFile->justInTimeforEachAtom(name, handler) ) {
 					// we found a definition in this dylib
 					// done, unless it is a weak definition in which case we keep searching
+#ifdef SUPPORT_SNAPSHOTS
                     _options.snapshot().recordDylibSymbol(dylibFile, name);
+#endif
 					if ( !dylibFile->hasWeakExternals() || !dylibFile->hasWeakDefinition(name)) {
 						return true;
                     }
--- ld64-241.9/src/ld/ld.cpp.orig	2015-01-16 15:26:32.000000000 -0800
+++ ld64-241.9/src/ld/ld.cpp	2015-01-16 15:26:54.000000000 -0800
@@ -1180,11 +1180,13 @@
 // implement assert() function to print out a backtrace before aborting
 void __assert_rtn(const char* func, const char* file, int line, const char* failedexpr)
 {
+#ifdef SUPPORT_SNAPSHOTS
     Snapshot *snapshot = Snapshot::globalSnapshot;
     
     snapshot->setSnapshotMode(Snapshot::SNAPSHOT_DEBUG);
     snapshot->createSnapshot();
 	snapshot->recordAssertionMessage("Assertion failed: (%s), function %s, file %s, line %d.\n", failedexpr, func, file, line);
+#endif
 
 	void* callStack[128];
 	int depth = ::backtrace(callStack, 128);
@@ -1202,9 +1204,13 @@
 		}
 		long offset = (uintptr_t)callStack[i] - (uintptr_t)info.dli_saddr;
 		fprintf(stderr, "%d  %p  %s + %ld\n", i, callStack[i], symboName, offset);
+#ifdef SUPPORT_SNAPSHOTS
 		snapshot->recordAssertionMessage("%d  %p  %s + %ld\n", i, callStack[i], symboName, offset);
+#endif
 	}
+#ifdef SUPPORT_SNAPSHOTS
     fprintf(stderr, "A linker snapshot was created at:\n\t%s\n", snapshot->rootDir());
+#endif
 	fprintf(stderr, "ld: Assertion failed: (%s), function %s, file %s, line %d.\n", failedexpr, func, file, line);
 	exit(1);
 }
--- ld64-241.9/src/ld/Options.cpp.orig	2015-01-16 15:26:32.000000000 -0800
+++ ld64-241.9/src/ld/Options.cpp	2015-01-16 15:27:26.000000000 -0800
@@ -183,7 +183,11 @@
 	  fMarkAppExtensionSafe(false), fCheckAppExtensionSafe(false), fForceLoadSwiftLibs(false), 
 	  fDebugInfoStripping(kDebugInfoMinimal), fTraceOutputFile(NULL), 
 	  fMacVersionMin(ld::macVersionUnset), fIOSVersionMin(ld::iOSVersionUnset), 
-	  fSaveTempFiles(false), fSnapshotRequested(false), fPipelineFifo(NULL), 
+	  fSaveTempFiles(false),
+#ifdef SUPPORT_SNAPSHOTS
+	  fSnapshotRequested(false),
+#endif
+	  fPipelineFifo(NULL), 
 	  fDependencyInfoPath(NULL), fDependencyFileDescriptor(-1)
 {
 	this->checkForClassic(argc, argv);
@@ -589,7 +593,9 @@
 					}
 					break;
 			}
+#ifdef SUPPORT_SNAPSHOTS
 			fLinkSnapshot.recordArch(fArchitectureName);
+#endif
 			// only use compressed LINKEDIT for:
 			//			Mac OS X 10.6 or later
 			//			iOS 3.1 or later
@@ -1908,8 +1914,10 @@
 //
 void Options::parse(int argc, const char* argv[])
 {
+#ifdef SUPPORT_SNAPSHOTS
     // Store the original args in the link snapshot.
     fLinkSnapshot.recordRawArgs(argc, argv);
+#endif
     
 	// pass one builds search list from -L and -F options
 	this->buildSearchPaths(argc, argv);
@@ -1922,17 +1930,21 @@
 		const char* arg = argv[i];
 
 		if ( arg[0] == '-' ) {
+#ifdef SUPPORT_SNAPSHOTS
             // by default, copy one arg to the snapshot link command, and do no file copying
             int snapshotArgIndex = i;
             int snapshotArgCount = -1; // -1 means compute count based on change in index
             int snapshotFileArgIndex = -1; // -1 means no data file parameter to arg
+#endif
 
 			// Since we don't care about the files passed, just the option names, we do this here.
 			if (fPrintOptions)
 				fprintf (stderr, "[Logging ld64 options]\t%s\n", arg);
 
 			if ( (arg[1] == 'L') || (arg[1] == 'F') ) {
+#ifdef SUPPORT_SNAPSHOTS
                 snapshotArgCount = 0; // stripped out of link snapshot
+#endif
 				if (arg[2] == '\0')
 					++i;
 				// previously handled by buildSearchPaths()
@@ -1979,12 +1991,16 @@
 				fOutputKind = kKextBundle;
 			}
 			else if ( strcmp(arg, "-o") == 0 ) {
-                snapshotArgCount = 0;
 				fOutputFile = argv[++i];
+#ifdef SUPPORT_SNAPSHOTS
+                snapshotArgCount = 0;
                 fLinkSnapshot.setSnapshotName(fOutputFile);
+#endif
 			}
 			else if ( strncmp(arg, "-lazy-l", 7) == 0 ) {
+#ifdef SUPPORT_SNAPSHOTS
                 snapshotArgCount = 0;
+#endif
 				FileInfo info = findLibrary(&arg[7], true);
 				info.options.fLazyLoad = true;
 				info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
@@ -1992,13 +2008,17 @@
 				fUsingLazyDylibLinking = true;
 			}
 			else if ( strcmp(arg, "-lto_library") == 0 ) {
+#ifdef SUPPORT_SNAPSHOTS
                 snapshotFileArgIndex = 1;
+#endif
 				fOverridePathlibLTO = argv[++i];
 				if ( fOverridePathlibLTO == NULL )
 					throw "missing argument to -lto_library";
 			}
 			else if ( (arg[1] == 'l') && (strncmp(arg,"-lazy_",6) !=0) ) {
+#ifdef SUPPORT_SNAPSHOTS
                 snapshotArgCount = 0;
+#endif
 				FileInfo info = findLibrary(&arg[2]);
 				info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
 				addLibrary(info);
@@ -2006,8 +2026,10 @@
 			// This causes a dylib to be weakly bound at
 			// link time.  This corresponds to weak_import.
 			else if ( strncmp(arg, "-weak-l", 7) == 0 ) {
+#ifdef SUPPORT_SNAPSHOTS
                 // SNAPSHOT FIXME: what should we do for link snapshots? (ignore for now)
                 snapshotArgCount = 0;
+#endif
 				FileInfo info = findLibrary(&arg[7]);
 				info.options.fWeakImport = true;
 				info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
@@ -2065,12 +2087,16 @@
 			else if ( strcmp(arg, "-sectorder") == 0 ) {
 				 if ( (argv[i+1]==NULL) || (argv[i+2]==NULL) || (argv[i+3]==NULL) )
 					throw "-sectorder missing <segment> <section> <file-path>";
+#ifdef SUPPORT_SNAPSHOTS
                 snapshotFileArgIndex = 3;
+#endif
 				parseSectionOrderFile(argv[i+1], argv[i+2], argv[i+3]);
 				i += 3;
 			}
 			else if ( strcmp(arg, "-order_file") == 0 ) {
+#ifdef SUPPORT_SNAPSHOTS
                 snapshotFileArgIndex = 1;
+#endif
 				parseOrderFile(argv[++i], false);
 			}
 			else if ( strcmp(arg, "-order_file_statistics") == 0 ) {
@@ -2081,7 +2107,9 @@
 			else if ( (strcmp(arg, "-sectcreate") == 0) || (strcmp(arg, "-segcreate") == 0) ) {
 				 if ( (argv[i+1]==NULL) || (argv[i+2]==NULL) || (argv[i+3]==NULL) )
 					throw "-sectcreate missing <segment> <section> <file-path>";
+#ifdef SUPPORT_SNAPSHOTS
                 snapshotFileArgIndex = 3;
+#endif
 				addSection(argv[i+1], argv[i+2], argv[i+3]);
 				i += 3;
 			}
@@ -2110,7 +2138,9 @@
 			}
 			// Same as -@ from the FSF linker.
 			else if ( strcmp(arg, "-filelist") == 0 ) {
+#ifdef SUPPORT_SNAPSHOTS
                  snapshotArgCount = 0;
+#endif
 				 const char* path = argv[++i];
 				 if ( (path == NULL) || (path[0] == '-') )
 					throw "-filelist missing <path>";
@@ -2137,7 +2167,9 @@
 				}
 			}
 			else if ( strcmp(arg, "-interposable_list") == 0 ) {
+#ifdef SUPPORT_SNAPSHOTS
                 snapshotFileArgIndex = 1;
+#endif
 				fInterposeMode = kInterposeSome;
 				loadExportFile(argv[++i], "-interposable_list", fInterposeList);
 			}
@@ -2146,14 +2178,18 @@
 				fInterposeMode = kInterposeNone;
 			}
 			else if ( strcmp(arg, "-exported_symbols_list") == 0 ) {
+#ifdef SUPPORT_SNAPSHOTS
                 snapshotFileArgIndex = 1;
+#endif
 				if ( fExportMode == kDontExportSome )
 					throw "can't use -exported_symbols_list and -unexported_symbols_list";
 				fExportMode = kExportSome;
 				loadExportFile(argv[++i], "-exported_symbols_list", fExportSymbols);
 			}
 			else if ( strcmp(arg, "-unexported_symbols_list") == 0 ) {
+#ifdef SUPPORT_SNAPSHOTS
                 snapshotFileArgIndex = 1;
+#endif
 				if ( fExportMode == kExportSome )
 					throw "can't use -unexported_symbols_list and -exported_symbols_list";
 				fExportMode = kDontExportSome;
@@ -2172,14 +2208,18 @@
 				fDontExportSymbols.insert(argv[++i]);
 			}
 			else if ( strcmp(arg, "-non_global_symbols_no_strip_list") == 0 ) {
+#ifdef SUPPORT_SNAPSHOTS
                 snapshotFileArgIndex = 1;
+#endif
 				if ( fLocalSymbolHandling == kLocalSymbolsSelectiveExclude )
 					throw "can't use -non_global_symbols_no_strip_list and -non_global_symbols_strip_list";
 				fLocalSymbolHandling = kLocalSymbolsSelectiveInclude;
 				loadExportFile(argv[++i], "-non_global_symbols_no_strip_list", fLocalSymbolsIncluded);
 			}
 			else if ( strcmp(arg, "-non_global_symbols_strip_list") == 0 ) {
+#ifdef SUPPORT_SNAPSHOTS
                 snapshotFileArgIndex = 1;
+#endif
 				if ( fLocalSymbolHandling == kLocalSymbolsSelectiveInclude )
 					throw "can't use -non_global_symbols_no_strip_list and -non_global_symbols_strip_list";
 				fLocalSymbolHandling = kLocalSymbolsSelectiveExclude;
@@ -2195,16 +2235,20 @@
 			}
 			// Similar to -weak-l but uses the absolute path name to the library.
 			else if ( strcmp(arg, "-weak_library") == 0 ) {
+#ifdef SUPPORT_SNAPSHOTS
                 // SNAPSHOT FIXME: what should we do for link snapshots? (ignore for now)
                 snapshotArgCount = 0;
+#endif
 				FileInfo info = findFile(argv[++i]);
 				info.options.fWeakImport = true;
 				info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
 				addLibrary(info);
 			}
 			else if ( strcmp(arg, "-lazy_library") == 0 ) {
+#ifdef SUPPORT_SNAPSHOTS
                 // SNAPSHOT FIXME: what should we do for link snapshots? (ignore for now)
                 snapshotArgCount = 0;
+#endif
 				FileInfo info = findFile(argv[++i]);
 				info.options.fLazyLoad = true;
 				info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
@@ -2212,22 +2256,28 @@
 				fUsingLazyDylibLinking = true;
 			}
 			else if ( strcmp(arg, "-framework") == 0 ) {
+#ifdef SUPPORT_SNAPSHOTS
                 snapshotArgCount = 0;
+#endif
 				FileInfo info = findFramework(argv[++i]);
 				info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
 				addLibrary(info);
 			}
 			else if ( strcmp(arg, "-weak_framework") == 0 ) {
+#ifdef SUPPORT_SNAPSHOTS
                 // SNAPSHOT FIXME: what should we do for link snapshots? (ignore for now)
                 snapshotArgCount = 0;
+#endif
 				FileInfo info = findFramework(argv[++i]);
 				info.options.fWeakImport = true;
 				info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
 				addLibrary(info);
 			}
 			else if ( strcmp(arg, "-lazy_framework") == 0 ) {
+#ifdef SUPPORT_SNAPSHOTS
                 // SNAPSHOT FIXME: what should we do for link snapshots? (ignore for now)
                 snapshotArgCount = 0;
+#endif
 				FileInfo info = findFramework(argv[++i]);
 				info.options.fLazyLoad = true;
 				info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
@@ -2305,8 +2355,10 @@
 			// This should probably be deprecated when we respect -L and -F
 			// when searching for libraries.
 			else if ( strcmp(arg, "-dylib_file") == 0 ) {
+#ifdef SUPPORT_SNAPSHOTS
                 // ignore for snapshot because a stub dylib will be created in the snapshot
                  snapshotArgCount = 0;
+#endif
 				 addDylibOverride(argv[++i]);
 			}
 			// What to expand @executable_path to if found in dependent dylibs
@@ -2363,7 +2415,9 @@
 			}
 			// ??? Deprecate when we get rid of basing at build time.
 			else if ( strcmp(arg, "-seg_addr_table") == 0 ) {
+#ifdef SUPPORT_SNAPSHOTS
                 snapshotFileArgIndex = 1;
+#endif
 				const char* name = argv[++i];
 				if ( name == NULL )
 					throw "-seg_addr_table missing argument";
@@ -2427,7 +2481,9 @@
 				i += 2;
 			}
 			else if ( strcmp(arg, "-bundle_loader") == 0 ) {
+#ifdef SUPPORT_SNAPSHOTS
                 snapshotFileArgIndex = 1;
+#endif
 				fBundleLoader = argv[++i];
 				if ( (fBundleLoader == NULL) || (fBundleLoader[0] == '-') )
 					throw "-bundle_loader missing <path>";
@@ -2659,7 +2715,9 @@
 				// previously handled by buildSearchPaths()
 			}
 			else if ( strcmp(arg, "-syslibroot") == 0 ) {
+#ifdef SUPPORT_SNAPSHOTS
                 snapshotArgCount = 0;
+#endif
 				++i;
 				// previously handled by buildSearchPaths()
 			}
@@ -2670,7 +2728,9 @@
 				fUUIDMode = kUUIDRandom;
 			}
 			else if ( strcmp(arg, "-dtrace") == 0 ) {
+#ifdef SUPPORT_SNAPSHOTS
                 snapshotFileArgIndex = 1;
+#endif
 				const char* name = argv[++i];
 				if ( name == NULL )
 					throw "-dtrace missing argument";
@@ -2693,7 +2753,9 @@
 				fAliases.push_back(pair);
 			}
 			else if ( strcmp(arg, "-alias_list") == 0 ) {
+#ifdef SUPPORT_SNAPSHOTS
                 snapshotFileArgIndex = 1;
+#endif
 				parseAliasFile(argv[++i]);
 			}
 			else if ( strcmp(arg, "-save-temps") == 0 ) {
@@ -2724,48 +2786,60 @@
 				fDisablePositionIndependentExecutable = true;
 			}
 			else if ( strncmp(arg, "-reexport-l", 11) == 0 ) {
+#ifdef SUPPORT_SNAPSHOTS
                 // SNAPSHOT FIXME: what should we do for link snapshots? (ignore for now)
                 snapshotArgCount = 0;
+#endif
 				FileInfo info = findLibrary(&arg[11], true);
 				info.options.fReExport = true;
 				info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
 				addLibrary(info);
 			}
 			else if ( strcmp(arg, "-reexport_library") == 0 ) {
+#ifdef SUPPORT_SNAPSHOTS
                 // SNAPSHOT FIXME: what should we do for link snapshots? (ignore for now)
                 snapshotArgCount = 0;
+#endif
 				FileInfo info = findFile(argv[++i]);
 				info.options.fReExport = true;
 				info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
 				addLibrary(info);
 			}
 			else if ( strcmp(arg, "-reexport_framework") == 0 ) {
+#ifdef SUPPORT_SNAPSHOTS
                 // SNAPSHOT FIXME: what should we do for link snapshots? (ignore for now)
                 snapshotArgCount = 0;
+#endif
 				FileInfo info = findFramework(argv[++i]);
 				info.options.fReExport = true;
 				info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
 				addLibrary(info);
 			}
 			else if ( strncmp(arg, "-upward-l", 9) == 0 ) {
+#ifdef SUPPORT_SNAPSHOTS
                 // SNAPSHOT FIXME: what should we do for link snapshots? (ignore for now)
                 snapshotArgCount = 0;
+#endif
 				FileInfo info = findLibrary(&arg[9], true);
 				info.options.fUpward = true;
 				info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
 				addLibrary(info);
 			}
 			else if ( strcmp(arg, "-upward_library") == 0 ) {
+#ifdef SUPPORT_SNAPSHOTS
                 // SNAPSHOT FIXME: what should we do for link snapshots? (ignore for now)
                 snapshotArgCount = 0;
+#endif
 				FileInfo info = findFile(argv[++i]);
 				info.options.fUpward = true;
 				info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
 				addLibrary(info);
 			}
 			else if ( strcmp(arg, "-upward_framework") == 0 ) {
+#ifdef SUPPORT_SNAPSHOTS
                 // SNAPSHOT FIXME: what should we do for link snapshots? (ignore for now)
                 snapshotArgCount = 0;
+#endif
 				FileInfo info = findFramework(argv[++i]);
 				info.options.fUpward = true;
 				info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
@@ -2819,7 +2893,9 @@
 				fMarkDeadStrippableDylib = true;
 			}
 			else if ( strcmp(arg, "-exported_symbols_order") == 0 ) {
+#ifdef SUPPORT_SNAPSHOTS
                 snapshotFileArgIndex = 1;
+#endif
 				loadSymbolOrderFile(argv[++i], fExportSymbolsOrder);
 			}
 			else if ( strcmp(arg, "-no_compact_linkedit") == 0 ) {
@@ -2911,11 +2987,15 @@
 				fObjcCategoryMerging = false;
 			}
 			else if ( strcmp(arg, "-force_symbols_weak_list") == 0 ) {
+#ifdef SUPPORT_SNAPSHOTS
                 snapshotFileArgIndex = 1;
+#endif
 				loadExportFile(argv[++i], "-force_symbols_weak_list", fForceWeakSymbols);
 			}
 			else if ( strcmp(arg, "-force_symbols_not_weak_list") == 0 ) {
+#ifdef SUPPORT_SNAPSHOTS
                 snapshotFileArgIndex = 1;
+#endif
 				loadExportFile(argv[++i], "-force_symbols_not_weak_list", fForceNotWeakSymbols);
 			}
 			else if ( strcmp(arg, "-force_symbol_weak") == 0 ) {
@@ -2931,7 +3011,9 @@
 				fForceNotWeakSymbols.insert(symbol);
 			}
 			else if ( strcmp(arg, "-reexported_symbols_list") == 0 ) {
+#ifdef SUPPORT_SNAPSHOTS
                 snapshotFileArgIndex = 1;
+#endif
 				if ( fExportMode == kExportSome )
 					throw "can't use -exported_symbols_list and -reexported_symbols_list";
 				loadExportFile(argv[++i], "-reexported_symbols_list", fReExportSymbols);
@@ -2947,6 +3029,7 @@
 			else if ( strcmp(arg, "-page_align_data_atoms") == 0 ) {
 				fPageAlignDataAtoms = true;
 			} 
+#ifdef SUPPORT_SNAPSHOTS
 			else if (strcmp(arg, "-debug_snapshot") == 0) {
                 fLinkSnapshot.setSnapshotMode(Snapshot::SNAPSHOT_DEBUG);
                 fSnapshotRequested = true;
@@ -2959,6 +3042,7 @@
 				fLinkSnapshot.setSnapshotPath(path);
 				fSnapshotRequested = true;
             }
+#endif
 			else if ( strcmp(arg, "-new_main") == 0 ) {
 				fEntryPointLoadCommandForceOn = true;
 			}
@@ -2993,7 +3077,9 @@
 				fKextsUseStubs = true;
 			}
 			else if ( strcmp(argv[i], "-dependency_info") == 0 ) {
+#ifdef SUPPORT_SNAPSHOTS
                 snapshotArgCount = 0;
+#endif
 				++i;
 				// previously handled by buildSearchPaths()
 			}
@@ -3001,7 +3087,9 @@
 				fExportDynamic = true;
 			}
 			else if ( strcmp(arg, "-force_symbols_coalesce_list") == 0 ) {
+#ifdef SUPPORT_SNAPSHOTS
                 snapshotFileArgIndex = 1;
+#endif
 				loadExportFile(argv[++i], "-force_symbols_coalesce_list", fForceCoalesceSymbols);
 			}
 			else if ( strcmp(arg, "-add_linker_option") == 0 ) {
@@ -3158,10 +3246,12 @@
 				throwf("unknown option: %s", arg);
 			}
             
+#ifdef SUPPORT_SNAPSHOTS
             if (snapshotArgCount == -1)
                 snapshotArgCount = i-snapshotArgIndex+1;
             if (snapshotArgCount > 0)
                 fLinkSnapshot.addSnapshotLinkArg(snapshotArgIndex, snapshotArgCount, snapshotFileArgIndex);
+#endif
 		}
 		else {
 			FileInfo info = findFile(arg);
@@ -3180,8 +3270,10 @@
 		addLibrary(info);
 	}
     
+#ifdef SUPPORT_SNAPSHOTS
     if (fSnapshotRequested)
         fLinkSnapshot.createSnapshot();
+#endif
 }
 
 
@@ -3452,6 +3544,7 @@
 	if ( customDyldPath != NULL ) 
 		fDyldInstallPath = customDyldPath;
     
+#ifdef SUPPORT_SNAPSHOTS
     const char* debugArchivePath = getenv("LD_DEBUG_SNAPSHOT");
     if (debugArchivePath != NULL) {
         fLinkSnapshot.setSnapshotMode(Snapshot::SNAPSHOT_DEBUG);
@@ -3459,6 +3552,7 @@
             fLinkSnapshot.setSnapshotPath(debugArchivePath);
         fSnapshotRequested = true;
     }
+#endif
 
     const char* pipeFdString = getenv("LD_PIPELINE_FIFO");
     if (pipeFdString != NULL) {
@@ -4351,7 +4445,9 @@
 			if ( strcmp(&lastSlash[1], subUmbrella) == 0 ) {
 				info.options.fReExport = true;
 				found = true;
+#ifdef SUPPORT_SNAPSHOTS
                 fLinkSnapshot.recordSubUmbrella(info.path);
+#endif
 				break;
 			}
 		}
@@ -4374,7 +4470,9 @@
 			if ( strncmp(&lastSlash[1], subLibrary, dot-lastSlash-1) == 0 ) {
 				info.options.fReExport = true;
 				found = true;
+#ifdef SUPPORT_SNAPSHOTS
                 fLinkSnapshot.recordSubLibrary(info.path);
+#endif
 				break;
 			}
 		}
--- ld64-241.9/src/ld/Options.h.orig	2015-01-16 15:26:32.000000000 -0800
+++ ld64-241.9/src/ld/Options.h	2015-01-16 15:26:54.000000000 -0800
@@ -48,7 +48,9 @@
 extern void throwf (const char* format, ...) __attribute__ ((noreturn,format(printf, 1, 2)));
 extern void warning(const char* format, ...) __attribute__((format(printf, 1, 2)));
 
+#ifdef SUPPORT_SNAPSHOTS
 class Snapshot;
+#endif
 
 class LibraryOptions
 {
@@ -379,7 +381,9 @@
 	bool						forceWeakNonWildCard(const char* symbolName) const;
 	bool						forceNotWeakNonWildcard(const char* symbolName) const;
 	bool						forceCoalesce(const char* symbolName) const;
+#ifdef SUPPORT_SNAPSHOTS
     Snapshot&                   snapshot() const { return fLinkSnapshot; }
+#endif
 	bool						errorBecauseOfWarnings() const;
 	bool						needsThreadLoadCommand() const { return fNeedsThreadLoadCommand; }
 	bool						needsEntryPointLoadCommand() const { return fEntryPointLoadCommand; }
@@ -677,8 +681,10 @@
 	std::vector<SymbolsMove>			fSymbolsMovesCode;
 	std::vector<SymbolsMove>			fSymbolsMovesZeroFill;
 	bool								fSaveTempFiles;
+#ifdef SUPPORT_SNAPSHOTS
     mutable Snapshot					fLinkSnapshot;
     bool								fSnapshotRequested;
+#endif
     const char*							fPipelineFifo;
 	const char*							fDependencyInfoPath;
 	mutable int							fDependencyFileDescriptor;
--- ld64-241.9/src/ld/Snapshot.cpp.orig	2014-09-10 15:24:46.000000000 -0700
+++ ld64-241.9/src/ld/Snapshot.cpp	2015-01-16 15:26:54.000000000 -0800
@@ -6,6 +6,7 @@
 //  Copyright (c) 2011 Apple Inc. All rights reserved.
 //
 
+#ifdef SUPPORT_SNAPSHOTS
 #include <string.h>
 #include <unistd.h>
 #include <stdio.h>
@@ -536,3 +538,5 @@
         }    
     }
 }
+
+#endif /* SUPPORT_SNAPSHOTS */
--- ld64-236.3/src/ld/Snapshot.h.orig	2015-01-23 07:59:55.000000000 +0100
+++ ld64-236.3/src/ld/Snapshot.h	2015-01-23 07:58:14.000000000 +0100
@@ -8,6 +8,8 @@
 
 #ifndef ld64_Snapshot_h
 #define ld64_Snapshot_h
+
+#ifdef SUPPORT_SNAPSHOTS
 #include <stdint.h>
 #include <string.h>
 #include <map>
@@ -151,3 +153,5 @@
 };
 
 #endif
+
+#endif