I am converting some code from Intel Syntax to AT&T syntax.
I have the folowing code, that loads a GDT, and does a far jump using the loaded GDT, defined in the .rodata
section.
.global start
.extern long_mode_start
.section .text
start:
lgdt (gdt64.pointer)
jmp $gdt64.code, $long_mode_start
.section .rodata
gdt64:
.quad 0 # zero entry
.equ gdt64.code, 0x08
.quad (1<<43) | (1<<44) | (1<<47) | (1<<53) # code segment
gdt64.pointer:
.word . - gdt64 - 1
.quad gdt64
The problem is that I have to put the .rodata
section before the .text
section on the file, otherwise the assembler complains: Error: can't handle non absolute segment in `jmp'
, which makes me think that it's assuming it is an external symbol, even though I didn't say so.
Is there any way to make this work with the .rodata
section in any place in the file, or does it really have to be before the .text
section?