@@ -162,6 +162,7 @@ LLVMRustHasFeature(LLVMTargetMachineRef TM,
162162 return (Bits & FeatureEntry->Value ) == FeatureEntry->Value ;
163163}
164164
165+ #if LLVM_RUSTLLVM
165166// / getLongestEntryLength - Return the length of the longest entry in the table.
166167// /
167168static size_t getLongestEntryLength (ArrayRef<SubtargetFeatureKV> Table) {
@@ -178,7 +179,7 @@ LLVMRustPrintTargetCPUs(LLVMTargetMachineRef TM) {
178179 const ArrayRef<SubtargetFeatureKV> CPUTable = MCInfo->getCPUTable ();
179180 unsigned MaxCPULen = getLongestEntryLength (CPUTable);
180181
181- printf (" Available CPUs for this target:\n\n " );
182+ printf (" Available CPUs for this target:\n " );
182183 for (auto &CPU : CPUTable)
183184 printf (" %-*s - %s.\n " , MaxCPULen, CPU.Key , CPU.Desc );
184185 printf (" \n " );
@@ -191,15 +192,28 @@ LLVMRustPrintTargetFeatures(LLVMTargetMachineRef TM) {
191192 const ArrayRef<SubtargetFeatureKV> FeatTable = MCInfo->getFeatureTable ();
192193 unsigned MaxFeatLen = getLongestEntryLength (FeatTable);
193194
194- printf (" Available features for this target:\n\n " );
195+ printf (" Available features for this target:\n " );
195196 for (auto &Feature : FeatTable)
196197 printf (" %-*s - %s.\n " , MaxFeatLen, Feature.Key , Feature.Desc );
197198 printf (" \n " );
198199
199200 printf (" Use +feature to enable a feature, or -feature to disable it.\n "
200- " For example, rustc -C -target-cpu=mycpu -C target-feature=+feature1,-feature2\n " );
201+ " For example, rustc -C -target-cpu=mycpu -C target-feature=+feature1,-feature2\n\n " );
201202}
202203
204+ #else
205+
206+ extern " C" void
207+ LLVMRustPrintTargetCPUs (LLVMTargetMachineRef) {
208+ printf (" Target CPU help is not supported by this LLVM version.\n\n " );
209+ }
210+
211+ extern " C" void
212+ LLVMRustPrintTargetFeatures (LLVMTargetMachineRef) {
213+ printf (" Target features help is not supported by this LLVM version.\n\n " );
214+ }
215+ #endif
216+
203217extern " C" LLVMTargetMachineRef
204218LLVMRustCreateTargetMachine (const char *triple,
205219 const char *cpu,
0 commit comments