github / github/codeql

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

オープン
#8,453 コメント 18 件 リアクション 0 件 担当者 0 名 GitHub で見る
question
主要言語
CodeQL
スター
10.1k
フォーク
2.1k
平均マージ
2日 15時間
マージ済み PR(30日)
141

説明

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](https://www.ti.com/tool/CCSTUDIO), 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:

```c
int main() {
return 0;
}
```

`build.sh` as

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

And run the command as:

```sh
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.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。