diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index f29af251ee61..cb3552d7f0c1 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -3555,6 +3555,17 @@ def generate_link(self, target: build.BuildTarget, outname, obj_list, linker: T. for t in target.link_depends]) elem = NinjaBuildElement(self.all_outputs, outname, linker_rule, obj_list, implicit_outs=implicit_outs) elem.add_dep(dep_targets + custom_target_libraries) + + # Compiler args must be included in TI C28x linker commands. + if linker.get_id() in {'c2000', 'c6000', 'ti'}: + compile_args = [] + for for_machine in MachineChoice: + clist = self.environment.coredata.compilers[for_machine] + for langname, compiler in clist.items(): + if langname in {'c', 'cpp'} and compiler.get_id() in {'c2000', 'c6000', 'ti'}: + compile_args += self.generate_basic_compiler_args(target, compiler) + elem.add_item('ARGS', compile_args) + elem.add_item('LINK_ARGS', commands) self.create_target_linker_introspection(target, linker, commands) return elem diff --git a/mesonbuild/compilers/mixins/clike.py b/mesonbuild/compilers/mixins/clike.py index f0515a9bdcb4..d56547b475ed 100644 --- a/mesonbuild/compilers/mixins/clike.py +++ b/mesonbuild/compilers/mixins/clike.py @@ -1034,8 +1034,8 @@ def get_library_naming(self, env: 'Environment', libtype: LibType, strict: bool elif env.machines[self.for_machine].is_cygwin(): shlibext = ['dll', 'dll.a'] prefixes = ['cyg'] + prefixes - elif self.id.lower() == 'c6000' or self.id.lower() == 'ti': - # TI C6000 compiler can use both extensions for static or dynamic libs. + elif self.id.lower() in {'c6000', 'c2000', 'ti'}: + # TI C28x compilers can use both extensions for static or dynamic libs. stlibext = ['a', 'lib'] shlibext = ['dll', 'so'] else: diff --git a/mesonbuild/linkers/linkers.py b/mesonbuild/linkers/linkers.py index c4df0fa1d893..d0ffc56182ee 100644 --- a/mesonbuild/linkers/linkers.py +++ b/mesonbuild/linkers/linkers.py @@ -26,6 +26,9 @@ class StaticLinker: def __init__(self, exelist: T.List[str]): self.exelist = exelist + def get_id(self) -> str: + return self.id + def compiler_args(self, args: T.Optional[T.Iterable[str]] = None) -> CompilerArgs: return CompilerArgs(self, args)