Issue #3470 has been updated by liweitianux. Status changed from New to Resolved
Adopted the proposed fix and merged. Thanks. ---------------------------------------- Bug #3470: gcc120: Base gcc and the gcc12 package can't link each other's LTO objects http://bugs.dragonflybsd.org/issues/3470#change-14962 * Author: tuxillo * Status: Resolved * Priority: Normal * Target version: 6.6 * Start date: 2026-11-17 ---------------------------------------- As of 6.5-DEVELOPMENT, base gcc 12 and the lang/gcc12 package can't link each other's LTO objects. The package's lto1 fails on objects from base gcc with: <pre> lto1: internal compiler error: bytecode stream: expected tag LTO_function instead of gimple_omp_atomic_load </pre> and base gcc fails on the package's with: <pre> lto1: fatal error: LTO_tags out of range: Range is 0 to 404, value is 422 </pre> Both stamp their objects as LTO version 12.0, so there's no version mismatch error. GCC numbers the LTO tags after the number of tree codes in all-tree.def, and upstream includes the tree codes of every front end in the source tree, built or not, which gives 369. The contrib/gcc-12 import dropped ada-tree.def, d-tree.def and objc-tree.def, and cc120's Makefile.langs only lists cp-tree.def, so base gcc has 344 and every tag is off by 25. gcc80 kept those files, so this is new with gcc120. DPorts hits this through CMake's FortranCInterface, which builds C objects with -flto and links them with gfortran12. The attached patch restores the three files from 12.5.0 and lists them in Makefile.langs. lto-interop-test.sh cross-links LTO objects in both directions: with stock base gcc 9 checks fail, with the fix all 16 pass. Anything built with -flto by an unfixed base gcc has to be rebuilt. ---Files-------------------------------- lto-interop-test.sh (5.11 KB) 0001-gcc120-keep-every-front-end-s-tree-codes-in-all-tree.def.patch (26.5 KB) -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account
