On Tue, Sep 21, 2021 at 6:23 AM Glen Newton <glen.new...@gmail.com> wrote:
>
> Looking at https://groups.google.com/g/golang-codereviews/c/xkHLQHidF5s and 
> https://github.com/golang/go/issues/9862 and the code to which they refer, it 
> seems to me that the limit is 2GB independent of platform (is this true?), as 
> the linker is limited to 2e9.
> Again, should have done more of my homework!  :-)
>
> https://github.com/golang/go/blob/master/src/cmd/internal/obj/objfile.go#L305
>
> // cutoff is the maximum data section size permitted by the linker
> // (see issue #9862). const cutoff = 2e9 // 2 GB (or so; looks better in 
> errors than 2^31)
> const cutoff = 2e9 // 2 GB (or so; looks better in errors than 2^31)
>
> The comment indicates that this is a limit in the linker; is this a limit in 
> the elf format? If No, could the linker et al be modified to accept larger 
> static data?

You're right: it does look like cmd/link imposes a 2G total limit.
This is not a limitation of the 64-bit ELF format.  It should be
possible to make it larger.

Note that such files are going to take a long time to create and will
be unwieldy to use.  While it should be possible to increase the size,
I would not be surprised if you hit other limits fairly quickly.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcWrqKB-z2_Z2sVfYX6tzCtuzExWbzwbVghMDqO9oxcLwg%40mail.gmail.com.

Reply via email to