[ELF] Rename fetch to extract
The canonical term is "extract" (GNU ld documentation, Solaris's `-z *extract`
options). Avoid inventing a term and match --why-extract. (ld64 prefers "load"
but the word is overloaded too much)
Mostly MFC, except for --help messages and the header row in
--print-archive-stats output.
diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp
index 5f95a1b..da3ade1 100644
--- a/lld/ELF/Symbols.cpp
+++ b/lld/ELF/Symbols.cpp
@@ -256,18 +256,18 @@
verstr);
}
-void Symbol::fetch() const {
+void Symbol::extract() const {
if (auto *sym = dyn_cast<LazyArchive>(this)) {
- cast<ArchiveFile>(sym->file)->fetch(sym->sym);
+ cast<ArchiveFile>(sym->file)->extract(sym->sym);
return;
}
if (auto *sym = dyn_cast<LazyObject>(this)) {
- dyn_cast<LazyObjFile>(sym->file)->fetch();
+ dyn_cast<LazyObjFile>(sym->file)->extract();
return;
}
- llvm_unreachable("Symbol::fetch() is called on a non-lazy symbol");
+ llvm_unreachable("Symbol::extract() is called on a non-lazy symbol");
}
MemoryBufferRef LazyArchive::getMemberBuffer() {
@@ -478,8 +478,8 @@
printTraceSymbol(&other);
if (isLazy()) {
- // An undefined weak will not fetch archive members. See comment on Lazy in
- // Symbols.h for the details.
+ // An undefined weak will not extract archive members. See comment on Lazy
+ // in Symbols.h for the details.
if (other.binding == STB_WEAK) {
binding = STB_WEAK;
type = other.type;
@@ -489,9 +489,9 @@
// Do extra check for --warn-backrefs.
//
// --warn-backrefs is an option to prevent an undefined reference from
- // fetching an archive member written earlier in the command line. It can be
- // used to keep compatibility with GNU linkers to some degree.
- // I'll explain the feature and why you may find it useful in this comment.
+ // extracting an archive member written earlier in the command line. It can
+ // be used to keep compatibility with GNU linkers to some degree. I'll
+ // explain the feature and why you may find it useful in this comment.
//
// lld's symbol resolution semantics is more relaxed than traditional Unix
// linkers. For example,
@@ -538,7 +538,7 @@
// group assignment rule simulates the traditional linker's semantics.
bool backref = config->warnBackrefs && other.file &&
file->groupId < other.file->groupId;
- fetch();
+ extract();
if (!config->whyExtract.empty())
recordWhyExtract(other.file, *file, *this);
@@ -712,23 +712,23 @@
static void replaceCommon(Symbol &oldSym, const LazyT &newSym) {
backwardReferences.erase(&oldSym);
oldSym.replace(newSym);
- newSym.fetch();
+ newSym.extract();
}
template <class LazyT> void Symbol::resolveLazy(const LazyT &other) {
// For common objects, we want to look for global or weak definitions that
- // should be fetched as the canonical definition instead.
+ // should be extracted as the canonical definition instead.
if (isCommon() && elf::config->fortranCommon) {
if (auto *laSym = dyn_cast<LazyArchive>(&other)) {
ArchiveFile *archive = cast<ArchiveFile>(laSym->file);
const Archive::Symbol &archiveSym = laSym->sym;
- if (archive->shouldFetchForCommon(archiveSym)) {
+ if (archive->shouldExtractForCommon(archiveSym)) {
replaceCommon(*this, other);
return;
}
} else if (auto *loSym = dyn_cast<LazyObject>(&other)) {
LazyObjFile *obj = cast<LazyObjFile>(loSym->file);
- if (obj->shouldFetchForCommon(loSym->getName())) {
+ if (obj->shouldExtractForCommon(loSym->getName())) {
replaceCommon(*this, other);
return;
}
@@ -742,7 +742,7 @@
return;
}
- // An undefined weak will not fetch archive members. See comment on Lazy in
+ // An undefined weak will not extract archive members. See comment on Lazy in
// Symbols.h for the details.
if (isWeak()) {
uint8_t ty = type;
@@ -753,7 +753,7 @@
}
const InputFile *oldFile = file;
- other.fetch();
+ other.extract();
if (!config->whyExtract.empty())
recordWhyExtract(oldFile, *file, *this);
}