1 //===- Config.h -------------------------------------------------*- C++ -*-===//
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_WASM_CONFIG_H
10 #define LLD_WASM_CONFIG_H
12 #include "llvm/ADT/StringRef.h"
13 #include "llvm/ADT/StringSet.h"
14 #include "llvm/BinaryFormat/Wasm.h"
15 #include "llvm/Support/CachePruning.h"
20 // This struct contains the global configuration for the linker.
21 // Most fields are direct mapping from the command line options
22 // and such fields have the same name as the corresponding options.
23 // Most fields are initialized by the driver.
24 struct Configuration
{
27 bool compressRelocations
;
39 bool mergeDataSegments
;
50 uint64_t initialMemory
;
53 unsigned ltoPartitions
;
56 llvm::StringRef thinLTOJobs
;
58 llvm::StringRef entry
;
59 llvm::StringRef outputFile
;
60 llvm::StringRef thinLTOCacheDir
;
62 llvm::StringSet
<> allowUndefinedSymbols
;
63 llvm::StringSet
<> exportedSymbols
;
64 std::vector
<llvm::StringRef
> searchPaths
;
65 llvm::CachePruningPolicy thinLTOCachePolicy
;
66 llvm::Optional
<std::vector
<std::string
>> features
;
68 // The following config options do not directly correspond to any
69 // particualr command line options.
71 // True if we are creating position-independent code.
74 // The table offset at which to place function addresses. We reserve zero
75 // for the null function pointer. This gets set to 1 for executables and 0
76 // for shared libraries (since they always added to a dynamic offset at
78 uint32_t tableBase
= 0;
81 // The only instance of Configuration struct.
82 extern Configuration
*config
;