mach-o

What's the meaning of dylib files?

最后都变了- 提交于 2020-01-03 09:04:25
问题 My C++ compiler creates "dylib" files which contain dynamic libraries. Whats the difference between .dylib and .so files? And what is the difference between files in Mach-O format and files in an ELF format? I have to build files for later use under iOS (static libraries only/Mach-O) and Android (ELF). Thanx! 回答1: I found that: One Mach-O feature that hits many people by surprise is the strict distinction between shared libraries and dynamically loadable modules. On ELF systems both are the

why am I getting error: Mach-O 64-bit format does not support 32-bit absolute addresses [duplicate]

早过忘川 提交于 2019-12-31 07:05:42
问题 This question already has an answer here : Mach-O 64-bit format does not support 32-bit absolute addresses. NASM Accessing Array (1 answer) Closed last year . %include "along64.inc" default rel section .data EnterMsg : db "Enter a number to add to the list; enter 0 when you done" ,0ah,0 ExitMsg : db "The sorted list: " ,0ah,0 InputError1 : db "Input Error; Integers Only" ,0ah,0 InputError2 : db "Input Error; Maximum list is 100" ,0ah,0 InputError3 : db "Input Error; Enter AT LEAST ONE Int"

Changing function reference in Mach-o binary

我的未来我决定 提交于 2019-12-23 06:07:33
问题 I need to change to reference of a function in a mach-o binary to a custom function defined in my own dylib. The process I am now following is, Replacing references to older functions to the new one. e.g _fopen to _mopen using sed. I open the mach-o binary in MachOView to find the address of the entities I want to change. I then manually change the information in the binary using a hex editor. Is there a way I can automate this process i.e write a program to read the symbols, and dynamic

MacOSX: find out if a process (given a PID) is running in 32bit or in 64bit Intel mode

落花浮王杯 提交于 2019-12-22 12:40:09
问题 I have a PID and I want to find out if the process is running in 32bit or in 64bit Intel mode. How? 回答1: I can do via NSRunningApplication. [[NSRunningApplication runningApplicationWithProcessIdentifier:pid] executableArchitecture] returns the Mach-O architecture constant. This works only for GUI applications, though... 来源: https://stackoverflow.com/questions/7335245/macosx-find-out-if-a-process-given-a-pid-is-running-in-32bit-or-in-64bit-inte

Assembler Error: Mach-O 64 bit does not support absolute 32 bit addresses

偶尔善良 提交于 2019-12-19 07:49:37
问题 So I'm learning x86_64 nasm assembly on my mac for fun. After hello world and some basic arithmetic, I tried copying a slightly more advanced hello world program from this site and modifying it for 64 bit intel, but I can't get rid of this one error message: hello.s:53: error: Mach-O 64-bit format does not support 32-bit absolute addresses . Here is the command I use to assemble and link: nasm -f macho64 hello.s && ld -macosx_version_min 10.6 hello.o . And here is the relevant line: cmp rsi,

Crash reading bytes from getsectbyname

不打扰是莪最后的温柔 提交于 2019-12-18 11:59:57
问题 UPDATE : Answer below in question, thanks to Greg Parker's pointer… I uploaded a sample project here, but I'll describe it as well: https://github.com/tewha/getsectbyname-crash I get a crash from my my (64-bit only) executable, but not when run from Xcode . If I run it from Terminal or Instruments , however, it crashes. This is not a Debug vs. Release configuration problem; running the Debug executable in Terminal also crashes. Running the Release executable from Xcode works. I am trying to

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

删除回忆录丶 提交于 2019-12-18 11:56:31
问题 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 hexeditor to add the appropriate load command (LC_ LOAD_DYLIB). otool reports what I expect to see, so I'm fairly confident that the file is correctly formatted.

Determine minimum OSX version a binary was compiled for

独自空忆成欢 提交于 2019-12-17 17:55:21
问题 When using Clang's or GCC's Darwin backends to create executables for OSX, the flag -mmacosx-version-min=version can be used to set the earliest version of OSX the executable will run on. Is there any way to trace back from a given executable which flag was used to compile it? I.e. is there a way to determine which minimum OSX version is targeted by a given executable? 回答1: Use otool -l /path/to/binary and inspect the LC_VERSION_MIN_MACOSX load command; specifically, the version field. For

How to create an iPhone mach-o file?

ぐ巨炮叔叔 提交于 2019-12-14 03:31:52
问题 How can I create a HelloWorld iPhone mach-o file? I want to test it on my jailbreak iPhone. Help me please!!! 回答1: I found this when I googled around on the web for you. http://mobiforge.com/developing/story/getting-started-with-iphone-development It talks about how to create your first "Hello World" application. 回答2: Here's the documentation for the Mach-O format from Apple: http://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/MachORuntime/Reference/reference.html

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

隐身守侯 提交于 2019-12-13 18:33:03
问题 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! 回答1: There is currently no working Mach-O loader for Linux. 来源: https://stackoverflow.com/questions/3205986/can-i-run-a-binary-file-that-is-mach-o-executable-i386-on-linux