-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add 'native' to -C target-cpu=help #44407
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
Conversation
r? @aturon (rust_highfive has picked a reviewer for you, use r? to override) |
Bump |
Is there an easy way to add the current native CPU. i.e., to make the message look like:
|
I'm ok with r+-ing this PR as it is, but I think the change above could be an improvement. |
Another idea: If we're cross compiling then we probably don't want to print this info, since it'll be wrong/misleading. |
|
r? @arielb1 |
@bors r+ |
📌 Commit e04c54e has been approved by |
⌛ Testing commit e04c54e86d899e9a213cfef006c2f7d4268db0b7 with merge 81922065dcf1e86ce4929112535f352f698dfcbf... |
💔 Test failed - status-travis |
Failed to build rustc_llvm on
|
src/rustllvm/PassWrapper.cpp
Outdated
const ArrayRef<SubtargetFeatureKV> CPUTable = MCInfo->getCPUTable(); | ||
unsigned MaxCPULen = getLongestEntryLength(CPUTable); | ||
|
||
printf("Available CPUs for this target:\n"); | ||
if (HostArch == TargetArch) | ||
printf(" %-*s - Select the CPU of the current host (currently %s).\n", | ||
MaxCPULen, "native", sys::getHostCPUName().data()); |
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.
StringRefs are not guaranteed to be null terminated. Use %.*s
and pass the length as well, as in
rust/src/rustllvm/PassWrapper.cpp
Lines 651 to 655 in 5dfc84c
// These unsigned->signed casts could theoretically overflow, but | |
// realistically never will (and even if, the result is implementation | |
// defined rather plain UB). | |
printf("%15.*s - %.*s\n", (int)PassArg.size(), PassArg.data(), | |
(int)PassName.size(), PassName.data()); |
e00c899
to
824fb38
Compare
@bors: r=arielb1 |
📌 Commit 824fb38 has been approved by |
Add 'native' to -C target-cpu=help Fixes #44393
☀️ Test successful - status-appveyor, status-travis |
Fixes #44393