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

            Bug ID: 16835
           Summary: PE/COFF:  __image_base__ and __ImageBase have
                    different values
           Product: binutils
           Version: 2.25 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: corinna at vinschen dot de

Created attachment 7549
  --> https://sourceware.org/bugzilla/attachment.cgi?id=7549&action=edit
Fix __ImageBase value for DLLs rebased to a fixed value in the .def file

When building DLLs with a .def file which also provides a fixed
image base address, then the values of __image_base__ and __ImageBase
differ.

The value of __image_base__ is correct (on 32 bit), the value of
__ImageBase looks weird.

The reason is that ld first evaluates the default address for
__image_base__ and then sets __ImageBase to the same value.  However,
when ld encounters another image base address in the .def file, it
sets the value of __image_base__, but neglects to set __ImageBase
to the same value.

I attached a patch suggestion.

This patch does, of course, not fix the problem that both values,
__image_base__ as well as __ImageBase, are still truncated to 32 bit
on x86_64, if the DLL or executable is located at an address beyond
the lowest 32 bit memory address space.


Corinna

-- 
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