Skip to content

Add a priority parameter for forcing SECTION FRAGMENTs to be sorted in a certain order using only code #1843

@nitro2k01

Description

@nitro2k01

Currently SECTION FRAGMENTs are placed by the linker in the order of the input arguments. This can cause subtle breakage if a build tool like make reorders the files. My suggestion is a priority parameter which can be used to describe the order of SECTION FRAGMENTs using only the file contents, and not having to rely on forcing a certain parameter order by for example requiring alphabetically sorted file names and using sort to set the order explicitly.

The feature could have an integer argument, where a SECTION FRAGMENT with a lower argument will always be inserted before one with a higher argument.

The use case where this came up is code that starts in one SECTION FRAGMENT, runs to the end and then resumes in a different SECTION FRAGMENT in a different file. An example of how the proposed feature might work:

file1.asm:

SECTION FRAGMENT[0] "Stuff", ROMX 
DoSomeStuff::
    ; Stuff is being done

file2.asm:

SECTION FRAGMENT[10] "Stuff", ROMX 
    ; Do some cleanup
    ret

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementTypically new features; lesser priority than bugsrgbasmThis affects RGBASMrgblinkThis affects RGBLINK

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions