Changeset 4eea8d4 in rtems


Ignore:
Timestamp:
Sep 16, 2020, 4:58:27 PM (13 days ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
4897a82d
Parents:
4b767bd
git-author:
Sebastian Huber <sebastian.huber@…> (09/16/20 16:58:27)
git-committer:
Sebastian Huber <sebastian.huber@…> (09/17/20 06:57:54)
Message:

build: Fix dependencies for start and asm files

Add a feature to enforce an explicit target file for assembler sources.
Add a build start file node list and use it as a test program
dependency.

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.
  1. Reflect that executables depend on the start files.

We need a start.o file in the right path so that the linker can find is
as specified by the linker script, and not for example a start.S.17.o
file in some path. This part is addressed by the "explicit_asm_target"
feature.

This build process extension

@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.

Close #3846.
Close #4080.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wscript

    r4b767bd r4eea8d4  
    4141    import ConfigParser as configparser
    4242
     43from waflib.TaskGen import after, before_method, feature
     44
    4345is_windows_host = os.name == "nt" or sys.platform in ["msys", "cygwin"]
    4446default_prefix = "/opt/rtems/6"
     
    150152
    151153
     154def _asm_explicit_target(self, node):
     155    task = self.create_task(
     156        "asm", node, self.bld.bldnode.make_node(self.target)
     157    )
     158    try:
     159        self.compiled_tasks.append(task)
     160    except AttributeError:
     161        self.compiled_tasks = [task]
     162    return task
     163
     164
     165@feature("asm_explicit_target")
     166@before_method("process_source")
     167def _enable_asm_explicit_target(self):
     168    self.mappings = dict(self.mappings)  # Copy
     169    self.mappings[".S"] = _asm_explicit_target
     170
     171
     172@after("apply_link")
     173@feature("cprogram", "cxxprogram")
     174def process_start_files(self):
     175    if getattr(self, "start_files", False):
     176        self.link_task.dep_nodes.extend(self.bld.start_files)
     177
     178
    152179class Item(object):
    153180    def __init__(self, uid, data):
     
    242269            bld.install_files(install["destination"], install["source"])
    243270
    244     def asm(self, bld, bic, source, target=None, deps=[], cppflags=[]):
     271    def asm(self, bld, bic, source, target=None):
    245272        if target is None:
    246273            target = os.path.splitext(source)[0] + ".o"
    247274        bld(
    248275            asflags=self.data["asflags"],
    249             before=["cstlib"],
    250             cppflags=cppflags + self.data["cppflags"],
    251             features="asm c",
     276            cppflags=self.data["cppflags"],
     277            features="asm_explicit_target asm c",
    252278            includes=bic.includes + self.data["includes"],
    253             rule="${CC} ${ASFLAGS} ${CPPFLAGS} ${DEFINES_ST:DEFINES} ${CPPPATH_ST:INCPATHS} -c ${SRC[0]} -o ${TGT}",
    254             source=[source] + deps,
     279            source=[source],
    255280            target=target,
    256281        )
     
    533558
    534559    def do_build(self, bld, bic):
    535         self.asm(bld, bic, self.data["source"], self.get(bld, "target"))
     560        tgt = self.asm(bld, bic, self.data["source"], self.get(bld, "target"))
     561        node = bld.bldnode.make_node(tgt)
     562        try:
     563            bld.start_files.append(node)
     564        except AttributeError:
     565            bld.start_files = [node]
    536566        self.install_target(bld)
    537567
     
    627657            ldflags=bic.ldflags + self.data["ldflags"],
    628658            source=self.data["source"],
     659            start_files=True,
    629660            stlib=self.data["stlib"],
    630661            target=self.get(bld, "target"),
Note: See TracChangeset for help on using the changeset viewer.