forked from OSchip/llvm-project
[lld] Update uses of DEBUG macro to LLVM_DEBUG.
The DEBUG() macro is very generic so it might clash with other projects. The renaming was done as follows: - git grep -l 'DEBUG' | xargs sed -i 's/\bDEBUG\s\?(/LLVM_DEBUG(/g' - git diff -U0 master | ../clang/tools/clang-format/clang-format-diff.py -i -p1 -style LLVM Differential Revision: https://reviews.llvm.org/D44977 llvm-svn: 332351
This commit is contained in:
parent
3538b39ed5
commit
e7245b429b
|
@ -1068,7 +1068,7 @@ bool parse(llvm::ArrayRef<const char *> args, MachOLinkingContext &ctx,
|
|||
}
|
||||
|
||||
// Parse the LLVM options before we process files in case the file handling
|
||||
// makes use of things like DEBUG().
|
||||
// makes use of things like LLVM_DEBUG().
|
||||
parseLLVMOptions(ctx);
|
||||
|
||||
// Handle input files and sectcreate.
|
||||
|
|
|
@ -282,7 +282,7 @@ public:
|
|||
|
||||
private:
|
||||
llvm::Error perform(SimpleFile &mergedFile) override {
|
||||
DEBUG(llvm::dbgs() << "MachO Compact Unwind pass\n");
|
||||
LLVM_DEBUG(llvm::dbgs() << "MachO Compact Unwind pass\n");
|
||||
|
||||
std::map<const Atom *, CompactUnwindEntry> unwindLocs;
|
||||
std::map<const Atom *, const Atom *> dwarfFrames;
|
||||
|
@ -319,7 +319,7 @@ private:
|
|||
|
||||
// Finally, we can start creating pages based on these entries.
|
||||
|
||||
DEBUG(llvm::dbgs() << " Splitting entries into pages\n");
|
||||
LLVM_DEBUG(llvm::dbgs() << " Splitting entries into pages\n");
|
||||
// FIXME: we split the entries into pages naively: lots of 4k pages followed
|
||||
// by a small one. ld64 tried to minimize space and align them to real 4k
|
||||
// boundaries. That might be worth doing, or perhaps we could perform some
|
||||
|
@ -336,11 +336,13 @@ private:
|
|||
pages.back().entries = remainingInfos.slice(0, entriesInPage);
|
||||
remainingInfos = remainingInfos.slice(entriesInPage);
|
||||
|
||||
DEBUG(llvm::dbgs()
|
||||
<< " Page from " << pages.back().entries[0].rangeStart->name()
|
||||
<< " to " << pages.back().entries.back().rangeStart->name() << " + "
|
||||
<< llvm::format("0x%x", pages.back().entries.back().rangeLength)
|
||||
<< " has " << entriesInPage << " entries\n");
|
||||
LLVM_DEBUG(llvm::dbgs()
|
||||
<< " Page from "
|
||||
<< pages.back().entries[0].rangeStart->name() << " to "
|
||||
<< pages.back().entries.back().rangeStart->name() << " + "
|
||||
<< llvm::format("0x%x",
|
||||
pages.back().entries.back().rangeLength)
|
||||
<< " has " << entriesInPage << " entries\n");
|
||||
} while (!remainingInfos.empty());
|
||||
|
||||
auto *unwind = new (_file.allocator())
|
||||
|
@ -360,7 +362,7 @@ private:
|
|||
const SimpleFile &mergedFile,
|
||||
std::map<const Atom *, CompactUnwindEntry> &unwindLocs,
|
||||
std::vector<const Atom *> &personalities, uint32_t &numLSDAs) {
|
||||
DEBUG(llvm::dbgs() << " Collecting __compact_unwind entries\n");
|
||||
LLVM_DEBUG(llvm::dbgs() << " Collecting __compact_unwind entries\n");
|
||||
|
||||
for (const DefinedAtom *atom : mergedFile.defined()) {
|
||||
if (atom->contentType() != DefinedAtom::typeCompactUnwindInfo)
|
||||
|
@ -369,14 +371,15 @@ private:
|
|||
auto unwindEntry = extractCompactUnwindEntry(atom);
|
||||
unwindLocs.insert(std::make_pair(unwindEntry.rangeStart, unwindEntry));
|
||||
|
||||
DEBUG(llvm::dbgs() << " Entry for " << unwindEntry.rangeStart->name()
|
||||
<< ", encoding="
|
||||
<< llvm::format("0x%08x", unwindEntry.encoding));
|
||||
LLVM_DEBUG(llvm::dbgs() << " Entry for "
|
||||
<< unwindEntry.rangeStart->name() << ", encoding="
|
||||
<< llvm::format("0x%08x", unwindEntry.encoding));
|
||||
if (unwindEntry.personalityFunction)
|
||||
DEBUG(llvm::dbgs() << ", personality="
|
||||
<< unwindEntry.personalityFunction->name()
|
||||
<< ", lsdaLoc=" << unwindEntry.lsdaLocation->name());
|
||||
DEBUG(llvm::dbgs() << '\n');
|
||||
LLVM_DEBUG(llvm::dbgs()
|
||||
<< ", personality="
|
||||
<< unwindEntry.personalityFunction->name()
|
||||
<< ", lsdaLoc=" << unwindEntry.lsdaLocation->name());
|
||||
LLVM_DEBUG(llvm::dbgs() << '\n');
|
||||
|
||||
// Count number of LSDAs we see, since we need to know how big the index
|
||||
// will be while laying out the section.
|
||||
|
@ -454,7 +457,7 @@ private:
|
|||
const std::map<const Atom *, const Atom *> &dwarfFrames) {
|
||||
std::vector<CompactUnwindEntry> unwindInfos;
|
||||
|
||||
DEBUG(llvm::dbgs() << " Creating __unwind_info entries\n");
|
||||
LLVM_DEBUG(llvm::dbgs() << " Creating __unwind_info entries\n");
|
||||
// The final order in the __unwind_info section must be derived from the
|
||||
// order of typeCode atoms, since that's how they'll be put into the object
|
||||
// file eventually (yuck!).
|
||||
|
@ -465,10 +468,10 @@ private:
|
|||
unwindInfos.push_back(finalizeUnwindInfoEntryForAtom(
|
||||
atom, unwindLocs, personalities, dwarfFrames));
|
||||
|
||||
DEBUG(llvm::dbgs() << " Entry for " << atom->name()
|
||||
<< ", final encoding="
|
||||
<< llvm::format("0x%08x", unwindInfos.back().encoding)
|
||||
<< '\n');
|
||||
LLVM_DEBUG(llvm::dbgs()
|
||||
<< " Entry for " << atom->name() << ", final encoding="
|
||||
<< llvm::format("0x%08x", unwindInfos.back().encoding)
|
||||
<< '\n');
|
||||
}
|
||||
|
||||
return unwindInfos;
|
||||
|
|
|
@ -191,7 +191,7 @@ static bool compareAtomsSub(const LayoutPass::SortKey &lc,
|
|||
// Sort atoms by their ordinal overrides only if they fall in the same
|
||||
// chain.
|
||||
if (leftRoot == rightRoot) {
|
||||
DEBUG(reason = formatReason("override", lc._override, rc._override));
|
||||
LLVM_DEBUG(reason = formatReason("override", lc._override, rc._override));
|
||||
return lc._override < rc._override;
|
||||
}
|
||||
|
||||
|
@ -200,8 +200,8 @@ static bool compareAtomsSub(const LayoutPass::SortKey &lc,
|
|||
DefinedAtom::ContentPermissions rightPerms = rightRoot->permissions();
|
||||
|
||||
if (leftPerms != rightPerms) {
|
||||
DEBUG(reason =
|
||||
formatReason("contentPerms", (int)leftPerms, (int)rightPerms));
|
||||
LLVM_DEBUG(
|
||||
reason = formatReason("contentPerms", (int)leftPerms, (int)rightPerms));
|
||||
return leftPerms < rightPerms;
|
||||
}
|
||||
|
||||
|
@ -210,7 +210,8 @@ static bool compareAtomsSub(const LayoutPass::SortKey &lc,
|
|||
DefinedAtom::ContentType rightType = rightRoot->contentType();
|
||||
|
||||
if (leftType != rightType) {
|
||||
DEBUG(reason = formatReason("contentType", (int)leftType, (int)rightType));
|
||||
LLVM_DEBUG(reason =
|
||||
formatReason("contentType", (int)leftType, (int)rightType));
|
||||
return leftType < rightType;
|
||||
}
|
||||
|
||||
|
@ -226,8 +227,8 @@ static bool compareAtomsSub(const LayoutPass::SortKey &lc,
|
|||
const File *rightFile = &rightRoot->file();
|
||||
|
||||
if (leftFile != rightFile) {
|
||||
DEBUG(reason = formatReason(".o order", (int)leftFile->ordinal(),
|
||||
(int)rightFile->ordinal()));
|
||||
LLVM_DEBUG(reason = formatReason(".o order", (int)leftFile->ordinal(),
|
||||
(int)rightFile->ordinal()));
|
||||
return leftFile->ordinal() < rightFile->ordinal();
|
||||
}
|
||||
|
||||
|
@ -236,8 +237,8 @@ static bool compareAtomsSub(const LayoutPass::SortKey &lc,
|
|||
uint64_t rightOrdinal = rightRoot->ordinal();
|
||||
|
||||
if (leftOrdinal != rightOrdinal) {
|
||||
DEBUG(reason = formatReason("ordinal", (int)leftRoot->ordinal(),
|
||||
(int)rightRoot->ordinal()));
|
||||
LLVM_DEBUG(reason = formatReason("ordinal", (int)leftRoot->ordinal(),
|
||||
(int)rightRoot->ordinal()));
|
||||
return leftOrdinal < rightOrdinal;
|
||||
}
|
||||
|
||||
|
@ -251,7 +252,7 @@ static bool compareAtoms(const LayoutPass::SortKey &lc,
|
|||
LayoutPass::SortOverride customSorter) {
|
||||
std::string reason;
|
||||
bool result = compareAtomsSub(lc, rc, customSorter, reason);
|
||||
DEBUG({
|
||||
LLVM_DEBUG({
|
||||
StringRef comp = result ? "<" : ">=";
|
||||
llvm::dbgs() << "Layout: '" << lc._atom.get()->name()
|
||||
<< "' " << comp << " '"
|
||||
|
@ -441,7 +442,7 @@ void LayoutPass::undecorate(File::AtomRange<DefinedAtom> &atomRange,
|
|||
|
||||
/// Perform the actual pass
|
||||
llvm::Error LayoutPass::perform(SimpleFile &mergedFile) {
|
||||
DEBUG(llvm::dbgs() << "******** Laying out atoms:\n");
|
||||
LLVM_DEBUG(llvm::dbgs() << "******** Laying out atoms:\n");
|
||||
// sort the atoms
|
||||
ScopedTask task(getDefaultDomain(), "LayoutPass");
|
||||
File::AtomRange<DefinedAtom> atomRange = mergedFile.defined();
|
||||
|
@ -450,12 +451,12 @@ llvm::Error LayoutPass::perform(SimpleFile &mergedFile) {
|
|||
buildFollowOnTable(atomRange);
|
||||
|
||||
// Check the structure of followon graph if running in debug mode.
|
||||
DEBUG(checkFollowonChain(atomRange));
|
||||
LLVM_DEBUG(checkFollowonChain(atomRange));
|
||||
|
||||
// Build override maps
|
||||
buildOrdinalOverrideMap(atomRange);
|
||||
|
||||
DEBUG({
|
||||
LLVM_DEBUG({
|
||||
llvm::dbgs() << "unsorted atoms:\n";
|
||||
printDefinedAtoms(atomRange);
|
||||
});
|
||||
|
@ -465,15 +466,15 @@ llvm::Error LayoutPass::perform(SimpleFile &mergedFile) {
|
|||
[&](const LayoutPass::SortKey &l, const LayoutPass::SortKey &r) -> bool {
|
||||
return compareAtoms(l, r, _customSorter);
|
||||
});
|
||||
DEBUG(checkTransitivity(vec, _customSorter));
|
||||
LLVM_DEBUG(checkTransitivity(vec, _customSorter));
|
||||
undecorate(atomRange, vec);
|
||||
|
||||
DEBUG({
|
||||
LLVM_DEBUG({
|
||||
llvm::dbgs() << "sorted atoms:\n";
|
||||
printDefinedAtoms(atomRange);
|
||||
});
|
||||
|
||||
DEBUG(llvm::dbgs() << "******** Finished laying out atoms\n");
|
||||
LLVM_DEBUG(llvm::dbgs() << "******** Finished laying out atoms\n");
|
||||
return llvm::Error::success();
|
||||
}
|
||||
|
||||
|
|
|
@ -1431,8 +1431,8 @@ llvm::Error
|
|||
normalizedObjectToAtoms(MachOFile *file,
|
||||
const NormalizedFile &normalizedFile,
|
||||
bool copyRefs) {
|
||||
DEBUG(llvm::dbgs() << "******** Normalizing file to atoms: "
|
||||
<< file->path() << "\n");
|
||||
LLVM_DEBUG(llvm::dbgs() << "******** Normalizing file to atoms: "
|
||||
<< file->path() << "\n");
|
||||
bool scatterable = ((normalizedFile.flags & MH_SUBSECTIONS_VIA_SYMBOLS) != 0);
|
||||
|
||||
// Create atoms from each section.
|
||||
|
|
|
@ -103,16 +103,17 @@ void InputChunk::writeTo(uint8_t *Buf) const {
|
|||
verifyRelocTargets();
|
||||
#endif
|
||||
|
||||
DEBUG(dbgs() << "applying relocations: " << getName()
|
||||
<< " count=" << Relocations.size() << "\n");
|
||||
LLVM_DEBUG(dbgs() << "applying relocations: " << getName()
|
||||
<< " count=" << Relocations.size() << "\n");
|
||||
int32_t Off = OutputOffset - getInputSectionOffset();
|
||||
|
||||
for (const WasmRelocation &Rel : Relocations) {
|
||||
uint8_t *Loc = Buf + Rel.Offset + Off;
|
||||
uint32_t Value = File->calcNewValue(Rel);
|
||||
DEBUG(dbgs() << "apply reloc: type=" << ReloctTypeToString(Rel.Type)
|
||||
<< " addend=" << Rel.Addend << " index=" << Rel.Index
|
||||
<< " value=" << Value << " offset=" << Rel.Offset << "\n");
|
||||
LLVM_DEBUG(dbgs() << "apply reloc: type=" << ReloctTypeToString(Rel.Type)
|
||||
<< " addend=" << Rel.Addend << " index=" << Rel.Index
|
||||
<< " value=" << Value << " offset=" << Rel.Offset
|
||||
<< "\n");
|
||||
|
||||
switch (Rel.Type) {
|
||||
case R_WEBASSEMBLY_TYPE_INDEX_LEB:
|
||||
|
@ -145,8 +146,8 @@ void InputChunk::writeRelocations(raw_ostream &OS) const {
|
|||
return;
|
||||
|
||||
int32_t Off = OutputOffset - getInputSectionOffset();
|
||||
DEBUG(dbgs() << "writeRelocations: " << File->getName()
|
||||
<< " offset=" << Twine(Off) << "\n");
|
||||
LLVM_DEBUG(dbgs() << "writeRelocations: " << File->getName()
|
||||
<< " offset=" << Twine(Off) << "\n");
|
||||
|
||||
for (const WasmRelocation &Rel : Relocations) {
|
||||
writeUleb128(OS, Rel.Type, "reloc type");
|
||||
|
@ -166,15 +167,15 @@ void InputChunk::writeRelocations(raw_ostream &OS) const {
|
|||
}
|
||||
|
||||
void InputFunction::setFunctionIndex(uint32_t Index) {
|
||||
DEBUG(dbgs() << "InputFunction::setFunctionIndex: " << getName() << " -> "
|
||||
<< Index << "\n");
|
||||
LLVM_DEBUG(dbgs() << "InputFunction::setFunctionIndex: " << getName()
|
||||
<< " -> " << Index << "\n");
|
||||
assert(!hasFunctionIndex());
|
||||
FunctionIndex = Index;
|
||||
}
|
||||
|
||||
void InputFunction::setTableIndex(uint32_t Index) {
|
||||
DEBUG(dbgs() << "InputFunction::setTableIndex: " << getName() << " -> "
|
||||
<< Index << "\n");
|
||||
LLVM_DEBUG(dbgs() << "InputFunction::setTableIndex: " << getName() << " -> "
|
||||
<< Index << "\n");
|
||||
assert(!hasTableIndex());
|
||||
TableIndex = Index;
|
||||
}
|
||||
|
|
|
@ -159,7 +159,7 @@ uint32_t ObjFile::calcNewValue(const WasmRelocation &Reloc) const {
|
|||
|
||||
void ObjFile::parse() {
|
||||
// Parse a memory buffer as a wasm file.
|
||||
DEBUG(dbgs() << "Parsing object: " << toString(this) << "\n");
|
||||
LLVM_DEBUG(dbgs() << "Parsing object: " << toString(this) << "\n");
|
||||
std::unique_ptr<Binary> Bin = CHECK(createBinary(MB), toString(this));
|
||||
|
||||
auto *Obj = dyn_cast<WasmObjectFile>(Bin.get());
|
||||
|
@ -339,7 +339,7 @@ Symbol *ObjFile::createUndefined(const WasmSymbol &Sym) {
|
|||
|
||||
void ArchiveFile::parse() {
|
||||
// Parse a MemoryBufferRef as an archive file.
|
||||
DEBUG(dbgs() << "Parsing library: " << toString(this) << "\n");
|
||||
LLVM_DEBUG(dbgs() << "Parsing library: " << toString(this) << "\n");
|
||||
File = CHECK(Archive::create(MB), toString(this));
|
||||
|
||||
// Read the symbol table to construct Lazy symbols.
|
||||
|
@ -348,7 +348,7 @@ void ArchiveFile::parse() {
|
|||
Symtab->addLazy(this, &Sym);
|
||||
++Count;
|
||||
}
|
||||
DEBUG(dbgs() << "Read " << Count << " symbols\n");
|
||||
LLVM_DEBUG(dbgs() << "Read " << Count << " symbols\n");
|
||||
}
|
||||
|
||||
void ArchiveFile::addMember(const Archive::Symbol *Sym) {
|
||||
|
@ -361,8 +361,8 @@ void ArchiveFile::addMember(const Archive::Symbol *Sym) {
|
|||
if (!Seen.insert(C.getChildOffset()).second)
|
||||
return;
|
||||
|
||||
DEBUG(dbgs() << "loading lazy: " << Sym->getName() << "\n");
|
||||
DEBUG(dbgs() << "from archive: " << toString(this) << "\n");
|
||||
LLVM_DEBUG(dbgs() << "loading lazy: " << Sym->getName() << "\n");
|
||||
LLVM_DEBUG(dbgs() << "from archive: " << toString(this) << "\n");
|
||||
|
||||
MemoryBufferRef MB =
|
||||
CHECK(C.getMemoryBufferRef(),
|
||||
|
|
|
@ -37,7 +37,7 @@ void lld::wasm::markLive() {
|
|||
if (!Config->GcSections)
|
||||
return;
|
||||
|
||||
DEBUG(dbgs() << "markLive\n");
|
||||
LLVM_DEBUG(dbgs() << "markLive\n");
|
||||
SmallVector<InputChunk *, 256> Q;
|
||||
|
||||
auto Enqueue = [&](Symbol *Sym) {
|
||||
|
|
|
@ -118,7 +118,7 @@ static void checkDataType(const Symbol *Existing, const InputFile *File) {
|
|||
DefinedFunction *SymbolTable::addSyntheticFunction(StringRef Name,
|
||||
uint32_t Flags,
|
||||
InputFunction *Function) {
|
||||
DEBUG(dbgs() << "addSyntheticFunction: " << Name << "\n");
|
||||
LLVM_DEBUG(dbgs() << "addSyntheticFunction: " << Name << "\n");
|
||||
assert(!find(Name));
|
||||
SyntheticFunctions.emplace_back(Function);
|
||||
return replaceSymbol<DefinedFunction>(insert(Name).first, Name, Flags,
|
||||
|
@ -127,14 +127,15 @@ DefinedFunction *SymbolTable::addSyntheticFunction(StringRef Name,
|
|||
|
||||
DefinedData *SymbolTable::addSyntheticDataSymbol(StringRef Name,
|
||||
uint32_t Flags) {
|
||||
DEBUG(dbgs() << "addSyntheticDataSymbol: " << Name << "\n");
|
||||
LLVM_DEBUG(dbgs() << "addSyntheticDataSymbol: " << Name << "\n");
|
||||
assert(!find(Name));
|
||||
return replaceSymbol<DefinedData>(insert(Name).first, Name, Flags);
|
||||
}
|
||||
|
||||
DefinedGlobal *SymbolTable::addSyntheticGlobal(StringRef Name, uint32_t Flags,
|
||||
InputGlobal *Global) {
|
||||
DEBUG(dbgs() << "addSyntheticGlobal: " << Name << " -> " << Global << "\n");
|
||||
LLVM_DEBUG(dbgs() << "addSyntheticGlobal: " << Name << " -> " << Global
|
||||
<< "\n");
|
||||
assert(!find(Name));
|
||||
SyntheticGlobals.emplace_back(Global);
|
||||
return replaceSymbol<DefinedGlobal>(insert(Name).first, Name, Flags, nullptr,
|
||||
|
@ -145,20 +146,20 @@ static bool shouldReplace(const Symbol *Existing, InputFile *NewFile,
|
|||
uint32_t NewFlags) {
|
||||
// If existing symbol is undefined, replace it.
|
||||
if (!Existing->isDefined()) {
|
||||
DEBUG(dbgs() << "resolving existing undefined symbol: "
|
||||
<< Existing->getName() << "\n");
|
||||
LLVM_DEBUG(dbgs() << "resolving existing undefined symbol: "
|
||||
<< Existing->getName() << "\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
// Now we have two defined symbols. If the new one is weak, we can ignore it.
|
||||
if ((NewFlags & WASM_SYMBOL_BINDING_MASK) == WASM_SYMBOL_BINDING_WEAK) {
|
||||
DEBUG(dbgs() << "existing symbol takes precedence\n");
|
||||
LLVM_DEBUG(dbgs() << "existing symbol takes precedence\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
// If the existing symbol is weak, we should replace it.
|
||||
if (Existing->isWeak()) {
|
||||
DEBUG(dbgs() << "replacing existing weak symbol\n");
|
||||
LLVM_DEBUG(dbgs() << "replacing existing weak symbol\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -172,7 +173,7 @@ static bool shouldReplace(const Symbol *Existing, InputFile *NewFile,
|
|||
Symbol *SymbolTable::addDefinedFunction(StringRef Name, uint32_t Flags,
|
||||
InputFile *File,
|
||||
InputFunction *Function) {
|
||||
DEBUG(dbgs() << "addDefinedFunction: " << Name << "\n");
|
||||
LLVM_DEBUG(dbgs() << "addDefinedFunction: " << Name << "\n");
|
||||
Symbol *S;
|
||||
bool WasInserted;
|
||||
std::tie(S, WasInserted) = insert(Name);
|
||||
|
@ -192,7 +193,8 @@ Symbol *SymbolTable::addDefinedFunction(StringRef Name, uint32_t Flags,
|
|||
Symbol *SymbolTable::addDefinedData(StringRef Name, uint32_t Flags,
|
||||
InputFile *File, InputSegment *Segment,
|
||||
uint32_t Address, uint32_t Size) {
|
||||
DEBUG(dbgs() << "addDefinedData:" << Name << " addr:" << Address << "\n");
|
||||
LLVM_DEBUG(dbgs() << "addDefinedData:" << Name << " addr:" << Address
|
||||
<< "\n");
|
||||
Symbol *S;
|
||||
bool WasInserted;
|
||||
std::tie(S, WasInserted) = insert(Name);
|
||||
|
@ -211,7 +213,7 @@ Symbol *SymbolTable::addDefinedData(StringRef Name, uint32_t Flags,
|
|||
|
||||
Symbol *SymbolTable::addDefinedGlobal(StringRef Name, uint32_t Flags,
|
||||
InputFile *File, InputGlobal *Global) {
|
||||
DEBUG(dbgs() << "addDefinedGlobal:" << Name << "\n");
|
||||
LLVM_DEBUG(dbgs() << "addDefinedGlobal:" << Name << "\n");
|
||||
Symbol *S;
|
||||
bool WasInserted;
|
||||
std::tie(S, WasInserted) = insert(Name);
|
||||
|
@ -231,7 +233,7 @@ Symbol *SymbolTable::addDefinedGlobal(StringRef Name, uint32_t Flags,
|
|||
Symbol *SymbolTable::addUndefinedFunction(StringRef Name, uint32_t Flags,
|
||||
InputFile *File,
|
||||
const WasmSignature *Sig) {
|
||||
DEBUG(dbgs() << "addUndefinedFunction: " << Name << "\n");
|
||||
LLVM_DEBUG(dbgs() << "addUndefinedFunction: " << Name << "\n");
|
||||
|
||||
Symbol *S;
|
||||
bool WasInserted;
|
||||
|
@ -248,7 +250,7 @@ Symbol *SymbolTable::addUndefinedFunction(StringRef Name, uint32_t Flags,
|
|||
|
||||
Symbol *SymbolTable::addUndefinedData(StringRef Name, uint32_t Flags,
|
||||
InputFile *File) {
|
||||
DEBUG(dbgs() << "addUndefinedData: " << Name << "\n");
|
||||
LLVM_DEBUG(dbgs() << "addUndefinedData: " << Name << "\n");
|
||||
|
||||
Symbol *S;
|
||||
bool WasInserted;
|
||||
|
@ -266,7 +268,7 @@ Symbol *SymbolTable::addUndefinedData(StringRef Name, uint32_t Flags,
|
|||
Symbol *SymbolTable::addUndefinedGlobal(StringRef Name, uint32_t Flags,
|
||||
InputFile *File,
|
||||
const WasmGlobalType *Type) {
|
||||
DEBUG(dbgs() << "addUndefinedGlobal: " << Name << "\n");
|
||||
LLVM_DEBUG(dbgs() << "addUndefinedGlobal: " << Name << "\n");
|
||||
|
||||
Symbol *S;
|
||||
bool WasInserted;
|
||||
|
@ -282,7 +284,7 @@ Symbol *SymbolTable::addUndefinedGlobal(StringRef Name, uint32_t Flags,
|
|||
}
|
||||
|
||||
void SymbolTable::addLazy(ArchiveFile *File, const Archive::Symbol *Sym) {
|
||||
DEBUG(dbgs() << "addLazy: " << Sym->getName() << "\n");
|
||||
LLVM_DEBUG(dbgs() << "addLazy: " << Sym->getName() << "\n");
|
||||
StringRef Name = Sym->getName();
|
||||
|
||||
Symbol *S;
|
||||
|
@ -296,7 +298,7 @@ void SymbolTable::addLazy(ArchiveFile *File, const Archive::Symbol *Sym) {
|
|||
|
||||
// If there is an existing undefined symbol, load a new one from the archive.
|
||||
if (S->isUndefined()) {
|
||||
DEBUG(dbgs() << "replacing existing undefined\n");
|
||||
LLVM_DEBUG(dbgs() << "replacing existing undefined\n");
|
||||
File->addMember(Sym);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,7 +71,8 @@ uint32_t Symbol::getOutputSymbolIndex() const {
|
|||
}
|
||||
|
||||
void Symbol::setOutputSymbolIndex(uint32_t Index) {
|
||||
DEBUG(dbgs() << "setOutputSymbolIndex " << Name << " -> " << Index << "\n");
|
||||
LLVM_DEBUG(dbgs() << "setOutputSymbolIndex " << Name << " -> " << Index
|
||||
<< "\n");
|
||||
assert(OutputSymbolIndex == INVALID_INDEX);
|
||||
OutputSymbolIndex = Index;
|
||||
}
|
||||
|
@ -89,7 +90,7 @@ bool Symbol::isHidden() const {
|
|||
}
|
||||
|
||||
void Symbol::setHidden(bool IsHidden) {
|
||||
DEBUG(dbgs() << "setHidden: " << Name << " -> " << IsHidden << "\n");
|
||||
LLVM_DEBUG(dbgs() << "setHidden: " << Name << " -> " << IsHidden << "\n");
|
||||
Flags &= ~WASM_SYMBOL_VISIBILITY_MASK;
|
||||
if (IsHidden)
|
||||
Flags |= WASM_SYMBOL_VISIBILITY_HIDDEN;
|
||||
|
@ -105,7 +106,7 @@ uint32_t FunctionSymbol::getFunctionIndex() const {
|
|||
}
|
||||
|
||||
void FunctionSymbol::setFunctionIndex(uint32_t Index) {
|
||||
DEBUG(dbgs() << "setFunctionIndex " << Name << " -> " << Index << "\n");
|
||||
LLVM_DEBUG(dbgs() << "setFunctionIndex " << Name << " -> " << Index << "\n");
|
||||
assert(FunctionIndex == INVALID_INDEX);
|
||||
FunctionIndex = Index;
|
||||
}
|
||||
|
@ -137,7 +138,7 @@ void FunctionSymbol::setTableIndex(uint32_t Index) {
|
|||
F->Function->setTableIndex(Index);
|
||||
return;
|
||||
}
|
||||
DEBUG(dbgs() << "setTableIndex " << Name << " -> " << Index << "\n");
|
||||
LLVM_DEBUG(dbgs() << "setTableIndex " << Name << " -> " << Index << "\n");
|
||||
assert(TableIndex == INVALID_INDEX);
|
||||
TableIndex = Index;
|
||||
}
|
||||
|
@ -149,25 +150,25 @@ DefinedFunction::DefinedFunction(StringRef Name, uint32_t Flags, InputFile *F,
|
|||
Function(Function) {}
|
||||
|
||||
uint32_t DefinedData::getVirtualAddress() const {
|
||||
DEBUG(dbgs() << "getVirtualAddress: " << getName() << "\n");
|
||||
LLVM_DEBUG(dbgs() << "getVirtualAddress: " << getName() << "\n");
|
||||
if (Segment)
|
||||
return Segment->OutputSeg->StartVA + Segment->OutputSegmentOffset + Offset;
|
||||
return Offset;
|
||||
}
|
||||
|
||||
void DefinedData::setVirtualAddress(uint32_t Value) {
|
||||
DEBUG(dbgs() << "setVirtualAddress " << Name << " -> " << Value << "\n");
|
||||
LLVM_DEBUG(dbgs() << "setVirtualAddress " << Name << " -> " << Value << "\n");
|
||||
assert(!Segment);
|
||||
Offset = Value;
|
||||
}
|
||||
|
||||
uint32_t DefinedData::getOutputSegmentOffset() const {
|
||||
DEBUG(dbgs() << "getOutputSegmentOffset: " << getName() << "\n");
|
||||
LLVM_DEBUG(dbgs() << "getOutputSegmentOffset: " << getName() << "\n");
|
||||
return Segment->OutputSegmentOffset + Offset;
|
||||
}
|
||||
|
||||
uint32_t DefinedData::getOutputSegmentIndex() const {
|
||||
DEBUG(dbgs() << "getOutputSegmentIndex: " << getName() << "\n");
|
||||
LLVM_DEBUG(dbgs() << "getOutputSegmentIndex: " << getName() << "\n");
|
||||
return Segment->OutputSeg->Index;
|
||||
}
|
||||
|
||||
|
@ -179,7 +180,7 @@ uint32_t GlobalSymbol::getGlobalIndex() const {
|
|||
}
|
||||
|
||||
void GlobalSymbol::setGlobalIndex(uint32_t Index) {
|
||||
DEBUG(dbgs() << "setGlobalIndex " << Name << " -> " << Index << "\n");
|
||||
LLVM_DEBUG(dbgs() << "setGlobalIndex " << Name << " -> " << Index << "\n");
|
||||
assert(GlobalIndex == INVALID_INDEX);
|
||||
GlobalIndex = Index;
|
||||
}
|
||||
|
@ -197,14 +198,14 @@ DefinedGlobal::DefinedGlobal(StringRef Name, uint32_t Flags, InputFile *File,
|
|||
Global(Global) {}
|
||||
|
||||
uint32_t SectionSymbol::getOutputSectionIndex() const {
|
||||
DEBUG(dbgs() << "getOutputSectionIndex: " << getName() << "\n");
|
||||
LLVM_DEBUG(dbgs() << "getOutputSectionIndex: " << getName() << "\n");
|
||||
assert(OutputSectionIndex != INVALID_INDEX);
|
||||
return OutputSectionIndex;
|
||||
}
|
||||
|
||||
void SectionSymbol::setOutputSectionIndex(uint32_t Index) {
|
||||
DEBUG(dbgs() << "setOutputSectionIndex: " << getName() << " -> " << Index
|
||||
<< "\n");
|
||||
LLVM_DEBUG(dbgs() << "setOutputSectionIndex: " << getName() << " -> " << Index
|
||||
<< "\n");
|
||||
assert(Index != INVALID_INDEX);
|
||||
OutputSectionIndex = Index;
|
||||
}
|
||||
|
|
|
@ -304,7 +304,7 @@ void Writer::createCustomSections() {
|
|||
P->second->setOutputSectionIndex(SectionIndex);
|
||||
}
|
||||
|
||||
DEBUG(dbgs() << "createCustomSection: " << Name << "\n");
|
||||
LLVM_DEBUG(dbgs() << "createCustomSection: " << Name << "\n");
|
||||
OutputSections.push_back(make<CustomSection>(Name, Pair.second));
|
||||
}
|
||||
}
|
||||
|
@ -716,7 +716,7 @@ void Writer::calculateImports() {
|
|||
if (!Sym->isLive())
|
||||
continue;
|
||||
|
||||
DEBUG(dbgs() << "import: " << Sym->getName() << "\n");
|
||||
LLVM_DEBUG(dbgs() << "import: " << Sym->getName() << "\n");
|
||||
ImportedSymbols.emplace_back(Sym);
|
||||
if (auto *F = dyn_cast<FunctionSymbol>(Sym))
|
||||
F->setFunctionIndex(NumImportedFunctions++);
|
||||
|
@ -757,7 +757,7 @@ void Writer::calculateExports() {
|
|||
Export = {Name, WASM_EXTERNAL_GLOBAL, FakeGlobalIndex++};
|
||||
}
|
||||
|
||||
DEBUG(dbgs() << "Export: " << Name << "\n");
|
||||
LLVM_DEBUG(dbgs() << "Export: " << Name << "\n");
|
||||
Exports.push_back(Export);
|
||||
}
|
||||
}
|
||||
|
@ -770,7 +770,7 @@ void Writer::assignSymtab() {
|
|||
|
||||
unsigned SymbolIndex = SymtabEntries.size();
|
||||
for (ObjFile *File : Symtab->ObjectFiles) {
|
||||
DEBUG(dbgs() << "Symtab entries: " << File->getName() << "\n");
|
||||
LLVM_DEBUG(dbgs() << "Symtab entries: " << File->getName() << "\n");
|
||||
for (Symbol *Sym : File->getSymbols()) {
|
||||
if (Sym->getFile() != File)
|
||||
continue;
|
||||
|
@ -817,7 +817,7 @@ uint32_t Writer::lookupType(const WasmSignature &Sig) {
|
|||
uint32_t Writer::registerType(const WasmSignature &Sig) {
|
||||
auto Pair = TypeIndices.insert(std::make_pair(Sig, Types.size()));
|
||||
if (Pair.second) {
|
||||
DEBUG(dbgs() << "type " << toString(Sig) << "\n");
|
||||
LLVM_DEBUG(dbgs() << "type " << toString(Sig) << "\n");
|
||||
Types.push_back(&Sig);
|
||||
}
|
||||
return Pair.first->second;
|
||||
|
@ -857,7 +857,7 @@ void Writer::assignIndexes() {
|
|||
AddDefinedFunction(Func);
|
||||
|
||||
for (ObjFile *File : Symtab->ObjectFiles) {
|
||||
DEBUG(dbgs() << "Functions: " << File->getName() << "\n");
|
||||
LLVM_DEBUG(dbgs() << "Functions: " << File->getName() << "\n");
|
||||
for (InputFunction *Func : File->Functions)
|
||||
AddDefinedFunction(Func);
|
||||
}
|
||||
|
@ -885,7 +885,7 @@ void Writer::assignIndexes() {
|
|||
};
|
||||
|
||||
for (ObjFile *File : Symtab->ObjectFiles) {
|
||||
DEBUG(dbgs() << "Handle relocs: " << File->getName() << "\n");
|
||||
LLVM_DEBUG(dbgs() << "Handle relocs: " << File->getName() << "\n");
|
||||
for (InputChunk *Chunk : File->Functions)
|
||||
HandleRelocs(Chunk);
|
||||
for (InputChunk *Chunk : File->Segments)
|
||||
|
@ -897,7 +897,7 @@ void Writer::assignIndexes() {
|
|||
uint32_t GlobalIndex = NumImportedGlobals + InputGlobals.size();
|
||||
auto AddDefinedGlobal = [&](InputGlobal *Global) {
|
||||
if (Global->Live) {
|
||||
DEBUG(dbgs() << "AddDefinedGlobal: " << GlobalIndex << "\n");
|
||||
LLVM_DEBUG(dbgs() << "AddDefinedGlobal: " << GlobalIndex << "\n");
|
||||
Global->setGlobalIndex(GlobalIndex++);
|
||||
InputGlobals.push_back(Global);
|
||||
}
|
||||
|
@ -907,7 +907,7 @@ void Writer::assignIndexes() {
|
|||
AddDefinedGlobal(Global);
|
||||
|
||||
for (ObjFile *File : Symtab->ObjectFiles) {
|
||||
DEBUG(dbgs() << "Globals: " << File->getName() << "\n");
|
||||
LLVM_DEBUG(dbgs() << "Globals: " << File->getName() << "\n");
|
||||
for (InputGlobal *Global : File->Globals)
|
||||
AddDefinedGlobal(Global);
|
||||
}
|
||||
|
@ -933,12 +933,12 @@ void Writer::createOutputSegments() {
|
|||
StringRef Name = getOutputDataSegmentName(Segment->getName());
|
||||
OutputSegment *&S = SegmentMap[Name];
|
||||
if (S == nullptr) {
|
||||
DEBUG(dbgs() << "new segment: " << Name << "\n");
|
||||
LLVM_DEBUG(dbgs() << "new segment: " << Name << "\n");
|
||||
S = make<OutputSegment>(Name, Segments.size());
|
||||
Segments.push_back(S);
|
||||
}
|
||||
S->addInputSegment(Segment);
|
||||
DEBUG(dbgs() << "added data: " << Name << ": " << S->Size << "\n");
|
||||
LLVM_DEBUG(dbgs() << "added data: " << Name << ": " << S->Size << "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ static const char *valueTypeToString(uint8_t Type) {
|
|||
namespace lld {
|
||||
|
||||
void wasm::debugWrite(uint64_t Offset, const Twine &Msg) {
|
||||
DEBUG(dbgs() << format(" | %08lld: ", Offset) << Msg << "\n");
|
||||
LLVM_DEBUG(dbgs() << format(" | %08lld: ", Offset) << Msg << "\n");
|
||||
}
|
||||
|
||||
void wasm::writeUleb128(raw_ostream &OS, uint32_t Number, const Twine &Msg) {
|
||||
|
|
Loading…
Reference in New Issue