From 3b9baf96002bb1e9d7752d337539cf6b3ac782cc Mon Sep 17 00:00:00 2001 From: Brian Daniels Date: Tue, 2 Apr 2019 09:49:06 -0500 Subject: [PATCH] Only store references to one linker script in a resources object. Projects have only ever made use of one linker script per compiler. However, the tools would store references to multiple linker scripts in a project and select one in a non-deterministic way. Now we clear out any existing linker script when we add a new one to a project. This way, the last added linker script is always used. --- tools/resources/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/resources/__init__.py b/tools/resources/__init__.py index 46727769e7..e4fd76ba17 100644 --- a/tools/resources/__init__.py +++ b/tools/resources/__init__.py @@ -269,6 +269,10 @@ class Resources(object): if file_type: if sep != self._sep: file_name = file_name.replace(sep, self._sep) + # Mbed OS projects only use one linker script at a time, so remove + # any existing linker script when adding a new one + if file_type == FileType.LD_SCRIPT: + self._file_refs[file_type].clear() self._file_refs[file_type].add(FileRef(file_name, file_path)) def _include_file(self, ref):