[LLD][COFF] Fix TypeServerSource matcher with more than one collision
[llvm-project.git] / lld / wasm / OutputSegment.h
blob3b7a0f50be94e9c391feedbb924b0f0787a8ae00
1 //===- OutputSegment.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-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #ifndef LLD_WASM_OUTPUT_SEGMENT_H
10 #define LLD_WASM_OUTPUT_SEGMENT_H
12 #include "InputChunks.h"
13 #include "lld/Common/ErrorHandler.h"
14 #include "llvm/Object/Wasm.h"
16 namespace lld {
17 namespace wasm {
19 class InputSegment;
21 class OutputSegment {
22 public:
23 OutputSegment(StringRef n) : name(n) {}
25 void addInputSegment(InputChunk *inSeg);
26 void finalizeInputSegments();
27 // In most circumstances BSS segments don't need to be written
28 // to the output binary. However if the memory is imported, and
29 // we can't use memory.fill during startup (due to lack of bulk
30 // memory feature) then we include BSS segments verbatim.
31 bool requiredInBinary() const { return !isBss || config->emitBssSegments; }
33 bool isTLS() const { return name == ".tdata"; }
35 StringRef name;
36 bool isBss = false;
37 uint32_t index = 0;
38 uint32_t linkingFlags = 0;
39 uint32_t initFlags = 0;
40 uint32_t sectionOffset = 0;
41 uint32_t alignment = 0;
42 uint64_t startVA = 0;
43 std::vector<InputChunk *> inputSegments;
45 // Sum of the size of the all the input segments
46 uint32_t size = 0;
48 // Segment header
49 std::string header;
52 } // namespace wasm
53 } // namespace lld
55 #endif // LLD_WASM_OUTPUT_SEGMENT_H