mach-o

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

江枫思渺然 提交于 2019-11-26 18:58:27
问题 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 With Libraries" build phase link statically? Apple's docs mention loading of libraries at run time with dlopen , but how I can make Xcode create executable

Why is install_name_tool and otool necessary for Mach-O libraries in Mac Os X?

只愿长相守 提交于 2019-11-26 18:56:07
问题 I am developing a Cocoa Application using the latest version of Xcode 4, I want to link dynamic libraries to my project ( dylibs ). I read somewhere that adding the libraries in my project was not enough as I have to run install_name_tool and otool to make my project use the libraries that were bundled in my project. I have read the manual pages for install_name_tool , but I do not understand WHY I have to do this. How do libraries work? Especially interested in the part where the application

NASM compiling x86_64 ASM label addresses off by 256 bytes in Mach-O when using multiple db declarations?

我与影子孤独终老i 提交于 2019-11-26 17:17:25
问题 In short, when I have multiple db sections in my .data section, the compiled addresses/labels are off when compiled by NASM. In my testing they are off by 256 bytes in the resulting Mach-O binary. Software I am using: OS X 10.10.5 nasm NASM version 2.11.08, installed via Homebrew as required for x84_64 ASM gobjdump GNU objdump (GNU Binutils) 2.25.1, installed via Homebrew clang Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn) What works: Take for example the following "hello

Linux Mach-O Disassembler

旧街凉风 提交于 2019-11-26 15:49:52
问题 Are there any Linux programs that can disassemble an OSX universal x86/x86_64 fat Mach-O binary like objdump? GNU binutils' objdump supports ELF and Windows PE files but not Mach-O. 回答1: AFAIK, the native Darwin binary tools are part of the cctools package. They don't have the same command line syntax or output as the GNU binutils. Later binutils (i.e., 2.22) supports the Mach-O format however. You can get these prebuilt, with the ' g ' prefix to the tool names, as mentioned here.

Found an unexpected Mach-O header code: 1918975009 in xCode 6

空扰寡人 提交于 2019-11-26 15:48:08
问题 What causes the error Found an unexpected Mach-O header code: 1918975009 in xCode 6 I archived my project to send out as an ad hoc build and it builds/links/archives just fine but when I'm in the xCode organizer and select Export -> Ad Hoc , I get the error Found an unexpected Mach-O header code: 191897500. 回答1: I had the same error. In my case it was caused by an universal framework that I accidentally copied into the resources of the app (which is unnecessary, since frameworks get merged

Mach-O 64-bit format does not support 32-bit absolute addresses. NASM Accessing Array

烈酒焚心 提交于 2019-11-26 00:44:57
问题 Running this code off my Mac computer, using command: nasm -f macho64 -o max.a maximum.asm This is the code I am attempting to run on my computer that finds the largest number inside an array. section .data data_items: dd 3,67,34,222,45,75,54,34,44,33,22,11,66,0 section .text global _start _start: mov edi, 0 mov eax, [data_items + edi*4] mov ebx, eax start_loop: cmp eax, 0 je loop_exit inc edi mov eax, [data_items + edi*4] cmp eax, ebx jle start_loop mov ebx, eax jmp start_loop loop_exit: mov

Mach-O 64-bit format does not support 32-bit absolute addresses. NASM Accessing Array

陌路散爱 提交于 2019-11-25 22:54:52
Running this code off my Mac computer, using command: nasm -f macho64 -o max.a maximum.asm This is the code I am attempting to run on my computer that finds the largest number inside an array. section .data data_items: dd 3,67,34,222,45,75,54,34,44,33,22,11,66,0 section .text global _start _start: mov edi, 0 mov eax, [data_items + edi*4] mov ebx, eax start_loop: cmp eax, 0 je loop_exit inc edi mov eax, [data_items + edi*4] cmp eax, ebx jle start_loop mov ebx, eax jmp start_loop loop_exit: mov eax, 1 int 0x80 Error: maximum.asm:14: error: Mach-O 64-bit format does not support 32-bit absolute