util/crossgcc/buildgcc: Compile RISC-V GCC with medany

currently the HiFive Unmatched mainboard produces the following error:
```
util/crossgcc/xgcc/lib/gcc/riscv64-elf/13.2.0/rv64imafdc/lp64d/libgcc.a
(_clzsi2.o): in function `__clzdi2':
util/crossgcc/gcc-13.2.0/libgcc/libgcc2.c:690:(.text+0x1e): relocation
truncated to fit: R_RISCV_HI20 against symbol `__clz_tab' defined in
.rodata section in util/crossgcc/xgcc/lib/gcc/riscv64-elf/13.2.0/
rv64imafdc/lp64d/libgcc.a(_clz.o)
```

This is due to the fact that the libgcc.a library is compiled with the
medlow code model but the mainboards are compiled with the medany code
model.

Changing the code model of the GCC libraries to the medany code model
fixes the issue.

Signed-off-by: Maximilian Brune <maximilian.brune@9elements.com>
Change-Id: If5f07ce034686dd7fec160ea76838507c0ba7fa0
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80139
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-by: ron minnich <rminnich@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/util/crossgcc/buildgcc b/util/crossgcc/buildgcc
index 2919376..26b4b05 100755
--- a/util/crossgcc/buildgcc
+++ b/util/crossgcc/buildgcc
@@ -774,6 +774,11 @@
 	[ -n "$CXX" ] && $CXX --version | grep clang >/dev/null 2>&1 && \
 		CLANGCXXFLAGS="-fbracket-depth=1024"
 
+	# standard code model is medlow but all mainboards are compiled with medany code model
+	if [ "${TARGETARCH}" = "riscv64-elf" ]; then
+		CFLAGS_FOR_TARGET_EXTRA="-mcmodel=medany"
+	fi
+
 	# GCC does not honor HOSTCFLAGS at all. CFLAGS are used for
 	# both target and host object files.
 	# There's a work-around called CFLAGS_FOR_BUILD and CFLAGS_FOR_TARGET
@@ -783,7 +788,7 @@
 	# using C++.
 	# shellcheck disable=SC2086
 	CC="$(hostcc target)" CXX="$(hostcxx target)" \
-		CFLAGS_FOR_TARGET="-O2 -Dinhibit_libc" \
+		CFLAGS_FOR_TARGET="${CFLAGS_FOR_TARGET_EXTRA} -O2 -Dinhibit_libc" \
 		CFLAGS="$HOSTCFLAGS $CLANGFLAGS" \
 		CFLAGS_FOR_BUILD="$HOSTCFLAGS $CLANGFLAGS" \
 		CXXFLAGS="$HOSTCFLAGS $CLANGCXXFLAGS" \