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() {
175175 return getMachineArchType (ctx.config .machine );
176176}
177177
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+
178187static bool compatibleMachineType (COFFLinkerContext &ctx, MachineTypes mt) {
179188 if (mt == IMAGE_FILE_MACHINE_UNKNOWN)
180189 return true ;
@@ -1093,7 +1102,7 @@ void LinkerDriver::parseOrderFile(StringRef arg) {
10931102
10941103 // Get a list of all comdat sections for error checking.
10951104 DenseSet<StringRef> set;
1096- for (Chunk *c : ctx.symtab .getChunks ())
1105+ for (Chunk *c : ctx.driver .getChunks ())
10971106 if (auto *sec = dyn_cast<SectionChunk>(c))
10981107 if (sec->sym )
10991108 set.insert (sec->sym ->getName ());
Original file line number Diff line number Diff line change @@ -94,6 +94,9 @@ class LinkerDriver {
9494
9595 void enqueuePath (StringRef path, bool wholeArchive, bool lazy);
9696
97+ // Returns a list of chunks of selected symbols.
98+ std::vector<Chunk *> getChunks () const ;
99+
97100 std::unique_ptr<llvm::TarWriter> tar; // for /linkrepro
98101
99102 void pullArm64ECIcallHelper ();
Original file line number Diff line number Diff line change @@ -264,7 +264,7 @@ void ICF::run() {
264264
265265 // Collect only mergeable sections and group by hash value.
266266 uint32_t nextId = 1 ;
267- for (Chunk *c : ctx.symtab .getChunks ()) {
267+ for (Chunk *c : ctx.driver .getChunks ()) {
268268 if (auto *sc = dyn_cast<SectionChunk>(c)) {
269269 if (isEligible (sc))
270270 chunks.push_back (sc);
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ void markLive(COFFLinkerContext &ctx) {
3131 // COMDAT section chunks are dead by default. Add non-COMDAT chunks. Do not
3232 // traverse DWARF sections. They are live, but they should not keep other
3333 // sections alive.
34- for (Chunk *c : ctx.symtab .getChunks ())
34+ for (Chunk *c : ctx.driver .getChunks ())
3535 if (auto *sc = dyn_cast<SectionChunk>(c))
3636 if (sc->live && !sc->isDWARF ())
3737 worklist.push_back (sc);
Original file line number Diff line number Diff line change @@ -945,15 +945,6 @@ void SymbolTable::addLibcall(StringRef name) {
945945 }
946946}
947947
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-
957948Symbol *SymbolTable::find (StringRef name) const {
958949 return symMap.lookup (CachedHashStringRef (name));
959950}
Original file line number Diff line number Diff line change @@ -67,9 +67,6 @@ class SymbolTable {
6767 void loadMinGWSymbols ();
6868 bool handleMinGWAutomaticImport (Symbol *sym, StringRef name);
6969
70- // Returns a list of chunks of selected symbols.
71- std::vector<Chunk *> getChunks () const ;
72-
7370 // Returns a symbol for a given name. Returns a nullptr if not found.
7471 Symbol *find (StringRef name) const ;
7572 Symbol *findUnderscore (StringRef name) const ;
Original file line number Diff line number Diff line change @@ -1077,7 +1077,7 @@ void Writer::createSections() {
10771077 dtorsSec = createSection (" .dtors" , data | r | w);
10781078
10791079 // Then bin chunks by name and output characteristics.
1080- for (Chunk *c : ctx.symtab .getChunks ()) {
1080+ for (Chunk *c : ctx.driver .getChunks ()) {
10811081 auto *sc = dyn_cast<SectionChunk>(c);
10821082 if (sc && !sc->live ) {
10831083 if (ctx.config .verbose )
@@ -2219,7 +2219,7 @@ void Writer::createECChunks() {
22192219void Writer::createRuntimePseudoRelocs () {
22202220 std::vector<RuntimePseudoReloc> rels;
22212221
2222- for (Chunk *c : ctx.symtab .getChunks ()) {
2222+ for (Chunk *c : ctx.driver .getChunks ()) {
22232223 auto *sc = dyn_cast<SectionChunk>(c);
22242224 if (!sc || !sc->live )
22252225 continue ;
You can’t perform that action at this time.
0 commit comments