On Wed, Dec 31, 2025 at 09:05:53AM +0000, Yao Zi via Grub-devel wrote:
> 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 4GiB range.
>
> Let's defer the check for -mcmodel=large until PIC/PIE is ensured
> disabled.
>
> Fixes: f1957dc8a334 ("RISC-V: Add to build system")
> Reported-by: Han Gao <[email protected]>
> Signed-off-by: Yao Zi <[email protected]>

Reviewed-by: Daniel Kiper <[email protected]>

Daniel

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to