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 //===----------------------------------------------------------------------===// 8 9 #ifndef LLD_WASM_OUTPUT_SEGMENT_H 10 #define LLD_WASM_OUTPUT_SEGMENT_H 11 12 #include "InputChunks.h" 13 #include "lld/Common/ErrorHandler.h" 14 #include "llvm/Object/Wasm.h" 15 16 namespace lld { 17 namespace wasm { 18 19 class InputSegment; 20 21 class OutputSegment { 22 public: 23 OutputSegment(StringRef n) : name(n) {} 24 25 void addInputSegment(InputChunk *inSeg); 26 void finalizeInputSegments(); 27 28 bool isTLS() const { return name == ".tdata"; } 29 30 StringRef name; 31 bool isBss = false; 32 uint32_t index = 0; 33 uint32_t linkingFlags = 0; 34 uint32_t initFlags = 0; 35 uint32_t sectionOffset = 0; 36 uint32_t alignment = 0; 37 uint64_t startVA = 0; 38 std::vector<InputChunk *> inputSegments; 39 40 // Sum of the size of the all the input segments 41 uint32_t size = 0; 42 43 // Segment header 44 std::string header; 45 }; 46 47 } // namespace wasm 48 } // namespace lld 49 50 #endif // LLD_WASM_OUTPUT_SEGMENT_H 51