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
|
Index: ld64/src/ld.cpp
===================================================================
--- ld64/src/ld.cpp (revision 287)
+++ ld64/src/ld.cpp (working copy)
@@ -2926,49 +2926,49 @@
switch (fArchitecture) {
case CPU_TYPE_POWERPC:
if ( mach_o::relocatable::Reader<ppc>::validFile(p) )
- return this->addObject(new mach_o::relocatable::Reader<ppc>::Reader(p, info.path, info.modTime, fOptions.readerOptions(), fNextInputOrdinal), info, len);
+ return this->addObject(new typename mach_o::relocatable::Reader<ppc>::Reader(p, info.path, info.modTime, fOptions.readerOptions(), fNextInputOrdinal), info, len);
else if ( mach_o::dylib::Reader<ppc>::validFile(p, info.options.fBundleLoader) )
- return this->addDylib(new mach_o::dylib::Reader<ppc>::Reader(p, len, info.path, info.options, fOptions.readerOptions(), fNextInputOrdinal), info, len);
+ return this->addDylib(new typename mach_o::dylib::Reader<ppc>::Reader(p, len, info.path, info.options, fOptions.readerOptions(), fNextInputOrdinal), info, len);
else if ( archive::Reader<ppc>::validFile(p, len) )
- return this->addArchive(new archive::Reader<ppc>::Reader(p, len, info.path, info.modTime, fOptions.readerOptions(), fNextInputOrdinal), info, len);
+ return this->addArchive(new typename archive::Reader<ppc>::Reader(p, len, info.path, info.modTime, fOptions.readerOptions(), fNextInputOrdinal), info, len);
break;
case CPU_TYPE_POWERPC64:
if ( mach_o::relocatable::Reader<ppc64>::validFile(p) )
- return this->addObject(new mach_o::relocatable::Reader<ppc64>::Reader(p, info.path, info.modTime, fOptions.readerOptions(), fNextInputOrdinal), info, len);
+ return this->addObject(new typename mach_o::relocatable::Reader<ppc64>::Reader(p, info.path, info.modTime, fOptions.readerOptions(), fNextInputOrdinal), info, len);
else if ( mach_o::dylib::Reader<ppc64>::validFile(p, info.options.fBundleLoader) )
- return this->addDylib(new mach_o::dylib::Reader<ppc64>::Reader(p, len, info.path, info.options, fOptions.readerOptions(), fNextInputOrdinal), info, len);
+ return this->addDylib(new typename mach_o::dylib::Reader<ppc64>::Reader(p, len, info.path, info.options, fOptions.readerOptions(), fNextInputOrdinal), info, len);
else if ( archive::Reader<ppc64>::validFile(p, len) )
- return this->addArchive(new archive::Reader<ppc64>::Reader(p, len, info.path, info.modTime, fOptions.readerOptions(), fNextInputOrdinal), info, len);
+ return this->addArchive(new typename archive::Reader<ppc64>::Reader(p, len, info.path, info.modTime, fOptions.readerOptions(), fNextInputOrdinal), info, len);
break;
case CPU_TYPE_I386:
if ( mach_o::relocatable::Reader<x86>::validFile(p) )
- return this->addObject(new mach_o::relocatable::Reader<x86>::Reader(p, info.path, info.modTime, fOptions.readerOptions(), fNextInputOrdinal), info, len);
+ return this->addObject(new typename mach_o::relocatable::Reader<x86>::Reader(p, info.path, info.modTime, fOptions.readerOptions(), fNextInputOrdinal), info, len);
else if ( mach_o::dylib::Reader<x86>::validFile(p, info.options.fBundleLoader) )
- return this->addDylib(new mach_o::dylib::Reader<x86>::Reader(p, len, info.path, info.options, fOptions.readerOptions(), fNextInputOrdinal), info, len);
+ return this->addDylib(new typename mach_o::dylib::Reader<x86>::Reader(p, len, info.path, info.options, fOptions.readerOptions(), fNextInputOrdinal), info, len);
else if ( archive::Reader<x86>::validFile(p, len) )
- return this->addArchive(new archive::Reader<x86>::Reader(p, len, info.path, info.modTime, fOptions.readerOptions(), fNextInputOrdinal), info, len);
+ return this->addArchive(new typename archive::Reader<x86>::Reader(p, len, info.path, info.modTime, fOptions.readerOptions(), fNextInputOrdinal), info, len);
break;
case CPU_TYPE_X86_64:
if ( mach_o::relocatable::Reader<x86_64>::validFile(p) )
- return this->addObject(new mach_o::relocatable::Reader<x86_64>::Reader(p, info.path, info.modTime, fOptions.readerOptions(), fNextInputOrdinal), info, len);
+ return this->addObject(new typename mach_o::relocatable::Reader<x86_64>::Reader(p, info.path, info.modTime, fOptions.readerOptions(), fNextInputOrdinal), info, len);
else if ( mach_o::dylib::Reader<x86_64>::validFile(p, info.options.fBundleLoader) )
- return this->addDylib(new mach_o::dylib::Reader<x86_64>::Reader(p, len, info.path, info.options, fOptions.readerOptions(), fNextInputOrdinal), info, len);
+ return this->addDylib(new typename mach_o::dylib::Reader<x86_64>::Reader(p, len, info.path, info.options, fOptions.readerOptions(), fNextInputOrdinal), info, len);
else if ( archive::Reader<x86_64>::validFile(p, len) )
- return this->addArchive(new archive::Reader<x86_64>::Reader(p, len, info.path, info.modTime, fOptions.readerOptions(), fNextInputOrdinal), info, len);
+ return this->addArchive(new typename archive::Reader<x86_64>::Reader(p, len, info.path, info.modTime, fOptions.readerOptions(), fNextInputOrdinal), info, len);
case CPU_TYPE_ARM:
if ( mach_o::relocatable::Reader<arm>::validFile(p) )
- return this->addObject(new mach_o::relocatable::Reader<arm>::Reader(p, info.path, info.modTime, fOptions.readerOptions(), fNextInputOrdinal), info, len);
+ return this->addObject(new typename mach_o::relocatable::Reader<arm>::Reader(p, info.path, info.modTime, fOptions.readerOptions(), fNextInputOrdinal), info, len);
else if ( mach_o::dylib::Reader<arm>::validFile(p, info.options.fBundleLoader) )
- return this->addDylib(new mach_o::dylib::Reader<arm>::Reader(p, len, info.path, info.options, fOptions.readerOptions(), fNextInputOrdinal), info, len);
+ return this->addDylib(new typename mach_o::dylib::Reader<arm>::Reader(p, len, info.path, info.options, fOptions.readerOptions(), fNextInputOrdinal), info, len);
else if ( archive::Reader<arm>::validFile(p, len) )
- return this->addArchive(new archive::Reader<arm>::Reader(p, len, info.path, info.modTime, fOptions.readerOptions(), fNextInputOrdinal), info, len);
+ return this->addArchive(new typename archive::Reader<arm>::Reader(p, len, info.path, info.modTime, fOptions.readerOptions(), fNextInputOrdinal), info, len);
break;
break;
}
#if LTO_SUPPORT
if ( lto::Reader::validFile(p, len, fArchitecture) ) {
- return this->addObject(new lto::Reader(p, len, info.path, info.modTime, fOptions.readerOptions(), fArchitecture), info, len);
+ return this->addObject(new typename lto::Reader(p, len, info.path, info.modTime, fOptions.readerOptions(), fArchitecture), info, len);
}
else if ( !lto::Reader::loaded() && (p[0] == 'B') && (p[1] == 'C') ) {
throw "could not process object file. Looks like an llvm bitcode object file, but libLTO.dylib could not be loaded";
Index: ld64/src/Options.h
===================================================================
--- ld64/src/Options.h (revision 287)
+++ ld64/src/Options.h (working copy)
@@ -25,8 +25,10 @@
#ifndef __OPTIONS__
#define __OPTIONS__
-
+#include <limits.h>
+#include <stdio.h>
#include <stdint.h>
+#include <string.h>
#include <mach/machine.h>
#include <vector>
Index: ld64/src/MachOReaderRelocatable.hpp
===================================================================
--- ld64/src/MachOReaderRelocatable.hpp (revision 287)
+++ ld64/src/MachOReaderRelocatable.hpp (working copy)
@@ -25,6 +25,7 @@
#ifndef __OBJECT_FILE_MACH_O__
#define __OBJECT_FILE_MACH_O__
+#include <stdio.h>
#include <stdint.h>
#include <math.h>
#include <unistd.h>
@@ -84,6 +85,25 @@
};
+class BaseAtom : public ObjectFile::Atom
+{
+public:
+ BaseAtom() : fStabsStartIndex(0), fStabsCount(0) {}
+
+ virtual void setSize(uint64_t size) = 0;
+ virtual void addReference(ObjectFile::Reference* ref) = 0;
+ virtual void sortReferences() = 0;
+ virtual void addLineInfo(const ObjectFile::LineInfo& info) = 0;
+ virtual uint64_t getObjectAddress() const = 0;
+ virtual uint32_t getOrdinal() const { return fOrdinal; }
+ virtual void setOrdinal(uint32_t value) { fOrdinal = value; }
+ virtual const void* getSectionRecord() const = 0;
+ virtual bool isAlias() const { return false; }
+
+ uint32_t fStabsStartIndex;
+ uint32_t fStabsCount;
+ uint32_t fOrdinal;
+};
template <typename A>
class Reference : public ObjectFile::Reference
{
@@ -268,26 +288,7 @@
LinkEditSegment LinkEditSegment::fgSingleton;
-class BaseAtom : public ObjectFile::Atom
-{
-public:
- BaseAtom() : fStabsStartIndex(0), fStabsCount(0) {}
- virtual void setSize(uint64_t size) = 0;
- virtual void addReference(ObjectFile::Reference* ref) = 0;
- virtual void sortReferences() = 0;
- virtual void addLineInfo(const ObjectFile::LineInfo& info) = 0;
- virtual uint64_t getObjectAddress() const = 0;
- virtual uint32_t getOrdinal() const { return fOrdinal; }
- virtual void setOrdinal(uint32_t value) { fOrdinal = value; }
- virtual const void* getSectionRecord() const = 0;
- virtual bool isAlias() const { return false; }
-
- uint32_t fStabsStartIndex;
- uint32_t fStabsCount;
- uint32_t fOrdinal;
-};
-
class BaseAtomSorter
{
public:
|