lenary created this revision. lenary added a reviewer: asb. Herald added subscribers: cfe-commits, Jim, benna, psnobl, jocewei, PkmX, rkruppe, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, apazos, simoncook, johnrusso, rbar. Herald added a project: clang.
LLVM issues a warning if passed unknown target features. Neither I nor @asb noticed this until after https://reviews.llvm.org/D63498 landed. This patch stops passing the (unknown) "save-restore" target feature to the LLVM backend, but continues to emit a warning if a driver asks for `-msave-restore`. The default of assuming `-mno-save-restore` (and emitting no warnings) remains. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D64008 Files: clang/lib/Driver/ToolChains/Arch/RISCV.cpp clang/test/Driver/riscv-features.c Index: clang/test/Driver/riscv-features.c =================================================================== --- clang/test/Driver/riscv-features.c +++ clang/test/Driver/riscv-features.c @@ -17,9 +17,5 @@ // RUN: %clang -target riscv32-unknown-elf -### %s -mno-save-restore 2>&1 | FileCheck %s -check-prefix=NO-SAVE-RESTORE // SAVE-RESTORE: warning: the clang compiler does not support '-msave-restore' -// DEFAULT-NOT: warning: the clang compiler does not support - -// SAVE-RESTORE: "-target-feature" "+save-restore" -// NO-SAVE-RESTORE: "-target-feature" "-save-restore" -// DEFAULT: "-target-feature" "-save-restore" -// DEFAULT-NOT: "-target-feature" "+save-restore" \ No newline at end of file +// NO-SAVE-RESTORE-NOT: warning: the clang compiler does not support +// DEFAULT-NOT: warning: the clang compiler does not support \ No newline at end of file Index: clang/lib/Driver/ToolChains/Arch/RISCV.cpp =================================================================== --- clang/lib/Driver/ToolChains/Arch/RISCV.cpp +++ clang/lib/Driver/ToolChains/Arch/RISCV.cpp @@ -358,14 +358,12 @@ else Features.push_back("-relax"); - // -mno-save-restore is default, unless -msave-restore is specified. + // GCC Compatibility: -mno-save-restore is default, unless -msave-restore is + // specified... if (Args.hasFlag(options::OPT_msave_restore, options::OPT_mno_save_restore, false)) { - Features.push_back("+save-restore"); - // ... but we don't yet support +save-restore, so issue a warning. + // ... but we don't support -msave-restore, so issue a warning. D.Diag(diag::warn_drv_clang_unsupported) << Args.getLastArg(options::OPT_msave_restore)->getAsString(Args); - } else { - Features.push_back("-save-restore"); } // Now add any that the user explicitly requested on the command line,
Index: clang/test/Driver/riscv-features.c =================================================================== --- clang/test/Driver/riscv-features.c +++ clang/test/Driver/riscv-features.c @@ -17,9 +17,5 @@ // RUN: %clang -target riscv32-unknown-elf -### %s -mno-save-restore 2>&1 | FileCheck %s -check-prefix=NO-SAVE-RESTORE // SAVE-RESTORE: warning: the clang compiler does not support '-msave-restore' -// DEFAULT-NOT: warning: the clang compiler does not support - -// SAVE-RESTORE: "-target-feature" "+save-restore" -// NO-SAVE-RESTORE: "-target-feature" "-save-restore" -// DEFAULT: "-target-feature" "-save-restore" -// DEFAULT-NOT: "-target-feature" "+save-restore" \ No newline at end of file +// NO-SAVE-RESTORE-NOT: warning: the clang compiler does not support +// DEFAULT-NOT: warning: the clang compiler does not support \ No newline at end of file Index: clang/lib/Driver/ToolChains/Arch/RISCV.cpp =================================================================== --- clang/lib/Driver/ToolChains/Arch/RISCV.cpp +++ clang/lib/Driver/ToolChains/Arch/RISCV.cpp @@ -358,14 +358,12 @@ else Features.push_back("-relax"); - // -mno-save-restore is default, unless -msave-restore is specified. + // GCC Compatibility: -mno-save-restore is default, unless -msave-restore is + // specified... if (Args.hasFlag(options::OPT_msave_restore, options::OPT_mno_save_restore, false)) { - Features.push_back("+save-restore"); - // ... but we don't yet support +save-restore, so issue a warning. + // ... but we don't support -msave-restore, so issue a warning. D.Diag(diag::warn_drv_clang_unsupported) << Args.getLastArg(options::OPT_msave_restore)->getAsString(Args); - } else { - Features.push_back("-save-restore"); } // Now add any that the user explicitly requested on the command line,
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits