www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22173] New: Target functions called through PLT in thunks

https://issues.dlang.org/show_bug.cgi?id=22173

          Issue ID: 22173
           Summary: Target functions called through PLT in thunks
           Product: D
           Version: D2
          Hardware: x86
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ibuclaw gdcproject.org

Inside _THUNKs, DMD calls functions through PLT.
---
sub    $0x8,%eax
jmp    0xf7f06970 <_D5mydll1C3fooMFCQp1IZCQvQr plt>
---

This is bad because it means the GOT needs to be loaded inside EBX before the
JMP, else a segfault occurs (see issue 9729, and issue 22170).


GDC instead calls the aliased symbol directly:
---
subl   $0x8,0x4(%esp)
jmp    0xf7f34ffb <_D5mydll1C3fooMFCQp1IZCQvQr>
---

DMD 32-bit PIC should be more like GDC 32-bit PIC to avoid this trap.

--
Aug 03