-
Notifications
You must be signed in to change notification settings - Fork 15k
Add support for sysroot-relative system header search paths #82084
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
etcwilde
merged 1 commit into
llvm:main
from
etcwilde:ewilde/add-isystem-idirafter-iquote-sysroot-support
Mar 19, 2024
+53
−15
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @etcwilde @jansvoboda11 , I have a question about why
IsSysrootSpecifiedis required, since the sysroot could use default sysroot defined in toolchain. For gcc, it is not required.If dir begins with ‘=’ or $SYSROOT, then the ‘=’ or $SYSROOT is replaced by the sysroot prefix; see --sysroot and -isysroot.So it will replace sysroot defined in toolchain, as tested below:
-isystem=/include/libncrt:xxxxx/gcc/bin/../riscv64-unknown-elf/include/libncrt, this is expected-isystem=/include/libncrt: ignoring nonexistent directory "=/include/libncrt"Could this feature be added in llvm to match what is done in gcc's behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey! Do you have any feedback regarding the above question? Thanks a ton!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding is that with this patch, whenever is sysroot specified we match the GCC behavior (assuming the
=spelling). Are you specifically asking to add a fallback to<clang>/../<target>/include?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jansvoboda11 for your reply.
I found my issue reported is caused by this
llvm-project/clang/lib/Driver/ToolChains/Clang.cpp
Lines 1084 to 1092 in 53c785d
The
sysrootreturned is empty, but actually it can be computed like thisgetToolChain().computeSysRoot(), for my case, it is done inllvm-project/clang/lib/Driver/ToolChains/BareMetal.cpp
Line 165 in 53c785d
And locally I modified the code
clang/lib/Driver/ToolChains/Clang.cppin my side like this, then it fixed my issue.Regarding
Are you specifically asking to add a fallback to/..//include?I think it will be good, since the
=is not handled correctly, it directly returned invalid path=/include/libncrtnot a sysroot path +/include/libncrtThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, thanks for explaining. Do you mind creating a PR? That seems like a reasonable path forward.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I will try to create a PR later.