1 //===- Core/SharedLibraryAtom.h - A Shared Library Atom -------------------===//
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLD_CORE_SHARED_LIBRARY_ATOM_H
11 #define LLD_CORE_SHARED_LIBRARY_ATOM_H
13 #include "lld/Core/Atom.h"
17 /// A SharedLibraryAtom has no content.
18 /// It exists to represent a symbol which will be bound at runtime.
19 class SharedLibraryAtom : public Atom {
21 enum class Type : uint32_t {
27 /// Returns shared library name used to load it at runtime.
28 /// On Darwin it is the LC_DYLIB_LOAD dylib name.
29 virtual StringRef loadName() const = 0;
31 /// Returns if shared library symbol can be missing at runtime and if
32 /// so the loader should silently resolve address of symbol to be nullptr.
33 virtual bool canBeNullAtRuntime() const = 0;
35 virtual Type type() const = 0;
37 virtual uint64_t size() const = 0;
39 static bool classof(const Atom *a) {
40 return a->definition() == definitionSharedLibrary;
43 static inline bool classof(const SharedLibraryAtom *) { return true; }
46 SharedLibraryAtom() : Atom(definitionSharedLibrary) {}
48 ~SharedLibraryAtom() override = default;
53 #endif // LLD_CORE_SHARED_LIBRARY_ATOM_H