brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · 48bce74 Raw
65 lines · c
1//===- MinGW.h --------------------------------------------------*- 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 LLD_COFF_MINGW_H10#define LLD_COFF_MINGW_H11 12#include "Config.h"13#include "Symbols.h"14#include "lld/Common/LLVM.h"15#include "llvm/ADT/ArrayRef.h"16#include "llvm/ADT/DenseSet.h"17#include "llvm/ADT/StringSet.h"18#include "llvm/Option/ArgList.h"19#include <vector>20 21namespace lld::coff {22class COFFLinkerContext;23 24// Logic for deciding what symbols to export, when exporting all25// symbols for MinGW.26class AutoExporter {27public:28  AutoExporter(SymbolTable &symtab,29               const llvm::DenseSet<StringRef> &manualExcludeSymbols);30 31  void addWholeArchive(StringRef path);32  void addExcludedSymbol(StringRef symbol);33 34  llvm::StringSet<> excludeSymbols;35  llvm::StringSet<> excludeSymbolPrefixes;36  llvm::StringSet<> excludeSymbolSuffixes;37  llvm::StringSet<> excludeLibs;38  llvm::StringSet<> excludeObjects;39 40  const llvm::DenseSet<StringRef> &manualExcludeSymbols;41 42  bool shouldExport(Defined *sym) const;43 44private:45  SymbolTable &symtab;46};47 48void writeDefFile(COFFLinkerContext &, StringRef name,49                  const std::vector<Export> &exports);50 51// The -wrap option is a feature to rename symbols so that you can write52// wrappers for existing functions. If you pass `-wrap:foo`, all53// occurrences of symbol `foo` are resolved to `__wrap_foo` (so, you are54// expected to write `__wrap_foo` function as a wrapper). The original55// symbol becomes accessible as `__real_foo`, so you can call that from your56// wrapper.57//58void addWrappedSymbols(SymbolTable &symtab, llvm::opt::InputArgList &args);59 60void wrapSymbols(SymbolTable &symtab);61 62} // namespace lld::coff63 64#endif65