iains / gcc-darwin-arm64

GCC master branch for Darwin with experimental support for Arm64. Currently GCC-15.0.0 [September 2024]
GNU General Public License v2.0
268 stars 33 forks source link

Support for large code model is needed for large static arrays (ARM64 ADRP out of range) #100

Open fherpin opened 1 year ago

fherpin commented 1 year ago

When compiling a fortran code on my mac M1 (os Monterey) I get the following error. Any idea ? ARM64 ADRP out of range (6040592384 max is +/-4GB): from velo (0x10000D590) to sourcedp (0x2680CF6F0) in 'velo' from /var/folders/7j/1b_gs76w8xlcf50059bjh4yh0000gp/T//cc18CNIc.o for architecture arm64

rbspielman-ur commented 1 year ago

I was able to determine that if the size of static arrays exceeds 4 GB the F77 code will not link on M1 Apple Silicon, gcc12.2, Ventura. Your example show a total array size of 6.04 GB. If I shrink my array size to less that 2GB it links and runs.

rbspielman-ur commented 1 year ago

Background: my code compiles and links on Intel under macOS, Linux Ubuntu, Windows.

iains commented 1 year ago

Since you do not show any code, I am guessing that the issue is (as mentioned by @rbspielman-ur) a large static array.

I'd expect that you could work around this by dynamic allocation of that array.

Otherwise, we would need to support the large code model to handle it (and I am not sure when there will be time to implement that).

iains commented 1 year ago

I am going to close this, but we now have issue #100 which is asking for support for the large code model; perhaps that would also be useful in this case.

iains commented 1 year ago

I am going to close this, but we now have issue #100 which is asking for support for the large code model; perhaps that would also be useful in this case.

^^^ that was not meant to be attached to this issue but to #88

cooljeanius commented 1 year ago

Otherwise, we would need to support the large code model to handle it (and I am not sure when there will be time to implement that).

(for cross-referencing purposes, I'm pretty sure this is bug 90698 on the gcc bugzilla)