mach-o

Mac OS X: What is the best way to estimate the code & static data size of program?

I want to be able to get an estimate of how much code & static data is used by my C++ program? Is there a way to find this out by looking at the executable or object files? Or perhaps something I can do at runtime? Will otool help? ...

How do I create a dynamic library (dylib) with Xcode?

I'm building few command-line utilities in Xcode (plain C, no Cocoa). I want all of them to use my customized version of libpng, and I want to save space by sharing one copy of the library among all executables (I don't mind re-distributing .dylib with them). Do I need to do some magic to get libpng export symbols? Does "Link Binary Wi...

Mach-O binary editor for OSX?

py-macholib does not work properly on osx (using darwin ports). I have not found any other alternative. Any ideas? ...

How to insert a LC_LOAD_DYLIB command into a Mach-O binary (OSX)

I'm looking to patch a piece of abandonware with some code. The software is carbon based, so I can not use an InputManager (at least, I do not think I can). My idea was to add a dylib reference to the mach-o header, and launch a new thread when the initialization routine is called. I have mucked around with the mach-o header using a he...

reconstructing symbols stripped from Mach-O binary

Using Mac OS X 10.5 I'm trying to figure out how to use dtrace to track the execution of a Mach-O binary. However, it seems the symbols have all be stripped out so any attempts to put use probes based on internal class/method names fail. I was able to use class-dump to dump the classes, method names and the address they are implemented...

How do I embed data into a Mac OS X mach-o binary file's TEXT Section?

I have a Mac OS X command-line tool that would benefit from having some data embedded in the binary file itself. I know mach-o files support multiple segments, some of which can be used for storing arbitrary data. But I can't find a command-line tool to do that. While I know there are other, probably simpler ways (e.g. convert the data...

OS X: Do sections in the __TEXT segment get modified by other programs?

Hi, Does it happen that some program (or even the OS itself) changes the contents of an executable's __TEXT segment, for whatever reason? Note: Here, I'm referring to the "__TEXT" segment, not the "__text" section. In other words: can I rely on bytes in the __TEXT segment of my executable to detect whether my executable has been da...

Parser for 32-bit and 64-bit Mach-O binary/executable formats in C++

I'm looking for a C++ library that can parse 32-bit and 64-bit Mach-O binary format. I don't need anything fancy, just a disassembly and splitting the file into its sections, so no decompilation, name demangling and so on. I know I can either rip open any existing disassembler or craft my own binary parsers using the format specificatio...

How can I modify the strings of a binary(Mach-O) file?

Is there any way to (easily) modify a string in a Mach-O binary? I want to extend the length of a pre-existing string. ...

Editing assembly on Mac OS X

I'm currently disassembling a Mach-O executable(the executable runs on Mac OS X, to be specific) in IDA Pro on windows. I have one instruction which I want to change, but it doesn't seem that IDA Pro allows you to do this. So, I tried using otool on OS X to dump the assembly(which it does fine). However, after editing the assembly in oto...

Mach-O Executable: How to obtain pointers into the __StaticInit segment?

I am writing a program that heavily modifies the basic structure of an executable in order to obfuscate it, making disassembly and reverse-engineering tougher. I have a question about the __StaticInit segment. I know that inside an ordinary Mach-O file this segment contains code to initialize static variables. I also know that this code ...

Mach-O binaries using FASM

is anybody using FASM to produce Mach-O binaries? it's my assembler of choice and I thought it would be nice to learn whether that's possible to accomplish and whether somebody is already doing it. thanks in advance. ...

How does Mach-O loader loads different NSString objects?

I have known that If you define a bunch of @"" NSString objects in the source code in Mac OS. These NSStrings will be stored in a segment in the Mach-O library. Section sectname __ustring segname __TEXT addr 0x000b3b54 size 0x000001b7 offset 731988 align 2^1 (2) reloff 0 nreloc 0 flags 0x00000000 reserved1 0 reserve...

What library is needed for mach-o/nlist.h (Mac OS X)

I seem to have trouble finding the correct library to #include in my source code. Searched all over the web and my manpages... No result :'( Does anyone have a clue? ...

Can I run a binary file that is Mach-O executable i386 on linux?

I have a program that is Mach-O executable i386 and I was hoping to run it on a linux server. Is this possible?? If so, how? I can't see, to figure this out. Thanks! ...

How do I create a Cocoa (Obj-C) Dynamic Library for OS X?

So basically I want to create a Dynamic Library in OS X that is built utilizing Cocoa (In Obj-C, not C or C++). My question is - how do I do this? Ultimately I want the library to be loaded by another application (which I know how to do). I just don't know how to create a module utilizing Objective-C. Thanks! ...