fix(ldgen): enable default name SORT in linker fragment

Currently, the `SORT` flag mandates the inclusion of at least the
`sort_by_first` argument in the grammar, despite the documentation[1]
indicating that `SORT` can be utilized without any arguments, defaulting
to sorting input sections by name. Fix this by modifying the grammar
to allow a default `SORT` and update a test accordingly.

[1] https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/
    linker-script-generation.html

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
This commit is contained in:
Frantisek Hrbata
2024-10-09 14:25:52 +08:00
committed by BOT
parent 9a13c59723
commit 35953a6ea7
2 changed files with 34 additions and 11 deletions
+3 -1
View File
@@ -705,6 +705,7 @@ entries:
archive: libmain.a
entries:
obj1 (default);
text->flash_text SORT(),
text->flash_text SORT(name),
rodata->flash_rodata SORT(alignment),
data->dram0_data SORT(init_priority),
@@ -717,7 +718,8 @@ entries:
fragment_file = parse_fragment_file(test_fragment, self.sdkconfig)
fragment = fragment_file.fragments[0]
expected = [Flag('text', 'flash_text', [Sort('name')]),
expected = [Flag('text', 'flash_text', [Sort()]),
Flag('text', 'flash_text', [Sort('name')]),
Flag('rodata', 'flash_rodata', [Sort('alignment')]),
Flag('data', 'dram0_data', [Sort('init_priority')]),
Flag('bss', 'dram0_bss', [Sort('name', 'alignment')]),