Skip to content

Commit 814c5f1

Browse files
committed
Merge branch 'fix/ldgen_interm_no_secs' into 'master'
fix(ldgen): don't emit intermediate placements without sections Closes IDF-11972 See merge request espressif/esp-idf!36432
2 parents bef7edb + a08995b commit 814c5f1

File tree

3 files changed

+635
-8
lines changed

3 files changed

+635
-8
lines changed

tools/ldgen/ldgen/generation.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
2+
# SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
33
# SPDX-License-Identifier: Apache-2.0
44
#
55
import collections
@@ -83,11 +83,22 @@ def is_significant(self):
8383
#
8484
# Placement can also be a basis if it has flags
8585
# (self.flags) or its basis has flags (self.basis.flags)
86-
return (not self.basis or
87-
self.target != self.basis.target or
88-
(self.flags and not self.basis.flags) or
89-
(not self.flags and self.basis.flags) or
90-
self.force)
86+
significant = (not self.basis or
87+
self.target != self.basis.target or
88+
(self.flags and not self.basis.flags) or
89+
(not self.flags and self.basis.flags) or
90+
self.force)
91+
92+
if significant and not self.explicit and not self.sections:
93+
# The placement is significant, but it is an intermediate placement
94+
# for an expanded object with no input sections. In this situation,
95+
# report the placement as not significant, so its command is not
96+
# emitted in the linker script. Otherwise, only the entity without
97+
# input sections would be emitted, and the linker would include
98+
# all input sections that have not yet been mapped.
99+
significant = False
100+
101+
return significant
91102

92103
def force_significant(self):
93104
if not self.is_significant():

0 commit comments

Comments
 (0)