From 6e9e344bcfcd63dba9c393012240ae7f7d41e5ee Mon Sep 17 00:00:00 2001 From: Jason Scott Date: Wed, 16 Oct 2024 10:51:13 -0400 Subject: [PATCH 1/3] add c2000 to ti library naming conditional so static libs are found --- mesonbuild/compilers/mixins/clike.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mesonbuild/compilers/mixins/clike.py b/mesonbuild/compilers/mixins/clike.py index e982ca023e41..d91004dd556f 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: From 143f848a439a35dc2e4512c02aebc67cc134b7fc Mon Sep 17 00:00:00 2001 From: Jason Scott Date: Fri, 18 Oct 2024 12:09:11 -0400 Subject: [PATCH 2/3] populate compiler args for linking command for ti targets --- mesonbuild/backend/ninjabackend.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 91603025ba92..bab842302771 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -3554,6 +3554,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 From 02960bc4493238886fbe0b3d09a2ba405d791246 Mon Sep 17 00:00:00 2001 From: Jason Scott Date: Fri, 18 Oct 2024 12:50:31 -0400 Subject: [PATCH 3/3] add getter for id so linker can be identified --- mesonbuild/linkers/linkers.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mesonbuild/linkers/linkers.py b/mesonbuild/linkers/linkers.py index d011e67b9c54..264a1bb24020 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)