openbsd-ports/devel/llvm/patches/patch-tools_clang_lib_Driver_ToolChains_Arch_RISCV_cpp
2022-03-10 00:04:05 +00:00

26 lines
977 B
Plaintext

- ld.lld doesn't properly support R_RISCV_RELAX relocations, switch the default to -no-relax
Index: tools/clang/lib/Driver/ToolChains/Arch/RISCV.cpp
--- tools/clang/lib/Driver/ToolChains/Arch/RISCV.cpp.orig
+++ tools/clang/lib/Driver/ToolChains/Arch/RISCV.cpp
@@ -556,11 +556,19 @@ void riscv::getRISCVTargetFeatures(const Driver &D, co
if (Args.hasArg(options::OPT_ffixed_x31))
Features.push_back("+reserve-x31");
+#ifdef __OpenBSD__
+ // -mno-relax is default, unless -mrelax is specified.
+ if (Args.hasFlag(options::OPT_mrelax, options::OPT_mno_relax, false))
+ Features.push_back("+relax");
+ else
+ Features.push_back("-relax");
+#else
// -mrelax is default, unless -mno-relax is specified.
if (Args.hasFlag(options::OPT_mrelax, options::OPT_mno_relax, true))
Features.push_back("+relax");
else
Features.push_back("-relax");
+#endif
// GCC Compatibility: -mno-save-restore is default, unless -msave-restore is
// specified.