Miscompilation on arm64 with GCC LTO

Marc Glisse marc.glisse at inria.fr
Mon Jul 3 19:57:24 CEST 2023


On Mon, 8 May 2023, Arsen Arsenović wrote:

> gmp-6.2.1 when built with gcc 12/13/14 (trunk as of today) combined with
> -O2 -flto or -O3 -flto is miscompiled, causing a few issues:
> 1. `make check` for gmp fails the 't-constants' test

I am definitely not a pro of aarch64 or LTO, but from a diff of configure 
output with/without LTO, I notice that -flto prevents GMP from 
understanding that RODATA can use .section .rodata, so it uses .text 
instead and that fails. If I add -ffat-lto-objects, then configure can 
detect the proper RODATA incantation and everything works.

Now it may very well be that GMP could write its assembler in a way that 
works both for .text and for .section .rodata, I don't know what the right 
fix is, but it seemed worth recording this piece of information.

-- 
Marc Glisse


More information about the gmp-bugs mailing list