[llvm] r239560 - Object: Prepend __imp_ when mangling a dllimport symbol in IRObjectFile.

Rafael EspĂ­ndola rafael.espindola at gmail.com
Tue Jun 23 04:18:18 PDT 2015


> --- llvm/trunk/test/Object/dllimport.ll (added)
> +++ llvm/trunk/test/Object/dllimport.ll Thu Jun 11 16:42:18 2015
> @@ -0,0 +1,17 @@
> +; RUN: llvm-as %s -o - | llvm-nm - | FileCheck %s
> +
> +target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
> +target triple = "x86_64-pc-windows-msvc"
> +
> +; CHECK: U __imp_f
> +; CHECK: U __imp_v
> +; CHECK: T g
> +
> +declare dllimport void @f()
> + at v = external dllimport global i32
> +
> +define void @g() {
> +  call void @f()
> +  store i32 42, i32* @v
> +  ret void
> +}

What should this do for

declare dllimport void @g()
@gp = constant void ()* @g

Should there be an undefined reference to _g or _imp_g? I am guessing
both work since this is here just to cause the linker to fetch/keep
all the necessary bits from other object files and archives and both
undefined symbols will have that effect. In the end it will get a real
object and that is when it has to construct thunks.

In any case, could you add that test with a comment?

But then again, if that is the case, why do we ever need to produce a
_imp_* undefined symbol in here?

Cheers,
Rafael



More information about the llvm-commits mailing list