llvm/lld/ELF/Config.h

//===- Config.h -------------------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef LLD_ELF_CONFIG_H
#define LLD_ELF_CONFIG_H

#include "lld/Common/ErrorHandler.h"
#include "llvm/ADT/CachedHashString.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/BinaryFormat/ELF.h"
#include "llvm/Option/ArgList.h"
#include "llvm/Support/CachePruning.h"
#include "llvm/Support/CodeGen.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Compression.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/GlobPattern.h"
#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/TarWriter.h"
#include <atomic>
#include <memory>
#include <optional>
#include <vector>

namespace lld::elf {

class InputFile;
class BinaryFile;
class BitcodeFile;
class ELFFileBase;
class SharedFile;
class InputSectionBase;
class EhInputSection;
class Defined;
class Symbol;
class BitcodeCompiler;
class OutputSection;
class LinkerScript;
class TargetInfo;
struct Ctx;
struct Partition;
struct PhdrEntry;

class BssSection;
class GdbIndexSection;
class GotPltSection;
class GotSection;
class IBTPltSection;
class IgotPltSection;
class InputSection;
class IpltSection;
class MipsGotSection;
class MipsRldMapSection;
class PPC32Got2Section;
class PPC64LongBranchTargetSection;
class PltSection;
class RelocationBaseSection;
class RelroPaddingSection;
class StringTableSection;
class SymbolTableBaseSection;
class SymtabShndxSection;
class SyntheticSection;

enum ELFKind : uint8_t {};

// For -Bno-symbolic, -Bsymbolic-non-weak-functions, -Bsymbolic-functions,
// -Bsymbolic-non-weak, -Bsymbolic.
enum class BsymbolicKind {};

// For --build-id.
enum class BuildIdKind {};

// For --call-graph-profile-sort={none,hfsort,cdsort}.
enum class CGProfileSortKind {};

// For --discard-{all,locals,none}.
enum class DiscardPolicy {};

// For --icf={none,safe,all}.
enum class ICFLevel {};

// For --strip-{all,debug}.
enum class StripPolicy {};

// For --unresolved-symbols.
enum class UnresolvedPolicy {};

// For --orphan-handling.
enum class OrphanHandlingPolicy {};

// For --sort-section and linkerscript sorting rules.
enum class SortSectionPolicy {};

// For --target2
enum class Target2Policy {};

// For tracking ARM Float Argument PCS
enum class ARMVFPArgKind {};

// For -z noseparate-code, -z separate-code and -z separate-loadable-segments.
enum class SeparateSegmentKind {};

// For -z *stack
enum class GnuStackKind {};

// For --lto=
enum LtoKind : uint8_t {};

// For -z gcs=
enum class GcsPolicy {};

struct SymbolVersion {};

// This struct contains symbols version definition that
// can be found in version script if it is used for link.
struct VersionDefinition {};

class LinkerDriver {};

// This struct contains the global configuration for the linker.
// Most fields are direct mapping from the command line options
// and such fields have the same name as the corresponding options.
// Most fields are initialized by the ctx.driver.
struct Config {};
struct ConfigWrapper {};

LLVM_LIBRARY_VISIBILITY extern ConfigWrapper config;

// Some index properties of a symbol are stored separately in this auxiliary
// struct to decrease sizeof(SymbolUnion) in the majority of cases.
struct SymbolAux {};

struct DuplicateSymbol {};

// Linker generated sections which can be used as inputs and are not specific to
// a partition.
struct InStruct {};

struct Ctx {};

LLVM_LIBRARY_VISIBILITY extern Ctx ctx;

// The first two elements of versionDefinitions represent VER_NDX_LOCAL and
// VER_NDX_GLOBAL. This helper returns other elements.
static inline ArrayRef<VersionDefinition> namedVersionDefs() {}

void errorOrWarn(const Twine &msg);

static inline void internalLinkerError(StringRef loc, const Twine &msg) {}

} // namespace lld::elf

#endif