1 //===-- MachOUtils.h - Mach-o specific helpers for dsymutil --------------===//
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 //===----------------------------------------------------------------------===//
8 #ifndef LLVM_TOOLS_DSYMUTIL_MACHOUTILS_H
9 #define LLVM_TOOLS_DSYMUTIL_MACHOUTILS_H
11 #include "SymbolMap.h"
13 #include "llvm/ADT/StringRef.h"
14 #include "llvm/Support/FileSystem.h"
15 #include "llvm/Support/VirtualFileSystem.h"
25 namespace MachOUtils
{
32 llvm::Error
createTempFile();
33 llvm::StringRef
getPath() const;
36 ArchAndFile(StringRef Arch
) : Arch(std::string(Arch
)) {}
37 ArchAndFile(ArchAndFile
&&A
) = default;
38 ArchAndFile
&operator=(ArchAndFile
&&A
) = default;
42 struct DwarfRelocationApplicationInfo
{
43 // The position in the stream that should be patched, starting from the
44 // Dwarf's segment file address.
45 uint64_t AddressFromDwarfStart
;
47 // If we should subtract the Dwarf segment's VM address from value before
49 bool ShouldSubtractDwarfVM
;
51 DwarfRelocationApplicationInfo(uint64_t AddressFromDwarfVM
, uint32_t Value
,
52 bool ShouldSubtractDwarfVM
)
53 : AddressFromDwarfStart(AddressFromDwarfVM
), Value(Value
),
54 ShouldSubtractDwarfVM(ShouldSubtractDwarfVM
) {}
57 bool generateUniversalBinary(SmallVectorImpl
<ArchAndFile
> &ArchFiles
,
58 StringRef OutputFileName
, const LinkOptions
&,
59 StringRef SDKPath
, bool Fat64
= false);
60 bool generateDsymCompanion(
61 llvm::IntrusiveRefCntPtr
<llvm::vfs::FileSystem
> VFS
, const DebugMap
&DM
,
62 SymbolMapTranslator
&Translator
, MCStreamer
&MS
, raw_fd_ostream
&OutFile
,
63 const std::vector
<MachOUtils::DwarfRelocationApplicationInfo
>
66 std::string
getArchName(StringRef Arch
);
67 } // namespace MachOUtils
68 } // namespace dsymutil
70 #endif // LLVM_TOOLS_DSYMUTIL_MACHOUTILS_H