public class Machos extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Machos.MachoException |
Modifier and Type | Field and Description |
---|---|
static int |
LC_DYLD_INFO_ONLY |
static int |
LC_SYMTAB |
Modifier and Type | Method and Description |
---|---|
static Map<byte[],byte[]> |
generateReplacementMap(Map<Path,Path> pathMap)
Prepares a replacement map for prefixes.
|
protected static com.facebook.buck.cxx.toolchain.objectfile.MachoHeader |
getHeader(MappedByteBuffer map)
Returns the Mach-O header provided the file is Mach-O, otherwise throws an exception.
|
static Optional<ByteBuffer> |
tryRewritingMatchingPath(byte[] stringBytes,
int stringOffset,
Map<byte[],byte[]> replacementMap)
Checks whether a string matches a prefix and returns a rewritten copy if that's the case.
|
public static final int LC_SYMTAB
public static final int LC_DYLD_INFO_ONLY
protected static com.facebook.buck.cxx.toolchain.objectfile.MachoHeader getHeader(MappedByteBuffer map) throws Machos.MachoException
Machos.MachoException
public static Map<byte[],byte[]> generateReplacementMap(Map<Path,Path> pathMap)
The resulting map would contain: 1. "/path/to/repo/" -> "./" 2. "/path/to/repo/cell/" -> "cell/"
The above means we can do very simple (and fast!) search & replace.
public static Optional<ByteBuffer> tryRewritingMatchingPath(byte[] stringBytes, int stringOffset, Map<byte[],byte[]> replacementMap)
NB: This is a perf sensitive method.