[PATCH] build: Fix dependencies for start and asm files

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Sep 17 06:26:51 UTC 2020


On 17/09/2020 08:21, Chris Johns wrote:

> On 17/9/20 4:11 pm, Sebastian Huber wrote:
>> On 17/09/2020 08:07, Chris Johns wrote:
>>
>>> On 17/9/20 3:57 pm, Sebastian Huber wrote:
>>>> Add explicit asm target feature.  Add a build start file node list and
>>>> use it as a test program dependency.
>>>>
>>>> Close #3846.
>>>> Close #4080.
>>>> ---
>>>>    wscript | 41 ++++++++++++++++++++++++++++++++++++-----
>>>>    1 file changed, 36 insertions(+), 5 deletions(-)
>>>>
>>>> diff --git a/wscript b/wscript
>>>> index 2e42918ebb..d47f25c094 100755
>>>> --- a/wscript
>>>> +++ b/wscript
>>>> @@ -40,6 +40,8 @@ try:
>>>>    except:
>>>>        import ConfigParser as configparser
>>>>    +from waflib.TaskGen import after, before_method, feature
>>>> +
>>>>    is_windows_host = os.name == "nt" or sys.platform in ["msys", "cygwin"]
>>>>    default_prefix = "/opt/rtems/6"
>>>>    compilers = ["gcc", "clang"]
>>>> @@ -149,6 +151,31 @@ def _is_enabled(enabled, enabled_by):
>>>>        return enabled_by in enabled
>>>>      +def _explicit_asm_target(self, node):
>>>> +    task = self.create_task(
>>>> +        "asm", node, self.bld.bldnode.make_node(self.target)
>>>> +    )
>>>> +    try:
>>>> +        self.compiled_tasks.append(task)
>>>> +    except AttributeError:
>>>> +        self.compiled_tasks = [task]
>>>> +    return task
>>>> +
>>>> +
>>>> + at feature("explicit_asm_target")
>>> explicit_asm?
>> asm_explicit_target? The target is the important thing here.
> Hmmm ... oh .. it is a dependency of a test to rebuild a test. Is this because
> the test is not directly dependent on the start object file self?

Unfortunately the fix for #3846 and #4080 needs to be combined, because 
the fix for #3846 requires the removal of "before=["cstlib"]". This 
patch fixes two issues.

1. The tracking of start file dependencies.

2. Reflect that executables depend on the start files.

We need a start.o file in the right path, and not for example a 
start.S.17.o file in some path. This part is addressed by the 
"explicit_asm_target" feature.

This:

@after("apply_link")
@feature("cprogram", "cxxprogram")
def process_start_files(self):
     if getattr(self, "start_files", False):
         self.link_task.dep_nodes.extend(self.bld.start_files)

addresses 2.



More information about the devel mailing list