[clang] [Clang][Hexagon] Use --cstdlib flag to choose Picolibc (PR #183257)

via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 17 01:14:36 PDT 2026


quic-k wrote:

>  Wouldn't it be cleaner to use the libc choice to choose the base sysroot path and keep all other paths relative to sysroot, in a common code path

agreed, need to add C++ includes as `/c++/v1` on top of libc's include path

> We also duplicate a lot of code by special casing everything

I created a separate function constructHexagonPicolibcLinkArgs() but maybe thats not needed
maybe we can just have all the logic in one function constructHexagonLinkArgs() with multiple 
```
if(default_libc) else if (picolibc){}
```
tbh I don't know which approach is better as both have their tradeoffs


single function won't have duplicate code, but it will have a lot of if else for the C library choice, and not as easy to read as multiple functions

multiple functions do duplicate some code, but since the code is separate, its easier to read and implement
but it also means, if we need to add a common arg in future, we will have to add it in multiple functions

do you think its better to have single function? @quic-akaryaki 

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


More information about the cfe-commits mailing list