diff --git a/tools/ldgen/fragments.py b/tools/ldgen/fragments.py index b35bddf954..6823efa840 100644 --- a/tools/ldgen/fragments.py +++ b/tools/ldgen/fragments.py @@ -344,7 +344,7 @@ class Mapping(Fragment): @staticmethod def get_grammar(): - grammar = Keyword('KEEP').setParseAction(Mapping.Keep) + grammar = Keyword('KEEP()').setParseAction(Mapping.Keep) return grammar def __eq__(self, other): diff --git a/tools/ldgen/test/test_fragments.py b/tools/ldgen/test/test_fragments.py index 9bdb427f6e..1c5878cc4c 100755 --- a/tools/ldgen/test/test_fragments.py +++ b/tools/ldgen/test/test_fragments.py @@ -818,8 +818,8 @@ entries: archive: libmain.a entries: obj1 (default); - text->flash_text KEEP, - rodata->flash_rodata KEEP KEEP + text->flash_text KEEP(), + rodata->flash_rodata KEEP() KEEP() """) fragment_file = FragmentFile(test_fragment, self.sdkconfig) @@ -930,8 +930,8 @@ entries: archive: libmain.a entries: obj1 (default); - text->flash_text ALIGN(4) KEEP SURROUND(sym1) ALIGN(8) SORT(name), - rodata->flash_rodata KEEP ALIGN(4) KEEP SURROUND(sym1) ALIGN(8) ALIGN(4) SORT(name) + text->flash_text ALIGN(4) KEEP() SURROUND(sym1) ALIGN(8) SORT(name), + rodata->flash_rodata KEEP() ALIGN(4) KEEP() SURROUND(sym1) ALIGN(8) ALIGN(4) SORT(name) """) fragment_file = FragmentFile(test_fragment, self.sdkconfig) fragment = fragment_file.fragments[0] @@ -960,8 +960,8 @@ entries: archive: libmain.a entries: obj1 (default); - text->flash_text ALIGN(4) KEEP SURROUND(sym1) SORT(name), - text->flash_text ALIGN(4) KEEP SURROUND(sym1) SORT(name) + text->flash_text ALIGN(4) KEEP() SURROUND(sym1) SORT(name), + text->flash_text ALIGN(4) KEEP() SURROUND(sym1) SORT(name) """) fragment_file = FragmentFile(test_fragment, self.sdkconfig) fragment = fragment_file.fragments[0] @@ -987,9 +987,9 @@ entries: archive: libmain.a entries: obj1 (default); - text->flash_text ALIGN(4) KEEP SURROUND(sym1) SORT(name) + text->flash_text ALIGN(4) KEEP() SURROUND(sym1) SORT(name) obj1 (default); - text->flash_text ALIGN(4) KEEP SURROUND(sym1) SORT(name) + text->flash_text ALIGN(4) KEEP() SURROUND(sym1) SORT(name) """) fragment_file = FragmentFile(test_fragment, self.sdkconfig) fragment = fragment_file.fragments[0] diff --git a/tools/ldgen/test/test_generation.py b/tools/ldgen/test/test_generation.py index 5a2fd2e920..28aac1c974 100755 --- a/tools/ldgen/test/test_generation.py +++ b/tools/ldgen/test/test_generation.py @@ -1397,7 +1397,7 @@ class FlagTest(GenerationTest): # with flags. def test_flags_basics(self): - # Test that input section commands additions are done (KEEP, SORT). + # Test that input section commands additions are done (KEEP SORT). # Test that order dependent commands are properly generated (ALIGN, SURROUND) # Normally, if an entry has the same mapping as parent, commands. # are not emitted for them. However, if there are flags, they should be - @@ -1430,7 +1430,7 @@ entries: croutine (noflash_text); text->iram0_text ALIGN(4, pre, post) SURROUND(sym1) #1 timers (default); - text->flash_text KEEP SORT(name) #2 + text->flash_text KEEP() SORT(name) #2 timers (default); rodata->flash_rodata SURROUND(sym2) ALIGN(4, pre, post) #3 """ @@ -1489,7 +1489,7 @@ archive: * entries: # 1 * (default); - text->flash_text SURROUND(sym1) KEEP #2 + text->flash_text SURROUND(sym1) KEEP() #2 [mapping:test] archive: libfreertos.a @@ -1509,7 +1509,7 @@ entries: # Command for #2, pre A.1 flash_text.insert(0, SymbolAtAddress('_sym1_start')) - # Command for #1 with KEEP B + # Command for #1 with KEEP() B # and exclusion for #3 flash_text[1].keep = True flash_text[1].exclusions.add(CROUTINE) @@ -1551,7 +1551,7 @@ archive: libfreertos.a entries: # 1 * (default); - text->flash_text SURROUND(sym1) KEEP #2 + text->flash_text SURROUND(sym1) KEEP() #2 croutine:prvCheckPendingReadyList (noflash_text) #3 """ @@ -1567,7 +1567,7 @@ entries: flash_text.append(SymbolAtAddress('_sym1_start')) flash_text[0].exclusions.add(FREERTOS) - # Command for #1 with KEEP B + # Command for #1 with KEEP() B # and exclusion for #3 flash_text.append(InputSectionDesc(FREERTOS, flash_text[0].sections, [CROUTINE], keep=True)) @@ -1607,7 +1607,7 @@ archive: libfreertos.a entries: # 1 croutine (default); - text->flash_text SURROUND(sym1) KEEP #2 + text->flash_text SURROUND(sym1) KEEP() #2 croutine:prvCheckPendingReadyList (noflash_text) #3 """ @@ -1658,7 +1658,7 @@ archive: * entries: # 1 * (default); - text->flash_text SURROUND(sym1) KEEP #2 + text->flash_text SURROUND(sym1) KEEP() #2 [mapping:test] archive: libfreertos.a @@ -1679,7 +1679,7 @@ entries: # Command for #2, pre A.1 flash_text.insert(0, SymbolAtAddress('_sym1_start')) - # Command for #1 with KEEP B + # Command for #1 with KEEP() B # and exclusion for #3 flash_text[1].keep = True flash_text[1].exclusions.add(CROUTINE) @@ -1720,7 +1720,7 @@ archive: libfreertos.a entries: # 1 * (default); - text->flash_text SURROUND(sym1) KEEP + text->flash_text SURROUND(sym1) KEEP() croutine (default) #2 croutine:prvCheckPendingReadyList (noflash_text) #3 """ @@ -1737,7 +1737,7 @@ entries: flash_text.append(SymbolAtAddress('_sym1_start')) flash_text[0].exclusions.add(FREERTOS) - # Command for #1 with KEEP B + # Command for #1 with KEEP() B # and exclusion for #3 flash_text.append(InputSectionDesc(FREERTOS, flash_text[0].sections, [CROUTINE], keep=True)) @@ -1766,7 +1766,7 @@ entries: archive: * entries: * (default); - text->flash_text KEEP + text->flash_text KEEP() """ self.add_fragments(mapping) @@ -1787,13 +1787,13 @@ entries: archive: * entries: * (default); - text->flash_text KEEP + text->flash_text KEEP() [mapping:default_add_flag_2] archive: * entries: * (default); - text->flash_text KEEP + text->flash_text KEEP() """ self.add_fragments(mapping)