Compiling for riscv without M extension results in below problem.
00000000000100fc <__udivdi3>:
...
101b4: 05c2 slli a1,a1,0x10 101b6: 10158593 addi a1,a1,257 101ba: 11e000ef jal ra,102d8 <__muldi3>
and
00000000000102d8 <__muldi3>:
102d8: 711d addi sp,sp,-96 102da: ec86 sd ra,88(sp)
...
10324: 8526 mv a0,s1 10326: 85da mv a1,s6 10328: fb1ff0ef jal ra,102d8 <__muldi3> 1032c: 9562 add a0,a0,s8 1032e: 01055c1b srliw s8,a0,0x10 10332: 00857d33 and s10,a0,s0 10336: 010bd513 srli a0,s7,0x10 1033a: 008574b3 and s1,a0,s0 1033e: 8526 mv a0,s1 10340: 85d2 mv a1,s4 10342: f97ff0ef jal ra,102d8 <__muldi3>
...
We can see __muldi3 call itself endlessly.
It will fix this https://bugs.llvm.org/show_bug.cgi?id=43388 too.
Hence this patch.
I know Unit/arm set an example but the more common directory name in llvm-project is uppercase RISCV/