Re: Absolute Addressing and asm
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com We are adding some assembly optimizations to our code. We are running into a problem with text relocations. I'm looking for suggestions for articles or information on how to go about fixing this problem. The linker returns: ld: absolute addressing (perhaps -mdynamic_no_pic) used in (some function) from (path to some library) not allowed in slidable image. Use '--read_only_relocs suppress' to enable text relocs The function and file identified in the library are part of our assembly optimizations. This happens when linking a library built with the assembly code into a framework (aka dylib). Looking at the code, the problem stems from access to an external table. The table is compiled in a .c file. The assembler has no (automatic) way of constructing a relative address to that table. This apparently leaves the linker to work out what the address is, which leaves the assembly in a state where it wants an absolute address. (Yes, some of this is guessing, which is why I am asking. :-) I am also working towards using this same code in a kext which, I expect, will have similar issues. Can anyone recommend reading or suggestions for how to resolve this situation? -- Terry _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... On May 7, 2010, at 1:24 PM, Duane Murphy wrote: Write C code to reference the table and do a gcc -S on it and look at how the compiler writes its assembly to reference it, and write your assembly the same way. FWIW: You are probably trying to hard here, and would be better off writing C code and using the ASM() directive to embed assembly. This email sent to site_archiver@lists.apple.com
participants (1)
-
Terry Lambert