xref: /llvm-project-15.0.7/lld/MachO/Symbols.cpp (revision aec12c12)
1 //===- Symbols.cpp --------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "Symbols.h"
10 #include "InputFiles.h"
11 #include "SyntheticSections.h"
12 
13 using namespace llvm;
14 using namespace lld;
15 using namespace lld::macho;
16 
17 void LazySymbol::fetchArchiveMember() { file->fetch(sym); }
18 
19 // Returns a symbol for an error message.
20 std::string lld::toString(const Symbol &sym) {
21   if (Optional<std::string> s = demangleItanium(sym.getName()))
22     return *s;
23   return std::string(sym.getName());
24 }
25 
26 uint64_t DSOHandle::getVA() const { return header->addr; }
27 
28 uint64_t DSOHandle::getFileOffset() const { return header->fileOff; }
29 
30 constexpr StringRef DSOHandle::name;
31