error(Twine("duplicate symbol: ") + Name);
}
-template <class ELFT> std::vector<Chunk *> SymbolTable<ELFT>::getChunks() {
- std::vector<Chunk *> Res;
- for (std::unique_ptr<ObjectFile<ELFT>> &File : ObjectFiles) {
- ArrayRef<Chunk *> V = File->getChunks();
- Res.insert(Res.end(), V.begin(), V.end());
- }
- return Res;
-}
-
namespace lld {
namespace elf2 {
template class SymbolTable<object::ELF32LE>;
// Print an error message on undefined symbols.
void reportRemainingUndefines();
- // Returns a list of chunks of selected symbols.
- std::vector<Chunk *> getChunks();
-
// The writer needs to infer the machine type from the object files.
std::vector<std::unique_ptr<ObjectFile<ELFT>>> ObjectFiles;
// Create output section objects and add them to OutputSections.
template <class ELFT> void Writer<ELFT>::createSections() {
SmallDenseMap<StringRef, OutputSection *> Map;
- for (Chunk *C : Symtab->getChunks()) {
- OutputSection *&Sec = Map[C->getSectionName()];
- if (!Sec) {
- Sec = new (CAlloc.Allocate()) OutputSection(C->getSectionName());
- OutputSections.push_back(Sec);
+ for (std::unique_ptr<ObjectFile<ELFT>> &File : Symtab->ObjectFiles) {
+ for (Chunk *C : File->getChunks()) {
+ OutputSection *&Sec = Map[C->getSectionName()];
+ if (!Sec) {
+ Sec = new (CAlloc.Allocate()) OutputSection(C->getSectionName());
+ OutputSections.push_back(Sec);
+ }
+ Sec->addChunk<ELFT>(C);
}
- Sec->addChunk<ELFT>(C);
}
}