Can`t build shared library with RIP-relative addressing and Intel asm-syntax
Original Reporter info from Mantis: Bishop
-
Reporter name: Emelyanov Roman
Original Reporter info from Mantis: Bishop
- Reporter name: Emelyanov Roman
Description:
I need to build shared library for linux with asm block in it.
I try it with this simple source:
Library DLL;
{$MODE OBJFPC}
Var Val: QWord;
Function Test: QWord; Assembler; NoStackFrame;
Asm
MOV RAX, [Val]
End;
Exports Test;
BEGIN Val := 1; END.
And its fail with msg: DLL.lpr(9,15) Error: Generating PIC, but reference is not PIC-safe<br/> I undestand why it can
t be compiled, so i change my code to:
MOV RAX, [RIP+Val] //This is RIP-relative addressing mode, so it can be used with PIC. But compilation fail with same msg. Is it a bug? Or possible i write something wrong?
Steps to reproduce:
Library DLL;
{$MODE OBJFPC}
Var Val: QWord;
Function Test: QWord; Assembler; NoStackFrame;
Asm
MOV RAX, [RIP+Val]
End;
Exports Test;
BEGIN Val := 1; END.
Additional information:
With AT&T assembler syntax its work, but i have huge lib that write in intel syntax, so i need to compile with it.
Mantis conversion info:
- Mantis ID: 22665
- OS: Linux
- OS Build: CentOS 6.3
- Build: 22107
- Platform: x86_64
- Version: 2.7.1
- Fixed in version: 3.0.0
- Fixed in revision: 22243 (#4d0e4e1b)