1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00
llvm-mirror/tools/dsymutil/MachOUtils.h
Frederic Riss 52e45a3b66 Reapply r246012 [dsymutil] Emit real dSYM companion binaries.
With a fix for big endian machines. Thanks to Daniel Sanders for the debugging!

Original commit message:

The binaries containing the linked DWARF generated by dsymutil are not
standard relocatable object files like emitted did previsously. They should be
dSYM companion files, which means they have a different file type in the
header, but also a couple other peculiarities:
 - they contain the segments and sections from the original binary in their
load commands, but not the actual contents. This means they get an address
and a size, but their offset is always 0 (but these are not virtual sections)
 - they also conatin all the defined symbols from the original binary

This makes MC a really bad fit to emit these kind of binaries. The approach
that was used in this patch is to leverage MC's section layout for the
debug sections, but to use a replacement for MachObjectWriter that lives
in MachOUtils.cpp. Some of the low-level helpers from MachObjectWriter
were reused too.

llvm-svn: 246673
2015-09-02 16:49:13 +00:00

39 lines
1.1 KiB
C++

//===-- MachOUtils.h - Mach-o specific helpers for dsymutil --------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_TOOLS_DSYMUTIL_MACHOUTILS_H
#define LLVM_TOOLS_DSYMUTIL_MACHOUTILS_H
#include <string>
#include "llvm/ADT/StringRef.h"
namespace llvm {
class MCStreamer;
class raw_fd_ostream;
namespace dsymutil {
class DebugMap;
struct LinkOptions;
namespace MachOUtils {
struct ArchAndFilename {
std::string Arch, Path;
ArchAndFilename(StringRef Arch, StringRef Path) : Arch(Arch), Path(Path) {}
};
bool generateUniversalBinary(SmallVectorImpl<ArchAndFilename> &ArchFiles,
StringRef OutputFileName, const LinkOptions &);
bool generateDsymCompanion(const DebugMap &DM, MCStreamer &MS,
raw_fd_ostream &OutFile);
std::string getArchName(StringRef Arch);
}
}
}
#endif // LLVM_TOOLS_DSYMUTIL_MACHOUTILS_H