Skip to content

Commit cc64149

Browse files
docs: Document how to index the Linux kernel (#479)
1 parent 16dd1b0 commit cc64149

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

docs/IndexingProjects.md

+29-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
- [scip-clang](#scip-clang)
44
- [LLVM](#llvm)
55
- [Chromium](#chromium)
6+
- [Linux](#linux)
67
- [Redpanda](#redpanda)
78
- [Postgres](#postgres)
89
- [Boost](#boost)
@@ -68,6 +69,8 @@ Tested environments: Ubuntu 18.04, Ubuntu 22.04, macOS 13.
6869
Dependencies: `cmake`, `ninja`, a host toolchain with Clang and LLD.
6970
(ld on Linux hits OOM even with 64GB RAM.)
7071

72+
Approximate index size: 1.8 GB uncompressed, 195 MB compressed
73+
7174
```bash
7275
git clone https://github.com/llvm/llvm-project --depth=1
7376
cd llvm-project/llvm
@@ -77,9 +80,9 @@ cmake -B ../build -G Ninja \
7780
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
7881
-DCMAKE_BUILD_TYPE=Debug \
7982
-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \
80-
-DCMAKE_C_FLAGS="-g0 -fuse-ld=lld" -DCMAKE_CXX_FLAGS="-g0 -fuse-ld=lld" \
83+
-DCMAKE_C_FLAGS="-g0 -fuse-ld=lld -Wno-unused-command-line-argument" -DCMAKE_CXX_FLAGS="-g0 -fuse-ld=lld -Wno-unused-command-line-argument" \
8184
-DLLDB_INCLUDE_TESTS=OFF -DLLDB_USE_SYSTEM_DEBUGSERVER=ON \
82-
-DLLVM_ENABLE_PROJECTS="all"
85+
-DLLVM_ENABLE_PROJECTS="all"
8386
ninja -C ../build
8487
scip-clang --compdb-path=build/compile_commands.json
8588
```
@@ -120,6 +123,30 @@ gn gen out/X --args='symbol_level=0'
120123
ninja -C out/X
121124
```
122125

126+
## Linux
127+
128+
Tested environments: Ubuntu 22.04
129+
130+
Approximate index size: 375 MB uncompressed, 53 MB compressed.
131+
132+
Dependencies:
133+
134+
```bash
135+
sudo apt install libncurses-dev gawk flex bison openssl libssl-dev dkms libelf-dev libudev-dev libpci-dev libiberty-dev autoconf llvm -y
136+
```
137+
138+
Build and index:
139+
140+
```bash
141+
git clone https://github.com/torvalds/linux.git --depth=10
142+
cd linux
143+
make defconfig
144+
make -j $(nproc)
145+
# The below only works on kernels newer than v5.10
146+
./scripts/clang-tools/gen_compile_commands.py
147+
scip-clang --compdb-path=compile_commands.json
148+
```
149+
123150
## Redpanda
124151

125152
Tested environments: Ubuntu 22.04

0 commit comments

Comments
 (0)