[Issue 22173] New: Target functions called through PLT in thunks

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Aug 3 10:13:48 UTC 2021


          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 at puremagic.com
          Reporter: ibuclaw at gdcproject.org

Inside _THUNKs, DMD calls functions through PLT.
sub    $0x8,%eax
jmp    0xf7f06970 <_D5mydll1C3fooMFCQp1IZCQvQr at 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.


More information about the Digitalmars-d-bugs mailing list