brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.2 KiB · c333a3d Raw
146 lines · c
1//===- tools/dsymutil/LinkUtils.h - Dwarf linker utilities ------*- C++ -*-===//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-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef LLVM_TOOLS_DSYMUTIL_LINKOPTIONS_H10#define LLVM_TOOLS_DSYMUTIL_LINKOPTIONS_H11 12#include "llvm/ADT/Twine.h"13#include "llvm/Remarks/RemarkFormat.h"14#include "llvm/Support/VirtualFileSystem.h"15#include "llvm/Support/WithColor.h"16 17#include "llvm/DWARFLinker/Classic/DWARFLinker.h"18#include "llvm/DWARFLinker/Classic/DWARFStreamer.h"19#include <string>20 21namespace llvm {22namespace dsymutil {23 24enum class DsymutilAccelTableKind : uint8_t {25  None,26  Apple,   ///< .apple_names, .apple_namespaces, .apple_types, .apple_objc.27  Dwarf,   ///< DWARF v5 .debug_names.28  Default, ///< Dwarf for DWARF5 or later, Apple otherwise.29  Pub,     ///< .debug_pubnames, .debug_pubtypes30};31 32enum class DsymutilDWARFLinkerType : uint8_t {33  Classic, /// Classic implementation of DWARFLinker.34  Parallel /// Implementation of DWARFLinker heavily using parallel execution.35};36 37struct LinkOptions {38  /// Verbosity39  bool Verbose = false;40 41  /// Quiet42  bool Quiet = false;43 44  /// Statistics45  bool Statistics = false;46 47  /// Verify the input DWARF.48  bool VerifyInputDWARF = false;49 50  /// Skip emitting output51  bool NoOutput = false;52 53  /// Do not unique types according to ODR54  bool NoODR = false;55 56  /// Update57  bool Update = false;58 59  /// Do not check swiftmodule timestamp60  bool NoTimestamp = false;61 62  /// Whether we want a static variable to force us to keep its enclosing63  /// function.64  bool KeepFunctionForStatic = false;65 66  /// Type of DWARFLinker to use.67  DsymutilDWARFLinkerType DWARFLinkerType = DsymutilDWARFLinkerType::Classic;68 69  /// Use a 64-bit header when emitting universal binaries.70  bool Fat64 = false;71 72  /// Number of threads.73  unsigned Threads = 1;74 75  // Output file type.76  dwarf_linker::DWARFLinkerBase::OutputFileType FileType =77      dwarf_linker::DWARFLinkerBase::OutputFileType::Object;78 79  /// The accelerator table kind80  DsymutilAccelTableKind TheAccelTableKind;81 82  /// -oso-prepend-path83  std::string PrependPath;84 85  /// The -object-prefix-map.86  std::map<std::string, std::string> ObjectPrefixMap;87 88  /// The Resources directory in the .dSYM bundle.89  std::optional<std::string> ResourceDir;90 91  /// Virtual File System.92  llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS =93      vfs::getRealFileSystem();94 95  /// -build-variant-suffix.96  std::string BuildVariantSuffix;97 98  /// Paths where to search for the .dSYM files of merged libraries.99  std::vector<std::string> DSYMSearchPaths;100 101  /// Fields used for linking and placing remarks into the .dSYM bundle.102  /// @{103 104  /// Number of debug maps processed in total.105  unsigned NumDebugMaps = 0;106 107  /// -remarks-prepend-path: prepend a path to all the external remark file108  /// paths found in remark metadata.109  std::string RemarksPrependPath;110 111  /// The output format of the remarks.112  remarks::Format RemarksFormat = remarks::Format::Bitstream;113 114  /// Whether all remarks should be kept or only remarks with valid debug115  /// locations.116  bool RemarksKeepAll = true;117 118  /// Whether or not to copy binary swiftmodules built from textual119  /// .swiftinterface files into the dSYM bundle. These typically come only120  /// from the SDK (since textual interfaces require library evolution) and121  /// thus are a waste of space to copy into the bundle. Turn this on if the122  /// swiftmodules are different from those in the SDK.123  bool IncludeSwiftModulesFromInterface = false;124  /// @}125 126  LinkOptions() = default;127};128 129inline void warn(Twine Warning, Twine Context = {}) {130  WithColor::warning() << Warning + "\n";131  if (!Context.isTriviallyEmpty())132    WithColor::note() << Twine("while processing ") + Context + "\n";133}134 135inline bool error(Twine Error, Twine Context = {}) {136  WithColor::error() << Error + "\n";137  if (!Context.isTriviallyEmpty())138    WithColor::note() << Twine("while processing ") + Context + "\n";139  return false;140}141 142} // end namespace dsymutil143} // end namespace llvm144 145#endif // LLVM_TOOLS_DSYMUTIL_LINKOPTIONS_H146