Skip to content

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

@ianlancetaylor

Description

@ianlancetaylor

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.compiler/runtimeIssues related to the Go compiler and/or runtime.help wanted

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions