github / github/codeql

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

Đang mở
#8,453 18 bình luận 0 reaction 0 người được giao Xem trên GitHub
question
Ngôn ngữ chính
CodeQL
Star
10.1k
Fork
2.1k
Merge trung bình
2 ngày 15 giờ
Pull request đã merge (30 ngày)
141

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.