mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/check_mapping_target_conflict_v5.1' into 'release/v5.1'
fix(ldgen): check target conflict for entries with section aliases (v5.1) See merge request espressif/esp-idf!26123
This commit is contained in:
commit
0d2a52491b
@ -24,12 +24,13 @@ entries:
|
|||||||
[mapping:bt]
|
[mapping:bt]
|
||||||
archive: libbt.a
|
archive: libbt.a
|
||||||
entries:
|
entries:
|
||||||
* (bt_start_end);
|
|
||||||
bt_bss -> dram0_bss ALIGN(4) ALIGN(4, post) SURROUND(bt_bss),
|
|
||||||
bt_common -> dram0_bss ALIGN(4) ALIGN(4, post) SURROUND(bt_common),
|
|
||||||
data -> dram0_data ALIGN(4) ALIGN(4, post) SURROUND(bt_data)
|
|
||||||
if ESP_ALLOW_BSS_SEG_EXTERNAL_MEMORY = y:
|
if ESP_ALLOW_BSS_SEG_EXTERNAL_MEMORY = y:
|
||||||
* (extram_bss)
|
* (extram_bss)
|
||||||
|
else:
|
||||||
|
* (bt_start_end);
|
||||||
|
bt_bss -> dram0_bss ALIGN(4) ALIGN(4, post) SURROUND(bt_bss),
|
||||||
|
bt_common -> dram0_bss ALIGN(4) ALIGN(4, post) SURROUND(bt_common),
|
||||||
|
data -> dram0_data ALIGN(4) ALIGN(4, post) SURROUND(bt_data)
|
||||||
|
|
||||||
[mapping:btdm]
|
[mapping:btdm]
|
||||||
archive: libbtdm_app.a
|
archive: libbtdm_app.a
|
||||||
|
@ -471,7 +471,7 @@ class Generation:
|
|||||||
|
|
||||||
sections_str = get_section_strs(section)
|
sections_str = get_section_strs(section)
|
||||||
|
|
||||||
key = (entity, section.name)
|
key = (entity, sections_str)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
existing = entity_mappings[key]
|
existing = entity_mappings[key]
|
||||||
|
@ -70,7 +70,10 @@ class GenerationTest(unittest.TestCase):
|
|||||||
self.entities.add_sections_info(objdump)
|
self.entities.add_sections_info(objdump)
|
||||||
|
|
||||||
with open('data/linker_script.ld') as linker_script:
|
with open('data/linker_script.ld') as linker_script:
|
||||||
self.linker_script = LinkerScript(linker_script)
|
self.linker_script_expect = LinkerScript(linker_script)
|
||||||
|
|
||||||
|
with open('data/linker_script.ld') as linker_script:
|
||||||
|
self.linker_script_actual = LinkerScript(linker_script)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def create_fragment_file(contents, name='test_fragment.lf'):
|
def create_fragment_file(contents, name='test_fragment.lf'):
|
||||||
@ -84,11 +87,11 @@ class GenerationTest(unittest.TestCase):
|
|||||||
self.generation.add_fragments_from_file(fragment_file)
|
self.generation.add_fragments_from_file(fragment_file)
|
||||||
|
|
||||||
def write(self, expected, actual):
|
def write(self, expected, actual):
|
||||||
self.linker_script.fill(expected)
|
self.linker_script_expect.fill(expected)
|
||||||
self.linker_script.write(open('expected.ld', 'w'))
|
self.linker_script_expect.write(open('expected.ld', 'w'))
|
||||||
|
|
||||||
self.linker_script.fill(actual)
|
self.linker_script_actual.fill(actual)
|
||||||
self.linker_script.write(open('actual.ld', 'w'))
|
self.linker_script_actual.write(open('actual.ld', 'w'))
|
||||||
|
|
||||||
def generate_default_rules(self):
|
def generate_default_rules(self):
|
||||||
rules = collections.defaultdict(list)
|
rules = collections.defaultdict(list)
|
||||||
@ -782,6 +785,31 @@ entries:
|
|||||||
with self.assertRaises(GenerationException):
|
with self.assertRaises(GenerationException):
|
||||||
self.generation.generate(self.entities)
|
self.generation.generate(self.entities)
|
||||||
|
|
||||||
|
def test_same_entity_conflicting_section(self):
|
||||||
|
# Test same entity being mapped by scheme conflicting with another.
|
||||||
|
#
|
||||||
|
# custom_rtc = .text -> rtc_text
|
||||||
|
# noflash = .text -> iram0_text, .rodata -> dram0_data
|
||||||
|
#
|
||||||
|
# This operation should fail.
|
||||||
|
mapping = u"""
|
||||||
|
[sections:custom_text]
|
||||||
|
entries:
|
||||||
|
.text+
|
||||||
|
.literal+
|
||||||
|
|
||||||
|
[scheme:custom_rtc]
|
||||||
|
entries:
|
||||||
|
custom_text -> rtc_text
|
||||||
|
|
||||||
|
[mapping:test]
|
||||||
|
archive: libfreertos.a
|
||||||
|
entries:
|
||||||
|
croutine (noflash) #1
|
||||||
|
croutine (custom_rtc) #2
|
||||||
|
"""
|
||||||
|
self.test_same_entity_conflicting_scheme(mapping)
|
||||||
|
|
||||||
def test_complex_mapping_case(self, alt=None):
|
def test_complex_mapping_case(self, alt=None):
|
||||||
# Test a complex case where an object is mapped using
|
# Test a complex case where an object is mapped using
|
||||||
# one scheme, but a specific symbol in that object is mapped
|
# one scheme, but a specific symbol in that object is mapped
|
||||||
|
Loading…
x
Reference in New Issue
Block a user