[clang] [Clang][CodeGen] Lookup standard library declarations for builtins to… (PR #204792)
Takuto Ikuta via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 24 01:55:56 PDT 2026
atetubou wrote:
```
int main() {
return (int)__builtin_hypotf(1.0, 2.0);
}
> build\bin\clang-cl \src\temp\a.c -MD
a-5d7192.obj : error LNK2019: unresolved external symbol hypotf referenced in function main
a.exe : fatal error LNK1120: 1 unresolved externals
clang-cl: error: linker command failed with exit code 1120 (use -v to see invocation)
```
> Do we want that to work?
I'm still not sure how to handle this case. But let me try to add dllimport to builtins when /MD is given.
> Regardless of the issue above, this sounds like there's non-determinism in what the AST looks like by the time we hit getBuiltinLibFunction, which seems like a big problem in itself?
I can reproduce the link error on Linux with https://github.com/atetubou/llvm-project/commit/974a75affd82fb891fe3c8ae953e283580ea26df and this PR also fixed that. So order of directory iteration seems the trigger of this issue.
> This example shows something completely different than the PR description implies, and makes the proposed fix seem even less valid.
I updated PR description, but I may not understand your intention correctly.
https://github.com/llvm/llvm-project/pull/204792
More information about the cfe-commits
mailing list