libclc SPIRV backend Unresolved external reference to "_Z37__clc_flush_denormal_if_not_supportedf"
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
When building libclc 22.1.0 using the SPRIV backend I get the following error:
```
FAILED: [code=1] spirv-mesa3d-.spv /var/tmp/portage/llvm-core/libclc-22.1.0-r1/work/libclc_build/spirv-mesa3d-.spv
cd /var/tmp/portage/llvm-core/libclc-22.1.0-r1/work/libclc_build && /usr/lib/llvm/22/bin/clang --target=spirv32-- -x ir -o /var/tmp/portage/llvm-core/libclc-22.1.0-r1/work/libclc_build/spirv-mesa3d-.spv /var/tmp/portage/llvm-core/libclc-22.1.0-r1/work/
libclc_build/obj.libclc.dir/spirv-mesa3d-/builtins.link.spirv-mesa3d-.bc
error: 0: Unresolved external reference to "_Z37__clc_flush_denormal_if_not_supportedf".
```
I can work around it using:
```
diff --git a/libclc/clc/include/clc/math/math.h b/libclc/clc/include/clc/math/math.h
index c2647f66b400..b6a2c864d522 100644
--- a/libclc/clc/include/clc/math/math.h
+++ b/libclc/clc/include/clc/math/math.h
@@ -65,7 +65,7 @@ bool __attribute__((noinline)) __clc_runtime_has_hw_fma32(void);
#define LOG_MAGIC_NUM_SP32 (1 + NUMEXPBITS_SP32 - EXPBIAS_SP32)
-_CLC_OVERLOAD _CLC_INLINE float __clc_flush_denormal_if_not_supported(float x) {
+_CLC_OVERLOAD static _CLC_INLINE float __clc_flush_denormal_if_not_supported(float x) {
int ix = __clc_as_int(x);
if (!__clc_fp32_subnormals_supported() && ((ix & EXPBITS_SP32) == 0) &&
((ix & MANTBITS_SP32) != 0)) {
```
Contributor guide
Research direction
Start with libclc/clc/include/clc/math/math.h, especially the __clc_flush_denormal_if_not_supported declaration and definition, then reproduce the reported SPIRV backend build. Check how builtins.link.spirv-mesa3d-.bc is assembled and verify that the build completes without the unresolved external reference.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100