1 //===- UnwindInfoSection.h ------------------------------------------------===//
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_MACHO_UNWIND_INFO_H
10 #define LLD_MACHO_UNWIND_INFO_H
12 #include "ConcatOutputSection.h"
13 #include "SyntheticSections.h"
15 #include "mach-o/compact_unwind_encoding.h"
20 template <class Ptr
> struct CompactUnwindEntry
{
22 uint32_t functionLength
;
23 compact_unwind_encoding_t encoding
;
28 class UnwindInfoSection
: public SyntheticSection
{
30 bool isNeeded() const override
{
31 return !compactUnwindSection
->inputs
.empty() && !allEntriesAreOmitted
;
33 uint64_t getSize() const override
{ return unwindInfoSize
; }
34 virtual void addInput(ConcatInputSection
*) = 0;
35 std::vector
<ConcatInputSection
*> getInputs() {
36 return compactUnwindSection
->inputs
;
38 void prepareRelocations();
42 virtual void prepareRelocations(ConcatInputSection
*) = 0;
44 ConcatOutputSection
*compactUnwindSection
;
45 uint64_t unwindInfoSize
= 0;
46 bool allEntriesAreOmitted
= true;
49 UnwindInfoSection
*makeUnwindInfoSection();