On RISC-V, large code model is only compatible with position-depedent
code. However, the configure script checks availability of -mcmodel=large
before determining whether PIC/PIE is enabled, and disable them.
This is problematic with toolchains that enable PIE by default, where
check for -mcmodel=large will always fail with,
cc1: sorry, unimplemented: code model 'large' with '-fPIC'
and -mcmodel=medany will be silently used instead, causing relocation
failures at runtime with some memory layouts since -mcmodel=medany
requires all data and code to stay within a contiguous 4 GiB range.
Let's defer the check for -mcmodel=large until PIC/PIE is ensured disabled.
Fixes: f1957dc8a3 (RISC-V: Add to build system)
Reported-by: Han Gao <gaohan@iscas.ac.cn>
Signed-off-by: Yao Zi <me@ziyao.cc>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>