Current AVR clang driver assumes sysroot to be fixed "/" and omits
user specified "--sysroot" option. And this patch fixes that.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/lib/Driver/ToolChains/AVR.cpp | ||
---|---|---|
369 | This should call ToolChain::GetProgramPath instead |
There is a use of GetProgramPath at above line.
std::string Linker = getToolChain().GetProgramPath(getShortName());
I use a better solution that add user specified sysroot to ProgramPath via GetProgramPaths.push_back().
The test "make check-clang-driver -j8" passes both with and without avr-ld/avr-libc installed.
clang/lib/Driver/ToolChains/AVR.cpp | ||
---|---|---|
426 | My feeling is that empty --sysroot should mean /, instead of /usr. You probably need to read other ToolChains/*.cpp files first |
I also think that sysroot means /, but the basic_riscv32_tree seems to assume sysroot to be /usr. However I change my patch to / as you suggested.
clang/lib/Driver/ToolChains/AVR.cpp | ||
---|---|---|
339 |
Many toolchains just use GCC's program paths, which auto include user specified sysroot. So I simplify it use AVR-GCCInstallation as first choice, then class ToolChain's default behavior. |
Would be nice not needing to hard code /usr/bin. How do other toolchains do?