• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Absolute Addressing and asm
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Absolute Addressing and asm


  • Subject: Re: Absolute Addressing and asm
  • From: Terry Lambert <email@hidden>
  • Date: Sat, 8 May 2010 00:24:07 -0700


On May 7, 2010, at 1:24 PM, Duane Murphy wrote:
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?

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.

-- Terry
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Absolute Addressing and asm (From: Duane Murphy <email@hidden>)

  • Prev by Date: Re: jemalloc to replace default allocator
  • Next by Date: darwin vs linux linkage visibility issues
  • Previous by thread: Absolute Addressing and asm
  • Next by thread: darwin vs linux linkage visibility issues
  • Index(es):
    • Date
    • Thread