https://sourceware.org/bugzilla/show_bug.cgi?id=17955
Bug ID: 17955
Summary: Wrong address difference on 64-bit Windows
Product: binutils
Version: 2.26 (HEAD)
Status: NEW
Severity: normal
Priority: P2
Component: ld
Assignee: unassigned at sourceware dot org
Reporter: fanael4 at gmail dot com
On 64-bit Windows, when calculating a 64-bit address difference between two
labels in different sections, the value will be off.
This program should not abort, but it does:
.text
.intel_syntax noprefix
c: .quad a - mainCRTStartup
.def mainCRTStartup
.scl 2
.type 32
.endef
.globl mainCRTStarup
.extern abort
mainCRTStartup:
sub rsp, 40
movabs rax, offset a
movabs rcx, offset mainCRTStartup
mov rdx, [c]
sub rax, rcx
cmp rax, rdx
jne 1f
xor eax, eax
add rsp, 40
ret
1:
call abort
.section .rdata,"dr"
a: .quad 0
The value under "c" is 4092, while the actual difference is 4088.
If "a" is moved to .text, or if "c" is a .long instead of a .quad, the problem
disappears.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-binutils