[MacPorts] #71356: New linker in Command Line Tools 16 not working with fortran BLOCK DATA
MacPorts
noreply at macports.org
Tue Nov 19 14:06:33 UTC 2024
#71356: New linker in Command Line Tools 16 not working with fortran BLOCK DATA
----------------------+--------------------
Reporter: luillo76 | Owner: (none)
Type: defect | Status: new
Priority: Normal | Milestone:
Component: ports | Version:
Keywords: | Port: gcc
----------------------+--------------------
Hello,
We've encountered a critical issue with the new linker of CLT16 (version
16.1.0.0.1.1729049160) that prevents proper initialization of BLOCK DATA
in Fortran code.
This affects software built with the Macports-provided GNU gcc13 compiler.
BLOCK DATA are used to initialize global variables, and its failure to
initialize those variables leads to a program crash.
The current workaround is using the `-ld_classic` linker option. However,
this option is deprecated and will be removed in a future release, as
described in the Xcode release note
[https://developer.apple.com/documentation/xcode-release-notes/xcode-16
-release-notes#Linking].
I've attached a minimal example that reproduces the problem using GNU
gcc13 with the following instructions:
{{{
gfortran -c bd.f
gfortran -c main.f
ar rv libtest.a bd.o main.o
gfortran -ld_classic -o good.x -L. libtest.a
gfortran -o bad.x -L. libtest.a
}}}
Running the two programs, one can see that the BLOCK DATA are not
initialised without the option `ld_classic`,
{{{
$ > ./good.x
3.7273802569289098 2.8083922366048202
$ > ./bad.x
0.0000000000000000 0.0000000000000000
}}}
I'm not sure if this is directly related to Macports, but I suspect it
might be connected to how Macports builds GCC. Has anyone else encountered
this issue? Are there any known workarounds within the Macports
environment?
Thanks.
--
Ticket URL: <https://trac.macports.org/ticket/71356>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list