golang/go

cmd/link: may need a command line option to set section split size

Open

#20,492 opened on May 25, 2017

View on GitHub
 (21 comments) (0 reactions) (0 assignees)Go (19,008 forks)batch import
NeedsInvestigationcompiler/runtimehelp wanted

Repository metrics

Stars
 (133,883 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

On ppc64x in external link mode the linker splits the text section into separate sections of size up to 0x1c00000 bytes. This gives the C linker space to insert stubs for out-of-range bl instructions. The C linker works in terms of a stub group size: it adds sections to a stub group until it reaches the group size, and then creates a new stub group. The default stub group size is, not coincidentally, 0x1c00000.

However, 1) it is possible for the linker to fail to insert a stub if there are too many stubs, in which case it can retry with a smaller stub group size; 2) the linker has a command line option to set the stub group size, and it may be set to be smaller. Either way, when the Go linker produces a section that is larger than the stub group size, the linker emits a warning (at least, the gold linker does), and in some cases the link may conceivably fail.

In order to accommodate these cases I think that either we need to have a command line option to set the size at which we split the text section, or we need to simply reduce the size to something more likely to work.

CC @laboger

Contributor guide