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

C++: large vectors give unexpected token in '.section' directive #107

Closed fxcoudert closed 1 year ago

fxcoudert commented 1 year ago

Works with clang but not GCC on ARM darwin:

$ cat a.cpp
#include<vector>

std::vector<int> factor[50000];

int main() { return 0; }
$ clang++ a.cpp
$ g++-13 a.cpp 
/var/folders/h8/9hx_fyj91053ksgdzb2w03vw0000gp/T//cc1UFPyo.s:365:29: error: unexpected token in '.section' directive
        .section .data.rel.ro.local
                                   ^
iains commented 1 year ago

I have read in other reports that this is a gcc-13 regression, can you confirm?

iains commented 1 year ago

I have read in other reports that this is a gcc-13 regression, can you confirm?

answering ; no it's not a gcc-13 regression - but it is a gcc-12 regression. from a quick look the problem was always there (aarch64 port is trying to use ELF sections on Mach-O because it's overriding what's set in the target header). I guess there was some 11 = > 12 code-gen change that favours use of a relocated literal in this case.

[I think] we just need to make sure to use the mach-o section selector.

iains commented 1 year ago

so, fixed on trunk - but needs back porting.