Add a priority parameter for forcing SECTION FRAGMENTs to be sorted in a certain order using only code
- Dominant language
- C++
- Stars
- 1.6k
- Forks
- 193
- Avg merge
- 1d 33m
- Merged PRs (30d)
- 23
Description
Currently `SECTION FRAGMENT`s 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 FRAGMENT`s 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
```
Contributor guide
Assessment
This issue has not been assessed yet.