blob: 826573b0c44a00c9f1229ef7ceb42d5762f35447 [file] [log] [blame]
Greg McGary2124ca12020-08-20 13:05:13 -07001//===- UnwindInfoSection.h ------------------------------------------------===//
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_MACHO_UNWIND_INFO_H
10#define LLD_MACHO_UNWIND_INFO_H
11
Jez Ng33706192021-05-25 14:57:16 -040012#include "ConcatOutputSection.h"
Greg McGary2124ca12020-08-20 13:05:13 -070013#include "SyntheticSections.h"
Jez Nga9353db2021-10-26 16:04:06 -040014#include "llvm/ADT/MapVector.h"
Greg McGary2124ca12020-08-20 13:05:13 -070015
Nico Weberbf20d432022-08-07 10:37:49 -040016namespace lld::macho {
Greg McGary2124ca12020-08-20 13:05:13 -070017
18class UnwindInfoSection : public SyntheticSection {
19public:
Jez Nga9353db2021-10-26 16:04:06 -040020 // If all functions are free of unwind info, we can omit the unwind info
21 // section entirely.
22 bool isNeeded() const override { return !allEntriesAreOmitted; }
Jez Nga9353db2021-10-26 16:04:06 -040023 void addSymbol(const Defined *);
Jez Ng7b45dfc2022-10-11 23:50:46 -040024 virtual void prepare() = 0;
Greg McGary2124ca12020-08-20 13:05:13 -070025
Jez Ng14609422021-04-15 21:14:33 -040026protected:
Jez Ng3a115282021-07-01 20:33:42 -040027 UnwindInfoSection();
Greg McGary99930712020-12-06 22:33:38 -080028
Jez Nga9353db2021-10-26 16:04:06 -040029 llvm::MapVector<std::pair<const InputSection *, uint64_t /*Defined::value*/>,
30 const Defined *>
31 symbols;
Nico Weber8a7b5eb2021-07-07 11:28:27 -040032 bool allEntriesAreOmitted = true;
Greg McGary2124ca12020-08-20 13:05:13 -070033};
34
Jez Ng14609422021-04-15 21:14:33 -040035UnwindInfoSection *makeUnwindInfoSection();
Jez Ng525bfa12021-02-08 13:47:33 -050036
Nico Weberbf20d432022-08-07 10:37:49 -040037} // namespace lld::macho
Greg McGary2124ca12020-08-20 13:05:13 -070038
39#endif