Download raw body.
clang on riscv64: enable linker relaxation
Reminded by Brad a few weeks ago.
We disabled this years ago when ld.lld didn't have support for
relaxation, but this has been available and usable since at least llvm
16. With this the compiler emits R_RISCV_RELAX relocations which the
linker can then use to rewrite branches to a shorter instruction
sequence, resulting in shorter and slightly faster code. The last
time I tried this, lang/go wasn't ready, but in my last test bulk I
got no new go port build error so I figure they implemented support
for this kind of reloc.
This survived a full bulk build, with only unrelated errors AFAICS.
ok?
Index: gnu/llvm/clang/lib/Driver/ToolChains/Arch/RISCV.cpp
===================================================================
RCS file: /cvs/src/gnu/llvm/clang/lib/Driver/ToolChains/Arch/RISCV.cpp,v
diff -u -p -r1.7 RISCV.cpp
--- gnu/llvm/clang/lib/Driver/ToolChains/Arch/RISCV.cpp 9 Jun 2026 06:41:08 -0000 1.7
+++ gnu/llvm/clang/lib/Driver/ToolChains/Arch/RISCV.cpp 12 Oct 2026 12:36:30 -0000
@@ -129,19 +129,11 @@ void riscv::getRISCVTargetFeatures(const
RESERVE_REG(x31)
#undef RESERVE_REG
-#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
// If -mstrict-align, -mno-strict-align, -mscalar-strict-align, or
// -mno-scalar-strict-align is passed, use it. Otherwise, the
--
jca
clang on riscv64: enable linker relaxation