Go version

go1.20.7 linux/arm64

Output of go env in your module/workspace:

NA

What did you do?

go build

What did you see happen?

... 2025-05-09 16:19:49 HEADER = -H5 -T0x11000 -R0x10000

2025-05-09 16:19:49 too much data in section SDWARFSECT (over 2e+09 bytes) ...

What did you expect to see?

I noticed that go compiler check the total size of all data+DWARF sections doesn't exceed 2 GB(Actually 1.8 GB)Because of the #9862,I'd like to know the following questions: 1、What are the specific reasons for limiting the size to 2 GB? 2、Can I increase the limit to 4 GB in the 1.20.X version of golang, and does that create any unexpected problems?

Comment From: mknyszek

CC @golang/compiler

Thanks for your issue. I changed this issue to reflect a feature request. If you would like to start a broader discussion, I would suggest emailing golang-nuts since that tends to be a better place for that. The details of long conversations get quickly hidden on GitHub.

I suspect it wouldn't just work to increase the section limit. I would guess this has to do with relocations and the number of offset bits available to the various jump and branch instructions on each architecture. There are certainly ways to work around that, and IIRC the linker does have some of those mechanisms on some platforms.

I suspect this is not a fundamental limit, it would just take work that someone would have to do. I'll leave it to someone more familiar with the linker to chime in with more details.

Comment From: cherrymui

As @mknyszek mentioned, it is not an artificial limit. The toolchain uses 32-bit signed offsets in various places. We could increase or remove the limit in theory, but it requires quite some work.

go1.20.7 linux/arm64 I noticed that go compiler check the total size of all data+DWARF sections doesn't exceed 2 GB

Go 1.20.x is no longer supported. Could you try a newer version of Go, like Go 1.24.x? We did fix a bug in the accounting a while ago, that we should count the data sections and DWARF sections separately, instead of together. So maybe Go 1.24.x will solve your problem.

Comment From: gopherbot

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)