bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/17955] New: Wrong address difference on 64-bit Windows


From: fanael4 at gmail dot com
Subject: [Bug ld/17955] New: Wrong address difference on 64-bit Windows
Date: Tue, 10 Feb 2015 21:40:20 +0000

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]