http://sourceware.org/bugzilla/show_bug.cgi?id=12914

           Summary: dllwrap creates wrong DLLs with repeated fixups for
                    same address
           Product: binutils
           Version: 2.20
            Status: NEW
          Severity: normal
          Priority: P2
         Component: binutils
        AssignedTo: unassig...@sources.redhat.com
        ReportedBy: anp...@mail.ru


Sometimes dllwrap generates relocation tables which contain multiple entries
for same address. This leads to fixups being applied TWICE, and then, most
likely, to a fault. This problem is not noticeable if DLL loads to the "desired
base address", but instantly pops up if the desired address is occupied by
other library.

Testcase: create a sinle file named test.c:

--------------------------------
int x;

__declspec (dllexport) int test ()
{
  x = 0;
  return 1;
}
--------------------------------

Now create a DLL from it:

i686-pc-mingw32-gcc -c test.c
i686-pc-mingw32-dllwrap -o test.dll test.o

Now examine its relocation table:

i686-pc-mingw32-objdump --all test.dll |less

(for some reason objdump -r does not display relocations, but with --all it
does).

Now navigate to relocation table and see:

Virtual Address: 00001000 Chunk size 88 (0x58) Number of fixups 40
    reloc    0 offset    d [100d] HIGHLOW
    reloc    1 offset   15 [1015] HIGHLOW
    reloc    2 offset   3d [103d] HIGHLOW
    reloc    3 offset   45 [1045] HIGHLOW
    reloc    4 offset   69 [1069] HIGHLOW
    reloc    5 offset   73 [1073] HIGHLOW
    reloc    6 offset   88 [1088] HIGHLOW
[... skipped ...]
Virtual Address: 00001000 Chunk size 84 (0x54) Number of fixups 38
    reloc    0 offset    d [100d] HIGHLOW
    reloc    1 offset   15 [1015] HIGHLOW
    reloc    2 offset   3d [103d] HIGHLOW
    reloc    3 offset   45 [1045] HIGHLOW
    reloc    4 offset   69 [1069] HIGHLOW
    reloc    5 offset   73 [1073] HIGHLOW
    reloc    6 offset   88 [1088] HIGHLOW

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- 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