https://sourceware.org/bugzilla/show_bug.cgi?id=17712

            Bug ID: 17712
           Summary: Invalid relocation record for pe-x86-64 absolute
                    addresses.
           Product: binutils
           Version: 2.24
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gas
          Assignee: unassigned at sourceware dot org
          Reporter: m at rolle dot name

This appears in the gas testsuite, for file
gas/testsuite/gas/i386/x86-64-branch.d.
The .s file contains four branches to absolute addressed, the first one being
    call    0x100040
Calling objdump -r on the .o file shows

$ objdump -r x86-64-branch.o

x86-64-branch.o:     file format pe-x86-64

RELOCATION RECORDS FOR [.text]:
OFFSET           TYPE              VALUE
000000000000001b R_X86_64_PC32     *ABS*
000000000000003f R_X86_64_PC32     *ABS*
0000000000000020 R_X86_64_PC32     *ABS*
0000000000000044 R_X86_64_PC32     *ABS*

In the .o file, the relocation records have a symbol index of -1.  This is not
allowed by COFF standard.  And in fact, the Windows DUMPBIN program crashes
when analyzing the reloc records.

A reloc MUST refer to an existing symbol in the COFF symbol table.

I suggest one of two remedies:

1 (preferred), don't have a reloc record at all.  The absolute address is
already contained in the instruction code.

2 Create some dummy entry in the symbol table with a section of -1 and a value
of 0, and relocate to this symbol.  Problem will be in choosing a symbol name
that won't conflict with anything else.

My version of gas is:
$ as -v
GNU assembler version 2.24.51 (x86_64-pc-cygwin) using BFD version (GNU
Binutils) 2.24.51.20140703

-- 
You are receiving this mail because:
You are on the CC list for the bug.

_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to