• 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: x86-64 asm question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: x86-64 asm question


  • Subject: Re: x86-64 asm question
  • From: Cyrus Harmon <email@hidden>
  • Date: Tue, 5 Sep 2006 08:05:55 -0700

Thanks Eric and Scott,

That seems to fix things.

Cyrus

On Sep 4, 2006, at 8:22 PM, Eric Albert wrote:

Scott is right; you do have to make this a RIP-relative reference. Mac OS X doesn't currently support any non-PIC code models for x86-64. We don't have any plans to do that in the near term, either, since non-PIC code wouldn't have any significant performance benefit for Mac OS X today.

The correct reference here is
mov _all_threads@GOTPCREL(%rip), %rax
If _all_threads is defined in the same translation unit (i.e. within this .s file), you can write this instead:
mov _all_threads(%rip), %rax


Hope this helps,
Eric

On Sep 4, 2006, at 5:06 PM, Cyrus Harmon wrote:

The linux version of gas (with .global, not just .globl) seems to handle this code fine. Is it implicitly doing some sort of IP- relative indexing? Is there something weird about Apple's assembler going on here? I'm willing to believe that I need to do some %rip relative addressing, I'm just not convinced that the way I'm trying to do it is giving me the right results (or, really, what those should look like).

I tried something similar before, and got it to compile, but wasn't sure if that was the right approach. Some docs on 1) if this needs to be done realtive to %rip, and 2) how to properly do so, would be great.

Thank,

Cyrus

On Sep 4, 2006, at 4:56 PM, Scott Lamb wrote:

On Sep 4, 2006, at 3:57 PM, Cyrus Harmon wrote:
So, using gas I'm trying to port some x86 assembly code that refers to an external symbol:

 .text
 .globl _all_threads
...
...
 mov _all_threads,%rax
...

the error  message I get is:

x86-64-assem.S:133:32-bit absolute addressing is not supported for x86-64

That works on x86 (well, with �x, of course), but I can't seem to figure out how to do this on x86-64, or any relevant docs on Apple's x86-64 assembler.

IIRC, x86_64 uses IP-relative addresses. And in a x64_64-linux project of mine, I found this line:


    movl    sigsafe_key_(%rip), �i

--
Scott Lamb <http://www.slamb.org/>



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40outofcheese.org


This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >x86-64 asm question (From: Cyrus Harmon <email@hidden>)
 >Re: x86-64 asm question (From: Scott Lamb <email@hidden>)
 >Re: x86-64 asm question (From: Cyrus Harmon <email@hidden>)
 >Re: x86-64 asm question (From: Eric Albert <email@hidden>)

  • Prev by Date: Re: Why do I have a ppc-only libc?
  • Next by Date: Re: Aggregate Project and how to force targets to use a particular configuration
  • Previous by thread: Re: x86-64 asm question
  • Next by thread: Resolving EXC_BAD_INSTRUCTION (Where do I begin?)
  • Index(es):
    • Date
    • Thread