[llvm-bugs] [Bug 33106] New: COFF LLD should not allow delay loading data symbols

via llvm-bugs llvm-bugs at lists.llvm.org
Fri May 19 11:16:55 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=33106

            Bug ID: 33106
           Summary: COFF LLD should not allow delay loading data symbols
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: COFF
          Assignee: unassignedbugs at nondot.org
          Reporter: peter at pcc.me.uk
                CC: llvm-bugs at lists.llvm.org

>type dll.c
__declspec(dllexport) int i = 42;

>type exe.c
#include <stdio.h>

__declspec(dllimport) extern int i;

int main() {
  printf("%d\n", i);
}

>cl /c dll.c
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

dll.c

>link dll.obj /out:dll.dll /dll
Microsoft (R) Incremental Linker Version 14.00.24215.1
Copyright (C) Microsoft Corporation.  All rights reserved.

   Creating library dll.lib and object dll.exp

>cl /c exe.c
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

exe.c

>link exe.obj dll.lib /delayload:dll.dll /out:exe.exe
Microsoft (R) Incremental Linker Version 14.00.24215.1
Copyright (C) Microsoft Corporation.  All rights reserved.

LINK : fatal error LNK1194: cannot delay-load 'dll.dll' due to import of data
symbol '__imp_i'; link without /DELAYLOAD:dll.dll

>lld-link exe.obj dll.lib /delayload:dll.dll /out:exe.exe /alternatename:__delayLoadHelper2=main

>exe
1346458193

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170519/9b303200/attachment.html>


More information about the llvm-bugs mailing list