File tree Expand file tree Collapse file tree 7 files changed +17
-17
lines changed Expand file tree Collapse file tree 7 files changed +17
-17
lines changed Original file line number Diff line number Diff line change @@ -175,6 +175,15 @@ llvm::Triple::ArchType LinkerDriver::getArch() {
175
175
return getMachineArchType (ctx.config .machine );
176
176
}
177
177
178
+ std::vector<Chunk *> LinkerDriver::getChunks () const {
179
+ std::vector<Chunk *> res;
180
+ for (ObjFile *file : ctx.objFileInstances ) {
181
+ ArrayRef<Chunk *> v = file->getChunks ();
182
+ res.insert (res.end (), v.begin (), v.end ());
183
+ }
184
+ return res;
185
+ }
186
+
178
187
static bool compatibleMachineType (COFFLinkerContext &ctx, MachineTypes mt) {
179
188
if (mt == IMAGE_FILE_MACHINE_UNKNOWN)
180
189
return true ;
@@ -1093,7 +1102,7 @@ void LinkerDriver::parseOrderFile(StringRef arg) {
1093
1102
1094
1103
// Get a list of all comdat sections for error checking.
1095
1104
DenseSet<StringRef> set;
1096
- for (Chunk *c : ctx.symtab .getChunks ())
1105
+ for (Chunk *c : ctx.driver .getChunks ())
1097
1106
if (auto *sec = dyn_cast<SectionChunk>(c))
1098
1107
if (sec->sym )
1099
1108
set.insert (sec->sym ->getName ());
Original file line number Diff line number Diff line change @@ -94,6 +94,9 @@ class LinkerDriver {
94
94
95
95
void enqueuePath (StringRef path, bool wholeArchive, bool lazy);
96
96
97
+ // Returns a list of chunks of selected symbols.
98
+ std::vector<Chunk *> getChunks () const ;
99
+
97
100
std::unique_ptr<llvm::TarWriter> tar; // for /linkrepro
98
101
99
102
void pullArm64ECIcallHelper ();
Original file line number Diff line number Diff line change @@ -264,7 +264,7 @@ void ICF::run() {
264
264
265
265
// Collect only mergeable sections and group by hash value.
266
266
uint32_t nextId = 1 ;
267
- for (Chunk *c : ctx.symtab .getChunks ()) {
267
+ for (Chunk *c : ctx.driver .getChunks ()) {
268
268
if (auto *sc = dyn_cast<SectionChunk>(c)) {
269
269
if (isEligible (sc))
270
270
chunks.push_back (sc);
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ void markLive(COFFLinkerContext &ctx) {
31
31
// COMDAT section chunks are dead by default. Add non-COMDAT chunks. Do not
32
32
// traverse DWARF sections. They are live, but they should not keep other
33
33
// sections alive.
34
- for (Chunk *c : ctx.symtab .getChunks ())
34
+ for (Chunk *c : ctx.driver .getChunks ())
35
35
if (auto *sc = dyn_cast<SectionChunk>(c))
36
36
if (sc->live && !sc->isDWARF ())
37
37
worklist.push_back (sc);
Original file line number Diff line number Diff line change @@ -945,15 +945,6 @@ void SymbolTable::addLibcall(StringRef name) {
945
945
}
946
946
}
947
947
948
- std::vector<Chunk *> SymbolTable::getChunks () const {
949
- std::vector<Chunk *> res;
950
- for (ObjFile *file : ctx.objFileInstances ) {
951
- ArrayRef<Chunk *> v = file->getChunks ();
952
- res.insert (res.end (), v.begin (), v.end ());
953
- }
954
- return res;
955
- }
956
-
957
948
Symbol *SymbolTable::find (StringRef name) const {
958
949
return symMap.lookup (CachedHashStringRef (name));
959
950
}
Original file line number Diff line number Diff line change @@ -67,9 +67,6 @@ class SymbolTable {
67
67
void loadMinGWSymbols ();
68
68
bool handleMinGWAutomaticImport (Symbol *sym, StringRef name);
69
69
70
- // Returns a list of chunks of selected symbols.
71
- std::vector<Chunk *> getChunks () const ;
72
-
73
70
// Returns a symbol for a given name. Returns a nullptr if not found.
74
71
Symbol *find (StringRef name) const ;
75
72
Symbol *findUnderscore (StringRef name) const ;
Original file line number Diff line number Diff line change @@ -1077,7 +1077,7 @@ void Writer::createSections() {
1077
1077
dtorsSec = createSection (" .dtors" , data | r | w);
1078
1078
1079
1079
// Then bin chunks by name and output characteristics.
1080
- for (Chunk *c : ctx.symtab .getChunks ()) {
1080
+ for (Chunk *c : ctx.driver .getChunks ()) {
1081
1081
auto *sc = dyn_cast<SectionChunk>(c);
1082
1082
if (sc && !sc->live ) {
1083
1083
if (ctx.config .verbose )
@@ -2219,7 +2219,7 @@ void Writer::createECChunks() {
2219
2219
void Writer::createRuntimePseudoRelocs () {
2220
2220
std::vector<RuntimePseudoReloc> rels;
2221
2221
2222
- for (Chunk *c : ctx.symtab .getChunks ()) {
2222
+ for (Chunk *c : ctx.driver .getChunks ()) {
2223
2223
auto *sc = dyn_cast<SectionChunk>(c);
2224
2224
if (!sc || !sc->live )
2225
2225
continue ;
You can’t perform that action at this time.
0 commit comments