llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.91k stars 11.51k forks source link

Unresolved external symbol in X86 inline asm after r314493/r314494 #34638

Open llvmbot opened 6 years ago

llvmbot commented 6 years ago
Bugzilla Link 35290
Version unspecified
OS Windows NT
Blocks llvm/llvm-project#11360
Reporter LLVM Bugzilla Contributor
CC @jrmuizel,@RKSimon,@rnk

Extended Description

I bisected this to r314493/r314494:

$ cat yuv_row_table.cpp
extern const int kCoefficientsRgbY[1];
const int kCoefficientsRgbY[1] = {0};
int main() { return 0; }

$ cat yuv_row_win.cpp
extern const int kCoefficientsRgbY[1];
void FastConvertYUVToRGB32Row_SSE() {
  __asm {
    movq      mm1, [kCoefficientsRgbY + 8 * eax]
  }
}

$ clang-cl.exe -m32 yuv_row_table.cpp yuv_row_win.cpp
yuv_row_win-f72966.obj : error LNK2019: unresolved external symbol kCoefficientsRgbY referenced in function "void __cdecl FastConvertYUVToRGB32Row_SSE(void)" (?FastConvertYUVToRGB32Row_SSE@@YAXXZ)
yuv_row_table.exe : fatal error LNK1120: 1 unresolved externals
llvmbot commented 6 years ago

it's basically due to the use of mangled names, which aforementioned patches/revs aren't bothered with introducing as part of the (IR) incarnation of the inline-asm string. fix is relatively easy (and ugly), hope i'll get there anytime soon

llvmbot commented 2 months ago

@llvm/issue-subscribers-backend-x86

Author: None (llvmbot)

| | | | --- | --- | | Bugzilla Link | [35290](https://llvm.org/bz35290) | | Version | unspecified | | OS | Windows NT | | Blocks | llvm/llvm-project#11360 | | Reporter | LLVM Bugzilla Contributor | | CC | @jrmuizel,@RKSimon,@rnk | ## Extended Description I bisected this to r314493/r314494: ```console $ cat yuv_row_table.cpp extern const int kCoefficientsRgbY[1]; const int kCoefficientsRgbY[1] = {0}; int main() { return 0; } $ cat yuv_row_win.cpp extern const int kCoefficientsRgbY[1]; void FastConvertYUVToRGB32Row_SSE() { __asm { movq mm1, [kCoefficientsRgbY + 8 * eax] } } $ clang-cl.exe -m32 yuv_row_table.cpp yuv_row_win.cpp yuv_row_win-f72966.obj : error LNK2019: unresolved external symbol kCoefficientsRgbY referenced in function "void __cdecl FastConvertYUVToRGB32Row_SSE(void)" (?FastConvertYUVToRGB32Row_SSE@@YAXXZ) yuv_row_table.exe : fatal error LNK1120: 1 unresolved externals ```