1

Is there a GAS equivalent to NASM's 'DEFAULT REL' directive?

I'm trying to port some NASM assembly to GAS and specifically, I'm getting hung up on storage declared with CEXTERN in the original file.

The original NASM:

SECTION .text
cextern pw_8000
...
...
    movq   m7, [pw_8000]

When I assemble the file and try to link it, I see the following:

ld: common/x86/dct-a.o: relocation R_X86_64_32S against `x264_pw_8000' can not be used when making a shared object; recompile with -fPIC

With YASM, calling DEFAULT REL seems to fix this. I have no idea how to do this with GAS.

Any ideas?

EDIT: It seems according to this post that the move command can be written as

movq   m7, [rip+pw_8000]

Does anyone know if this is correct

Sam Hosseini
  • 813
  • 2
  • 9
  • 17
Faluzure
  • 59
  • 6
  • Yes, that is correct assuming you are using intel syntax and `m7` has been defined as an alias to a register. – Jester May 07 '15 at 22:21

1 Answers1

1

Yep. Turns out it this is correct:

movq m7, [rip+pw_8000]

Faluzure
  • 59
  • 6