Skip to content

How to extract source files when using a special compiler (e.g. TMS320C2000 C/C++ Compiler)? #8453

Open
@li-xin-yi

Description

@li-xin-yi

When I first created a database by codeql-cli for C/C++ source files for some embedded system software codes generated by Code Composer Studio, it failed to extract any source file even though the gmake build process ran successfully.

I found the root cause is that the makefile takes TMS320C2000 C/C++ Compiler as the compiler for the project. Even when I only have the helloworld.c as:

int main() {
   return 0;
}

build.sh as

"C:\ti\ccs1100\ccs\tools\compiler\ti-cgt-c2000_21.6.0.LTS\bin\cl2000" helloworld.c

And run the command as:

codeql database create cpp-database-01 --language=cpp --command="bash build.sh"

No source file can be extracted and the error message shows:

No source code was seen and extracted to ****
This can occur if the specified build commands failed to compile or process any code.
 - Confirm that there is some source code for the specified language in the project.
 - For codebases written in Go, JavaScript, TypeScript, and Python, do not specify 

   an explicit --command.
 - For other languages, the --command must specify a "clean" build which compiles  
   all the source code files without reusing existing build artefacts.
(base) 

I guess the extractor in codeql fails to monitor the compilation process of TMS320C2000 C/C++ Compiler, which technically can be traced as it has similar usages to take source/lib/include files with other compilers (e.g., gcc, clang).

I really want to apply codeql on those codes compiled by some special compilers to do some security analysis, but get stock with the extraction of source files. How can I fix the problem? Can I change some extractor configuration? Or if there is any direction to modify the source code of codeql to generalize the compiler requirement? Or can I add the source files to the database manually?

Thank you very much.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions