2020-08-21 04:05:13 +08:00
|
|
|
//===- UnwindInfoSection.h ------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLD_MACHO_UNWIND_INFO_H
|
|
|
|
#define LLD_MACHO_UNWIND_INFO_H
|
|
|
|
|
|
|
|
#include "MergedOutputSection.h"
|
|
|
|
#include "SyntheticSections.h"
|
|
|
|
|
|
|
|
#include "mach-o/compact_unwind_encoding.h"
|
|
|
|
#include "llvm/ADT/DenseMap.h"
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace lld {
|
|
|
|
namespace macho {
|
|
|
|
|
|
|
|
class UnwindInfoSection : public SyntheticSection {
|
|
|
|
public:
|
2021-04-16 09:14:33 +08:00
|
|
|
bool isNeeded() const override { return compactUnwindSection != nullptr; }
|
2020-08-21 04:05:13 +08:00
|
|
|
uint64_t getSize() const override { return unwindInfoSize; }
|
2021-04-16 09:14:33 +08:00
|
|
|
virtual void prepareRelocations(InputSection *) = 0;
|
|
|
|
|
2020-08-21 04:05:13 +08:00
|
|
|
void setCompactUnwindSection(MergedOutputSection *cuSection) {
|
|
|
|
compactUnwindSection = cuSection;
|
|
|
|
}
|
|
|
|
|
2021-04-16 09:14:33 +08:00
|
|
|
protected:
|
|
|
|
UnwindInfoSection()
|
|
|
|
: SyntheticSection(segment_names::text, section_names::unwindInfo) {
|
|
|
|
align = 4;
|
|
|
|
}
|
2020-12-07 14:33:38 +08:00
|
|
|
|
2020-08-21 04:05:13 +08:00
|
|
|
MergedOutputSection *compactUnwindSection = nullptr;
|
|
|
|
uint64_t unwindInfoSize = 0;
|
|
|
|
};
|
|
|
|
|
2021-04-16 09:14:33 +08:00
|
|
|
UnwindInfoSection *makeUnwindInfoSection();
|
2021-02-09 02:47:33 +08:00
|
|
|
void prepareCompactUnwind(InputSection *isec);
|
|
|
|
|
2020-08-21 04:05:13 +08:00
|
|
|
} // namespace macho
|
|
|
|
} // namespace lld
|
|
|
|
|
|
|
|
#endif
|