0f6d720f1f
We need to reset global state between runs, similar to the other ports. There's some file-static state which needs to be reset as well and we need to add some new helpers for that. With this change, most LLD Mach-O tests pass with `LLD_IN_TEST=2` (which runs the linker twice on each test). Some tests will be fixed by the remainder of this stack, and the rest are fundamentally incompatible with that mode (e.g. they intentionally throw fatal errors). Fixes PR52070. Reviewed By: #lld-macho, int3 Differential Revision: https://reviews.llvm.org/D112878
43 lines
1.1 KiB
C++
43 lines
1.1 KiB
C++
//===- Writer.h -------------------------------------------------*- C++ -*-===//
|
|
//
|
|
// 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_WRITER_H
|
|
#define LLD_MACHO_WRITER_H
|
|
|
|
#include <cstdint>
|
|
|
|
namespace lld {
|
|
namespace macho {
|
|
|
|
class OutputSection;
|
|
class InputSection;
|
|
class Symbol;
|
|
|
|
class LoadCommand {
|
|
public:
|
|
virtual ~LoadCommand() = default;
|
|
virtual uint32_t getSize() const = 0;
|
|
virtual void writeTo(uint8_t *buf) const = 0;
|
|
};
|
|
|
|
template <class LP> void writeResult();
|
|
void resetWriter();
|
|
|
|
void createSyntheticSections();
|
|
|
|
// Add bindings for symbols that need weak or non-lazy bindings.
|
|
void addNonLazyBindingEntries(const Symbol *, const InputSection *,
|
|
uint64_t offset, int64_t addend = 0);
|
|
|
|
extern OutputSection *firstTLVDataSection;
|
|
|
|
} // namespace macho
|
|
} // namespace lld
|
|
|
|
#endif
|