Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/link: reject >2GB static data #9862
The following code prints 2!
It seems that when bss is big, bad things happen on darwin. At 1<<30, it works (prints 0). It also fails at 1<<31, 1<<32, 1<<33. We get a compile error at 1<<31 - 1:
We should fail instead of silently generating bad code.
Linux works correctly: succeeds for up to close to 1<<32, fails with the above error for larger sizes.
Are you sure Linux can handle that code?
On my linux/amd64 system, it also prints 2.
In general, our toolchain can't handle static data (or text, for that matter)
I've experimented with various released version of Go:
It's broken since Go 1.3.