This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Fix the include search path order between sysroot and resource folder
ClosedPublic

Authored by kito-cheng on Feb 15 2022, 5:37 AM.

Details

Summary

Resource folder[1] should include before sysroot[2] in general (Linux clang
toolchain, BareMetal clang toolchain, and GCC using that order), and that
prevent sysroot's header file override resource folder's one, this change is
reference from BareMetal::AddClangSystemIncludeArgs@BareMetal.cpp[3].

And also fix the behavior of -nobuiltininc.

[1] Include path from resource folder is something like this: <toolchain-path>/lib/clang/13.0.0/include/
[2] Include path from sysroot is something like this: <toolchain-path>/riscv32-unknown-elf/include
[3] https://github.com/llvm/llvm-project/blob/llvmorg-13.0.1/clang/lib/Driver/ToolChains/BareMetal.cpp#L193

Diff Detail

Event Timeline

kito-cheng created this revision.Feb 15 2022, 5:37 AM
kito-cheng requested review of this revision.Feb 15 2022, 5:37 AM
asb accepted this revision.Feb 16 2022, 6:31 AM

Thanks Kito. This LGTM, but I'd appreciate someone else reviewing and approving as well.

This revision is now accepted and ready to land.Feb 16 2022, 6:31 AM
abidh added a comment.Feb 16 2022, 6:38 AM

Thanks Kito. This LGTM, but I'd appreciate someone else reviewing and approving as well.

Looks ok to me too.

This revision was landed with ongoing or failed builds.Feb 20 2022, 10:06 PM
This revision was automatically updated to reflect the committed changes.