1 //===- Core/SharedLibraryAtom.h - A Shared Library Atom -------------------===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLD_CORE_SHARED_LIBRARY_ATOM_H
10 #define LLD_CORE_SHARED_LIBRARY_ATOM_H
12 #include "lld/Core/Atom.h"
16 /// A SharedLibraryAtom has no content.
17 /// It exists to represent a symbol which will be bound at runtime.
18 class SharedLibraryAtom : public Atom {
20 enum class Type : uint32_t {
26 /// Returns shared library name used to load it at runtime.
27 /// On Darwin it is the LC_DYLIB_LOAD dylib name.
28 virtual StringRef loadName() const = 0;
30 /// Returns if shared library symbol can be missing at runtime and if
31 /// so the loader should silently resolve address of symbol to be nullptr.
32 virtual bool canBeNullAtRuntime() const = 0;
34 virtual Type type() const = 0;
36 virtual uint64_t size() const = 0;
38 static bool classof(const Atom *a) {
39 return a->definition() == definitionSharedLibrary;
42 static inline bool classof(const SharedLibraryAtom *) { return true; }
45 SharedLibraryAtom() : Atom(definitionSharedLibrary) {}
47 ~SharedLibraryAtom() override = default;
52 #endif // LLD_CORE_SHARED_LIBRARY_ATOM_H