[clang] [Clang][CodeGen] Lookup standard library declarations for builtins to… (PR #204792)

Hans Wennborg via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 23 04:51:25 PDT 2026


zmodem wrote:

I'm not sure I agree with all that, but here's another test case:

```
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? If we do, I think `getBuiltinLibFunction` needs to learn how to call these CRT functions directly, without relying on the header.

---

> On Linux (ext4 hash order), PCM static initialization chains happened to deserialize "hypotf" before CodeGen; on Windows (NTFS alphabetical order), it did not.

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?

https://github.com/llvm/llvm-project/pull/204792


More information about the cfe-commits mailing list