1 //===- Core/UndefinedAtom.h - An Undefined 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_UNDEFINED_ATOM_H
11 #define LLD_CORE_UNDEFINED_ATOM_H
13 #include "lld/Core/Atom.h"
17 /// An UndefinedAtom has no content.
18 /// It exists as a placeholder for a future atom.
19 class UndefinedAtom : public Atom {
21 /// Whether this undefined symbol needs to be resolved,
22 /// or whether it can just evaluate to nullptr.
23 /// This concept is often called "weak", but that term
24 /// is overloaded to mean other things too.
26 /// Normal symbols must be resolved at build time
29 /// This symbol can be missing at runtime and will evalute to nullptr.
30 /// That is, the static linker still must find a definition (usually
31 /// is some shared library), but at runtime, the dynamic loader
32 /// will allow the symbol to be missing and resolved to nullptr.
34 /// On Darwin this is generated using a function prototype with
35 /// __attribute__((weak_import)).
36 /// On linux this is generated using a function prototype with
37 /// __attribute__((weak)).
38 /// On Windows this feature is not supported.
41 /// This symbol can be missing at build time.
42 /// That is, the static linker will not error if a definition for
43 /// this symbol is not found at build time. Instead, the linker
44 /// will build an executable that lets the dynamic loader find the
45 /// symbol at runtime.
46 /// This feature is not supported on Darwin nor Windows.
47 /// On linux this is generated using a function prototype with
48 /// __attribute__((weak)).
52 virtual CanBeNull canBeNull() const = 0;
54 static bool classof(const Atom *a) {
55 return a->definition() == definitionUndefined;
58 static bool classof(const UndefinedAtom *) { return true; }
61 UndefinedAtom() : Atom(definitionUndefined) {}
63 ~UndefinedAtom() override = default;
68 #endif // LLD_CORE_UNDEFINED_ATOM_H