diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -2107,12 +2107,11 @@ const Driver &D = TC.getDriver(); const llvm::Triple &Triple = TC.getTriple(); // Default small data limitation is eight. - const char *SmallDataLimit = "8"; + const char *SmallDataLimit = "0"; // Get small data limitation. if (Args.getLastArg(options::OPT_shared, options::OPT_fpic, options::OPT_fPIC)) { // Not support linker relaxation for PIC. - SmallDataLimit = "0"; if (Args.hasArg(options::OPT_G)) { D.Diag(diag::warn_drv_unsupported_sdata); } @@ -2120,7 +2119,6 @@ .equals_insensitive("large") && (Triple.getArch() == llvm::Triple::riscv64)) { // Not support linker relaxation for RV64 with large code model. - SmallDataLimit = "0"; if (Args.hasArg(options::OPT_G)) { D.Diag(diag::warn_drv_unsupported_sdata); } diff --git a/clang/test/CodeGen/RISCV/riscv-sdata-module-flag.c b/clang/test/CodeGen/RISCV/riscv-sdata-module-flag.c --- a/clang/test/CodeGen/RISCV/riscv-sdata-module-flag.c +++ b/clang/test/CodeGen/RISCV/riscv-sdata-module-flag.c @@ -32,14 +32,14 @@ void test(void) {} -// RV32-DEFAULT: !{i32 8, !"SmallDataLimit", i32 8} +// RV32-DEFAULT: !{i32 8, !"SmallDataLimit", i32 0} // RV32-G4: !{i32 8, !"SmallDataLimit", i32 4} // RV32-S0: !{i32 8, !"SmallDataLimit", i32 0} // RV32-S2G4: !{i32 8, !"SmallDataLimit", i32 4} // RV32-T16: !{i32 8, !"SmallDataLimit", i32 16} // RV32-PIC: !{i32 8, !"SmallDataLimit", i32 0} -// RV64-DEFAULT: !{i32 8, !"SmallDataLimit", i32 8} +// RV64-DEFAULT: !{i32 8, !"SmallDataLimit", i32 0} // RV64-G4: !{i32 8, !"SmallDataLimit", i32 4} // RV64-S0: !{i32 8, !"SmallDataLimit", i32 0} // RV64-S2G4: !{i32 8, !"SmallDataLimit", i32 4}