clang-tool-chain 1.0.44__py3-none-any.whl → 1.0.47__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- clang_tool_chain/__init__.py +31 -0
- clang_tool_chain/__version__.py +1 -1
- clang_tool_chain/deployment/dll_deployer.py +16 -23
- clang_tool_chain/deployment/dylib_deployer.py +8 -8
- clang_tool_chain/deployment/libdeploy.py +287 -0
- clang_tool_chain/deployment/so_deployer.py +13 -5
- clang_tool_chain/env_utils.py +137 -0
- clang_tool_chain/execution/__init__.py +6 -1
- clang_tool_chain/execution/arg_transformers.py +128 -36
- clang_tool_chain/execution/build.py +10 -4
- clang_tool_chain/execution/build_pipeline.py +7 -2
- clang_tool_chain/execution/sanitizer_env.py +77 -12
- clang_tool_chain/linker/lld.py +42 -12
- clang_tool_chain/wrapper.py +13 -0
- {clang_tool_chain-1.0.44.dist-info → clang_tool_chain-1.0.47.dist-info}/METADATA +222 -25
- {clang_tool_chain-1.0.44.dist-info → clang_tool_chain-1.0.47.dist-info}/RECORD +19 -17
- {clang_tool_chain-1.0.44.dist-info → clang_tool_chain-1.0.47.dist-info}/entry_points.txt +1 -0
- {clang_tool_chain-1.0.44.dist-info → clang_tool_chain-1.0.47.dist-info}/WHEEL +0 -0
- {clang_tool_chain-1.0.44.dist-info → clang_tool_chain-1.0.47.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: clang-tool-chain
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.47
|
|
4
4
|
Summary: Clang Tool Chain - C/C++ compilation toolchain utilities
|
|
5
5
|
Project-URL: Homepage, https://github.com/zackees/clang-tool-chain
|
|
6
6
|
Project-URL: Repository, https://github.com/zackees/clang-tool-chain
|
|
@@ -117,12 +117,13 @@ Comprehensive test coverage across all platforms and tool categories ensures rel
|
|
|
117
117
|
| **lldb** | [](https://github.com/zackees/clang-tool-chain/actions/workflows/test-lldb-win.yml) | [](https://github.com/zackees/clang-tool-chain/actions/workflows/test-lldb-linux-x86.yml) | [](https://github.com/zackees/clang-tool-chain/actions/workflows/test-lldb-linux-arm.yml) | [](https://github.com/zackees/clang-tool-chain/actions/workflows/test-lldb-macos-x86.yml) | [](https://github.com/zackees/clang-tool-chain/actions/workflows/test-lldb-macos-arm.yml) |
|
|
118
118
|
| **cosmocc** | [](https://github.com/zackees/clang-tool-chain/actions/workflows/test-cosmocc-win.yml) | [](https://github.com/zackees/clang-tool-chain/actions/workflows/test-cosmocc-linux-x86.yml) | [](https://github.com/zackees/clang-tool-chain/actions/workflows/test-cosmocc-linux-arm.yml) | [](https://github.com/zackees/clang-tool-chain/actions/workflows/test-cosmocc-macos-x86.yml) | [](https://github.com/zackees/clang-tool-chain/actions/workflows/test-cosmocc-macos-arm.yml) |
|
|
119
119
|
| **lib-deploy** | [](https://github.com/zackees/clang-tool-chain/actions/workflows/test-lib-deploy-win.yml) | [](https://github.com/zackees/clang-tool-chain/actions/workflows/test-lib-deploy-linux-x86.yml) | [](https://github.com/zackees/clang-tool-chain/actions/workflows/test-lib-deploy-linux-arm.yml) | [](https://github.com/zackees/clang-tool-chain/actions/workflows/test-lib-deploy-macos-x86.yml) | [](https://github.com/zackees/clang-tool-chain/actions/workflows/test-lib-deploy-macos-arm.yml) |
|
|
120
|
+
| **libunwind** | N/A | [](https://github.com/zackees/clang-tool-chain/actions/workflows/test-libunwind-linux-x86.yml) | [](https://github.com/zackees/clang-tool-chain/actions/workflows/test-libunwind-linux-arm.yml) | N/A | N/A |
|
|
120
121
|
|
|
121
122
|
**📖 [Complete Test Matrix Documentation](docs/TEST_MATRIX.md)** - Tool category descriptions, test organization, running tests locally.
|
|
122
123
|
|
|
123
124
|
---
|
|
124
125
|
|
|
125
|
-
## 📋 All Commands (
|
|
126
|
+
## 📋 All Commands (42 Total)
|
|
126
127
|
|
|
127
128
|
Comprehensive reference of all available commands organized by category.
|
|
128
129
|
|
|
@@ -203,7 +204,7 @@ Comprehensive reference of all available commands organized by category.
|
|
|
203
204
|
| `clang-tool-chain-sccache-emcc` | Cached Emscripten C compiler |
|
|
204
205
|
| `clang-tool-chain-sccache-empp` | Cached Emscripten C++ compiler |
|
|
205
206
|
|
|
206
|
-
### Management & Diagnostics (
|
|
207
|
+
### Management & Diagnostics (5)
|
|
207
208
|
|
|
208
209
|
| Command | Description |
|
|
209
210
|
|---------|-------------|
|
|
@@ -211,8 +212,9 @@ Comprehensive reference of all available commands organized by category.
|
|
|
211
212
|
| `clang-tool-chain-test` | Run diagnostic tests (7 checks) |
|
|
212
213
|
| `clang-tool-chain-fetch` | Download toolchain components |
|
|
213
214
|
| `clang-tool-chain-paths` | Display installation paths |
|
|
215
|
+
| `clang-tool-chain-libdeploy` | Deploy runtime library dependencies after the fact |
|
|
214
216
|
|
|
215
|
-
**Total:
|
|
217
|
+
**Total: 42 commands** providing complete C/C++/WebAssembly toolchain capabilities.
|
|
216
218
|
|
|
217
219
|
---
|
|
218
220
|
|
|
@@ -241,6 +243,7 @@ Comprehensive reference of all available commands organized by category.
|
|
|
241
243
|
- [Executable C++ Scripts](#-executable-c-scripts-shebang-support)
|
|
242
244
|
- [Windows DLL Deployment](#-windows-dll-deployment)
|
|
243
245
|
- [Address Sanitizer (ASAN)](#️-address-sanitizer-asan-support)
|
|
246
|
+
- [Bundled libunwind (Linux)](#-bundled-libunwind-linux)
|
|
244
247
|
- [sccache Integration](#-sccache-integration)
|
|
245
248
|
|
|
246
249
|
### Platform & Configuration
|
|
@@ -275,13 +278,13 @@ Comprehensive reference of all available commands organized by category.
|
|
|
275
278
|
|
|
276
279
|
### Platform & Version Matrix
|
|
277
280
|
|
|
278
|
-
| Platform | Architecture | LLVM Version | Archive Size | Linker | Status |
|
|
279
|
-
|
|
280
|
-
| Windows | x86_64 | 21.1.5 | ~71-90 MB | lld | ✅ Stable |
|
|
281
|
-
| Linux | x86_64 | 21.1.5 | ~87 MB | lld | ✅ Stable |
|
|
282
|
-
| Linux | ARM64 | 21.1.5 | ~91 MB | lld | ✅ Stable |
|
|
283
|
-
| macOS | x86_64 | 21.1.6 | ~77 MB | ld64.lld | ✅ Stable |
|
|
284
|
-
| macOS | ARM64 | 21.1.6 | ~71 MB | ld64.lld | ✅ Stable |
|
|
281
|
+
| Platform | Architecture | LLVM Version | Archive Size | Linker | Extras | Status |
|
|
282
|
+
|----------|--------------|--------------|--------------|--------|--------|--------|
|
|
283
|
+
| Windows | x86_64 | 21.1.5 | ~71-90 MB | lld | MinGW sysroot | ✅ Stable |
|
|
284
|
+
| Linux | x86_64 | 21.1.5 | ~87 MB | lld | libunwind (bundled) | ✅ Stable |
|
|
285
|
+
| Linux | ARM64 | 21.1.5 | ~91 MB | lld | libunwind (bundled) | ✅ Stable |
|
|
286
|
+
| macOS | x86_64 | 21.1.6 | ~77 MB | ld64.lld | - | ✅ Stable |
|
|
287
|
+
| macOS | ARM64 | 21.1.6 | ~71 MB | ld64.lld | - | ✅ Stable |
|
|
285
288
|
|
|
286
289
|
### Windows ABI Selection
|
|
287
290
|
|
|
@@ -717,11 +720,8 @@ clang-tool-chain-cpp main.cpp -o program --deploy-dependencies -lunwind
|
|
|
717
720
|
|
|
718
721
|
**Disable deployment:**
|
|
719
722
|
```bash
|
|
720
|
-
# Cross-platform
|
|
723
|
+
# Cross-platform
|
|
721
724
|
export CLANG_TOOL_CHAIN_NO_DEPLOY_LIBS=1
|
|
722
|
-
|
|
723
|
-
# Windows-specific (legacy)
|
|
724
|
-
export CLANG_TOOL_CHAIN_NO_DEPLOY_DLLS=1
|
|
725
725
|
```
|
|
726
726
|
|
|
727
727
|
**Enable verbose logging:**
|
|
@@ -746,6 +746,70 @@ clang-tool-chain-cpp main.cpp -o program --deploy-dependencies
|
|
|
746
746
|
|
|
747
747
|
---
|
|
748
748
|
|
|
749
|
+
## 📦 Post-Build Library Deployment (clang-tool-chain-libdeploy)
|
|
750
|
+
|
|
751
|
+
**Deploy runtime dependencies after compilation** - useful when you've compiled without `--deploy-dependencies` or when using external build systems.
|
|
752
|
+
|
|
753
|
+
### Quick Examples
|
|
754
|
+
|
|
755
|
+
```bash
|
|
756
|
+
# Deploy dependencies for a Windows executable
|
|
757
|
+
clang-tool-chain-libdeploy myprogram.exe
|
|
758
|
+
# Output: Deployed 3 MinGW DLL(s) for myprogram.exe
|
|
759
|
+
|
|
760
|
+
# Deploy dependencies for a Linux shared library
|
|
761
|
+
clang-tool-chain-libdeploy mylib.so
|
|
762
|
+
|
|
763
|
+
# Deploy dependencies for a macOS executable
|
|
764
|
+
clang-tool-chain-libdeploy myprogram
|
|
765
|
+
|
|
766
|
+
# Dry run - see what would be deployed without copying
|
|
767
|
+
clang-tool-chain-libdeploy --dry-run myprogram.exe
|
|
768
|
+
# Output:
|
|
769
|
+
# Would deploy 3 libraries:
|
|
770
|
+
# libwinpthread-1.dll <- /path/to/toolchain/lib/libwinpthread-1.dll
|
|
771
|
+
# libgcc_s_seh-1.dll <- /path/to/toolchain/lib/libgcc_s_seh-1.dll
|
|
772
|
+
# libstdc++-6.dll <- /path/to/toolchain/lib/libstdc++-6.dll
|
|
773
|
+
```
|
|
774
|
+
|
|
775
|
+
### Command Line Options
|
|
776
|
+
|
|
777
|
+
```bash
|
|
778
|
+
clang-tool-chain-libdeploy [options] <binary>
|
|
779
|
+
|
|
780
|
+
Options:
|
|
781
|
+
-h, --help Show help message
|
|
782
|
+
-v, --verbose Enable verbose output
|
|
783
|
+
-n, --dry-run Show what would be deployed without copying
|
|
784
|
+
-p, --platform Override auto-detected platform (windows, linux, darwin)
|
|
785
|
+
-a, --arch Target architecture (default: auto-detect)
|
|
786
|
+
```
|
|
787
|
+
|
|
788
|
+
### Use Cases
|
|
789
|
+
|
|
790
|
+
1. **External build systems**: When using CMake, Make, or other build systems that don't use clang-tool-chain wrappers directly
|
|
791
|
+
2. **Third-party binaries**: Deploy dependencies for pre-built executables compiled with clang-tool-chain
|
|
792
|
+
3. **CI/CD pipelines**: Add deployment as a separate step after compilation
|
|
793
|
+
4. **Debugging**: Use `--dry-run` to inspect dependencies without modifying files
|
|
794
|
+
|
|
795
|
+
### Supported Formats
|
|
796
|
+
|
|
797
|
+
| Platform | File Types | Dependencies Deployed |
|
|
798
|
+
|----------|------------|----------------------|
|
|
799
|
+
| Windows | `.exe`, `.dll` | MinGW runtime DLLs (libwinpthread, libgcc_s, libstdc++, etc.) |
|
|
800
|
+
| Linux | executables, `.so` | libc++, libunwind, sanitizer runtimes |
|
|
801
|
+
| macOS | executables, `.dylib` | libc++, libunwind, sanitizer runtimes |
|
|
802
|
+
|
|
803
|
+
### Binary Type Detection
|
|
804
|
+
|
|
805
|
+
The tool automatically detects binary type from:
|
|
806
|
+
1. **File extension**: `.exe`, `.dll`, `.so`, `.dylib`
|
|
807
|
+
2. **Magic bytes**: ELF (Linux), Mach-O (macOS), PE (Windows)
|
|
808
|
+
|
|
809
|
+
For executables without extensions (common on Linux/macOS), magic bytes are used for detection.
|
|
810
|
+
|
|
811
|
+
---
|
|
812
|
+
|
|
749
813
|
## 🚀 CI/CD Integration
|
|
750
814
|
|
|
751
815
|
```yaml
|
|
@@ -772,13 +836,13 @@ jobs:
|
|
|
772
836
|
|
|
773
837
|
## 🌍 Platform Support Matrix
|
|
774
838
|
|
|
775
|
-
| Platform | Architecture | LLVM Version | Archive Size | Status |
|
|
776
|
-
|
|
777
|
-
| Windows | x86_64 | 21.1.5 | ~71-90 MB | ✅ Stable |
|
|
778
|
-
| Linux | x86_64 | 21.1.5 | ~87 MB | ✅ Stable |
|
|
779
|
-
| Linux | ARM64 | 21.1.5 | ~91 MB | ✅ Stable |
|
|
780
|
-
| macOS | x86_64 | 19.1.7 | ~77 MB | ✅ Stable |
|
|
781
|
-
| macOS | ARM64 | 21.1.6 | ~71 MB | ✅ Stable |
|
|
839
|
+
| Platform | Architecture | LLVM Version | Archive Size | Bundled Extras | Status |
|
|
840
|
+
|----------|--------------|--------------|--------------|----------------|--------|
|
|
841
|
+
| Windows | x86_64 | 21.1.5 | ~71-90 MB | MinGW sysroot | ✅ Stable |
|
|
842
|
+
| Linux | x86_64 | 21.1.5 | ~87 MB | libunwind | ✅ Stable |
|
|
843
|
+
| Linux | ARM64 | 21.1.5 | ~91 MB | libunwind | ✅ Stable |
|
|
844
|
+
| macOS | x86_64 | 19.1.7 | ~77 MB | - | ✅ Stable |
|
|
845
|
+
| macOS | ARM64 | 21.1.6 | ~71 MB | - | ✅ Stable |
|
|
782
846
|
|
|
783
847
|
**Requirements:** Python 3.10+, ~100-400 MB disk space
|
|
784
848
|
|
|
@@ -791,10 +855,11 @@ jobs:
|
|
|
791
855
|
**Key Environment Variables:**
|
|
792
856
|
- `CLANG_TOOL_CHAIN_DOWNLOAD_PATH` - Override installation location
|
|
793
857
|
- `CLANG_TOOL_CHAIN_NO_DEPLOY_LIBS` - Disable automatic library deployment (all platforms)
|
|
794
|
-
- `
|
|
858
|
+
- `CLANG_TOOL_CHAIN_NO_DEPLOY_SHARED_LIB` - Disable library deployment for shared library outputs only
|
|
795
859
|
- `CLANG_TOOL_CHAIN_LIB_DEPLOY_VERBOSE` - Enable verbose library deployment logging
|
|
796
860
|
- `CLANG_TOOL_CHAIN_USE_SYSTEM_LD` - Use system linker instead of LLD
|
|
797
861
|
- `CLANG_TOOL_CHAIN_NO_DIRECTIVES` - Disable inlined build directives
|
|
862
|
+
- `CLANG_TOOL_CHAIN_NO_BUNDLED_UNWIND` - Disable bundled libunwind on Linux (use system version)
|
|
798
863
|
- `CLANG_TOOL_CHAIN_NO_SANITIZER_ENV` - Disable automatic ASAN/LSAN options injection at runtime
|
|
799
864
|
- `SDKROOT` - Custom macOS SDK path (auto-detected by default)
|
|
800
865
|
|
|
@@ -863,16 +928,42 @@ When running executables via `clang-tool-chain-build-run`, optimal sanitizer opt
|
|
|
863
928
|
|
|
864
929
|
- `ASAN_OPTIONS=fast_unwind_on_malloc=0:symbolize=1:detect_leaks=1` (when `-fsanitize=address` is used)
|
|
865
930
|
- `LSAN_OPTIONS=fast_unwind_on_malloc=0:symbolize=1` (when `-fsanitize=address` or `-fsanitize=leak` is used)
|
|
931
|
+
- `ASAN_SYMBOLIZER_PATH=/path/to/llvm-symbolizer` (automatically detected from clang-tool-chain)
|
|
866
932
|
|
|
867
933
|
**What these options fix:**
|
|
868
934
|
- `<unknown module>` entries in stack traces from `dlopen()`'d shared libraries
|
|
869
|
-
- Missing function names in crash reports
|
|
935
|
+
- Missing function names in crash reports (raw addresses like `0x7f5a4f15ac1d` instead of `my_function`)
|
|
870
936
|
- Incomplete leak detection
|
|
871
937
|
|
|
872
|
-
**Your options are always preserved** - if you set `ASAN_OPTIONS` or `
|
|
938
|
+
**Your options are always preserved** - if you set `ASAN_OPTIONS`, `LSAN_OPTIONS`, or `ASAN_SYMBOLIZER_PATH` yourself, clang-tool-chain won't override them.
|
|
873
939
|
|
|
874
940
|
**Regular builds are unaffected** - sanitizer options are only injected when the compiler flags indicate sanitizers are being used.
|
|
875
941
|
|
|
942
|
+
### Programmatic API (For Build Systems)
|
|
943
|
+
|
|
944
|
+
External build systems can use the sanitizer environment API to get properly configured environments:
|
|
945
|
+
|
|
946
|
+
```python
|
|
947
|
+
from clang_tool_chain import prepare_sanitizer_environment, get_symbolizer_path
|
|
948
|
+
|
|
949
|
+
# Option A: Complete environment setup (recommended)
|
|
950
|
+
env = prepare_sanitizer_environment(
|
|
951
|
+
base_env=os.environ.copy(),
|
|
952
|
+
compiler_flags=["-fsanitize=address", "-O2"]
|
|
953
|
+
)
|
|
954
|
+
# env now contains ASAN_OPTIONS, LSAN_OPTIONS, and ASAN_SYMBOLIZER_PATH
|
|
955
|
+
|
|
956
|
+
# Option B: Just get the symbolizer path
|
|
957
|
+
symbolizer = get_symbolizer_path()
|
|
958
|
+
if symbolizer:
|
|
959
|
+
os.environ["ASAN_SYMBOLIZER_PATH"] = symbolizer
|
|
960
|
+
```
|
|
961
|
+
|
|
962
|
+
**Available functions:**
|
|
963
|
+
- `prepare_sanitizer_environment(base_env, compiler_flags)` - Returns environment dict with all sanitizer variables
|
|
964
|
+
- `get_symbolizer_path()` - Returns path to `llvm-symbolizer` or `None`
|
|
965
|
+
- `detect_sanitizers_from_flags(flags)` - Returns `(asan_enabled, lsan_enabled)` tuple
|
|
966
|
+
|
|
876
967
|
### Configuration
|
|
877
968
|
|
|
878
969
|
```bash
|
|
@@ -881,6 +972,9 @@ export CLANG_TOOL_CHAIN_NO_SANITIZER_ENV=1
|
|
|
881
972
|
|
|
882
973
|
# Disable automatic -shared-libasan on Linux (use static ASAN)
|
|
883
974
|
export CLANG_TOOL_CHAIN_NO_SHARED_ASAN=1
|
|
975
|
+
|
|
976
|
+
# Suppress the "automatically injected sanitizer flags" note
|
|
977
|
+
export CLANG_TOOL_CHAIN_NO_SANITIZER_NOTE=1
|
|
884
978
|
```
|
|
885
979
|
|
|
886
980
|
**Platform Notes:**
|
|
@@ -888,6 +982,108 @@ export CLANG_TOOL_CHAIN_NO_SHARED_ASAN=1
|
|
|
888
982
|
- **Windows**: Works with both GNU and MSVC ABIs
|
|
889
983
|
- **macOS**: Uses bundled LLVM ASAN runtime
|
|
890
984
|
|
|
985
|
+
### Dynamically Loaded Libraries
|
|
986
|
+
|
|
987
|
+
If you see `<unknown module>` in ASAN/LSAN stack traces for code in dynamically loaded libraries, apply these fixes:
|
|
988
|
+
|
|
989
|
+
**1. Use `RTLD_NOW | RTLD_GLOBAL` (not `RTLD_LAZY`)**
|
|
990
|
+
|
|
991
|
+
```cpp
|
|
992
|
+
void* handle = dlopen(path, RTLD_NOW | RTLD_GLOBAL); // Good
|
|
993
|
+
void* handle = dlopen(path, RTLD_LAZY); // Bad - causes <unknown module>
|
|
994
|
+
```
|
|
995
|
+
|
|
996
|
+
**2. Skip `dlclose()` when ASAN is active**
|
|
997
|
+
|
|
998
|
+
ASAN symbolizes at exit; if the library is unloaded, addresses become `<unknown module>`.
|
|
999
|
+
|
|
1000
|
+
```cpp
|
|
1001
|
+
#if !defined(__SANITIZE_ADDRESS__)
|
|
1002
|
+
dlclose(handle); // Only close when not running under ASAN
|
|
1003
|
+
#endif
|
|
1004
|
+
```
|
|
1005
|
+
|
|
1006
|
+
On Windows, use the same pattern with `FreeLibrary()`.
|
|
1007
|
+
|
|
1008
|
+
See: https://github.com/google/sanitizers/issues/899
|
|
1009
|
+
|
|
1010
|
+
---
|
|
1011
|
+
|
|
1012
|
+
## 📚 Bundled libunwind (Linux)
|
|
1013
|
+
|
|
1014
|
+
**Self-contained stack unwinding - no system packages required**
|
|
1015
|
+
|
|
1016
|
+
On Linux, clang-tool-chain bundles libunwind headers and shared libraries, providing a complete solution for stack unwinding without requiring system packages like `libunwind-dev`.
|
|
1017
|
+
|
|
1018
|
+
### What's Bundled
|
|
1019
|
+
|
|
1020
|
+
| Component | Files | Size |
|
|
1021
|
+
|-----------|-------|------|
|
|
1022
|
+
| Headers | `libunwind.h`, `libunwind-common.h`, `libunwind-x86_64.h`/`libunwind-aarch64.h`, `unwind.h` | ~20 KB |
|
|
1023
|
+
| Libraries | `libunwind.so.*`, `libunwind-x86_64.so.*` (or `aarch64`) | ~300 KB |
|
|
1024
|
+
|
|
1025
|
+
### How It Works
|
|
1026
|
+
|
|
1027
|
+
When compiling on Linux, clang-tool-chain **automatically**:
|
|
1028
|
+
1. Adds `-I<clang_root>/include` for bundled libunwind headers
|
|
1029
|
+
2. Adds `-L<clang_root>/lib` for bundled libunwind libraries
|
|
1030
|
+
3. Adds `-Wl,-rpath,<clang_root>/lib` so executables find libunwind at runtime
|
|
1031
|
+
|
|
1032
|
+
This means `#include <libunwind.h>` and `-lunwind` work out of the box.
|
|
1033
|
+
|
|
1034
|
+
### Usage Example
|
|
1035
|
+
|
|
1036
|
+
```c
|
|
1037
|
+
// backtrace.c - Print a stack trace using libunwind
|
|
1038
|
+
#include <stdio.h>
|
|
1039
|
+
#include <libunwind.h>
|
|
1040
|
+
|
|
1041
|
+
void print_backtrace() {
|
|
1042
|
+
unw_cursor_t cursor;
|
|
1043
|
+
unw_context_t context;
|
|
1044
|
+
unw_getcontext(&context);
|
|
1045
|
+
unw_init_local(&cursor, &context);
|
|
1046
|
+
|
|
1047
|
+
while (unw_step(&cursor) > 0) {
|
|
1048
|
+
char name[256];
|
|
1049
|
+
unw_word_t offset;
|
|
1050
|
+
unw_get_proc_name(&cursor, name, sizeof(name), &offset);
|
|
1051
|
+
printf(" %s+0x%lx\n", name, (unsigned long)offset);
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
int main() {
|
|
1056
|
+
print_backtrace();
|
|
1057
|
+
return 0;
|
|
1058
|
+
}
|
|
1059
|
+
```
|
|
1060
|
+
|
|
1061
|
+
```bash
|
|
1062
|
+
# Compile and link with bundled libunwind - no apt-get install needed!
|
|
1063
|
+
clang-tool-chain-c backtrace.c -lunwind -o backtrace
|
|
1064
|
+
|
|
1065
|
+
# Run without LD_LIBRARY_PATH - works due to embedded rpath
|
|
1066
|
+
./backtrace
|
|
1067
|
+
```
|
|
1068
|
+
|
|
1069
|
+
### Configuration
|
|
1070
|
+
|
|
1071
|
+
**Disable bundled libunwind** (use system version instead):
|
|
1072
|
+
```bash
|
|
1073
|
+
export CLANG_TOOL_CHAIN_NO_BUNDLED_UNWIND=1
|
|
1074
|
+
```
|
|
1075
|
+
|
|
1076
|
+
### Platform Support
|
|
1077
|
+
|
|
1078
|
+
| Platform | Headers | Libraries | Status |
|
|
1079
|
+
|----------|---------|-----------|--------|
|
|
1080
|
+
| Linux x86_64 | ✅ Bundled | ✅ Bundled | ✅ Full |
|
|
1081
|
+
| Linux ARM64 | ✅ Bundled | ✅ Bundled | ✅ Full |
|
|
1082
|
+
| Windows | MinGW sysroot | MinGW sysroot | N/A (different API) |
|
|
1083
|
+
| macOS | System | System | N/A (uses system) |
|
|
1084
|
+
|
|
1085
|
+
**📖 [Complete Documentation](docs/LIBUNWIND.md)** - Detailed usage, API reference, integration with ASAN, advanced examples.
|
|
1086
|
+
|
|
891
1087
|
---
|
|
892
1088
|
|
|
893
1089
|
## 🔧 How It Works
|
|
@@ -999,6 +1195,7 @@ For in-depth information on specific topics, see the documentation in the `docs/
|
|
|
999
1195
|
| **[Cosmopolitan Libc](docs/COSMOCC.md)** | Actually Portable Executables (APE) |
|
|
1000
1196
|
| **[sccache Integration](docs/SCCACHE.md)** | Compilation caching (2-10x speedup) |
|
|
1001
1197
|
| **[Inlined Build Directives](docs/DIRECTIVES.md)** | Self-contained source files |
|
|
1198
|
+
| **[Bundled libunwind](docs/LIBUNWIND.md)** | Linux stack unwinding (headers + libraries) |
|
|
1002
1199
|
|
|
1003
1200
|
### Setup & Configuration
|
|
1004
1201
|
| Document | Description |
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
clang_tool_chain/__init__.py,sha256=
|
|
2
|
-
clang_tool_chain/__version__.py,sha256=
|
|
1
|
+
clang_tool_chain/__init__.py,sha256=u-qgOuQxh5W2g7n8BgUtBnUWsK66rM4N6LJXY9PiEx0,880
|
|
2
|
+
clang_tool_chain/__version__.py,sha256=2nY1uki6P9j6QmXaqnpyAwVAoWAoyXjkuvtTeOaS0Xk,72
|
|
3
3
|
clang_tool_chain/archive.py,sha256=t3reh7cm5XP2rhTqfRIDAQZv5XQq7SsstyiROYg8wFA,27697
|
|
4
4
|
clang_tool_chain/archive_cache.py,sha256=5ZmlwXIJZDcrDFkTbdgBQYN9sulGn0WyI6qwWqC4HEU,6806
|
|
5
5
|
clang_tool_chain/checksums.py,sha256=KFXeAeDz5ZlcZVOxsHDpNDCrm9UDoJ8bMA4PeNhuzdA,9868
|
|
@@ -9,6 +9,7 @@ clang_tool_chain/cli_parsers.py,sha256=cHVDyW75N_Kao1VYeAgw_L-1K65DjyvWUigQScTFi
|
|
|
9
9
|
clang_tool_chain/component_db.py,sha256=ohtlycsrEokui83iZyPsTyxmvXgkD7_OpVwAn1Cq8gI,9096
|
|
10
10
|
clang_tool_chain/downloader.py,sha256=fqErxTaI3oEYbloLZnrWXJ26j2iGOngPnl4i8kqOWNs,6041
|
|
11
11
|
clang_tool_chain/env_breadcrumbs.py,sha256=bvPTz8xABILhzrXTEBzdGrSbpEXLf2YVgcYEe-IdhNY,2335
|
|
12
|
+
clang_tool_chain/env_utils.py,sha256=5ovnV9cQ_-g5yBlvG8OyaH0fJ-gYasCwvEn_nKYiw_4,4234
|
|
12
13
|
clang_tool_chain/fetch.py,sha256=DwsNl5DZkNqEYXL-FbCTnp6IA2iCAa9pMl5oPjyuOS4,4696
|
|
13
14
|
clang_tool_chain/installer.py,sha256=GuGeUvVcAw4HMj9jrub-I11ixmksw-vgtSOFrlupmPA,3323
|
|
14
15
|
clang_tool_chain/interrupt_utils.py,sha256=7YvazvGzyItRVDZ_pzUSK6at8PCw-Dgih69HLSz0tT4,1153
|
|
@@ -21,7 +22,7 @@ clang_tool_chain/paths.py,sha256=DwgWAAiLmPInpLDFMqyNFUyNYmkowWN626SwrMMx200,280
|
|
|
21
22
|
clang_tool_chain/permissions.py,sha256=Okt91_fk4I0UmEiUAktqxm3OZfZQ3rUW-0r2X_seuxY,8517
|
|
22
23
|
clang_tool_chain/sccache_runner.py,sha256=xkepFC4Ti8s6wv7GXA24REFj8jli86nSUqcY7TCOQzk,12810
|
|
23
24
|
clang_tool_chain/settings_warnings.py,sha256=mspKHUT0Bod_SnSLyEo6Tix0ANTMn0erVLsn82jWr4I,3523
|
|
24
|
-
clang_tool_chain/wrapper.py,sha256=
|
|
25
|
+
clang_tool_chain/wrapper.py,sha256=mMLydq43AZjUc24QU6TtiMCH8jyVh1BBHY5XMWLSeX0,8493
|
|
25
26
|
clang_tool_chain/abi/__init__.py,sha256=GBiAN5W2TovaZ2MzVFFV5J3udiOn4ME0CN6oGS2FMDM,922
|
|
26
27
|
clang_tool_chain/abi/windows_gnu.py,sha256=ZN7xVWwoBEILi7A_FG8NBBiN5gtrXYscgmixFMEm9zg,10517
|
|
27
28
|
clang_tool_chain/abi/windows_msvc.py,sha256=Z-f6HGjkBcrguDfo62qOP5cI_2EYwjQ9k3Cgnpf42Fo,3617
|
|
@@ -29,17 +30,18 @@ clang_tool_chain/commands/__init__.py,sha256=KpJD6wLVa5t3JVSjS5BQ8EUaALc5pc7SqyW
|
|
|
29
30
|
clang_tool_chain/commands/entry_points.py,sha256=mJ3ZZkYJqoT2JqMi6m8us0w8tf5_b7QnmDR30_yij00,13824
|
|
30
31
|
clang_tool_chain/deployment/__init__.py,sha256=1Bv8kpwyTd3LN9HNHVWFwkznXLbTdbOC5PLvrnDhtR0,356
|
|
31
32
|
clang_tool_chain/deployment/base_deployer.py,sha256=-02O-EJllRTAYnPcBWAilfuvGWTGvpK1EG6TRnBC8_k,11565
|
|
32
|
-
clang_tool_chain/deployment/dll_deployer.py,sha256=
|
|
33
|
+
clang_tool_chain/deployment/dll_deployer.py,sha256=x3_hXsPgyQMkp1orzZV4lAZa4NMP27t0B1ajYBBbzmA,24840
|
|
33
34
|
clang_tool_chain/deployment/dll_detector.py,sha256=Zf2NAjAg6bEg6uvb7dFkj0qvk8Mvzj4sjyPIoxNVvJE,8629
|
|
34
|
-
clang_tool_chain/deployment/dylib_deployer.py,sha256=
|
|
35
|
+
clang_tool_chain/deployment/dylib_deployer.py,sha256=6GLn_CMLYUAdQZgwcTMx0XXo_AxGvUKUFYt04v2Kip0,19315
|
|
35
36
|
clang_tool_chain/deployment/factory.py,sha256=Mq6cMMUctoYBZ81I16_hXUmDLQGSAngCmBzPlu_0iaU,6205
|
|
36
|
-
clang_tool_chain/deployment/
|
|
37
|
+
clang_tool_chain/deployment/libdeploy.py,sha256=cfyDFmbuUmimss5fv7exO7NOulDnw7agrKGFgbSK7BM,9050
|
|
38
|
+
clang_tool_chain/deployment/so_deployer.py,sha256=ZkmqI2GP6GNwVDU7kzB0i4gKPNk--e8Pq0hYeueUVic,12053
|
|
37
39
|
clang_tool_chain/directives/__init__.py,sha256=MJDNYL_MD2MF0HFsrTsSTX645bYo6vtjq2pOTtfykaU,198
|
|
38
40
|
clang_tool_chain/directives/parser.py,sha256=6J7mO1JtvuHkkKS0Xges5b_jT9b3uTF6ULI0ZiwGAdw,11179
|
|
39
|
-
clang_tool_chain/execution/__init__.py,sha256=
|
|
40
|
-
clang_tool_chain/execution/arg_transformers.py,sha256=
|
|
41
|
-
clang_tool_chain/execution/build.py,sha256=
|
|
42
|
-
clang_tool_chain/execution/build_pipeline.py,sha256=
|
|
41
|
+
clang_tool_chain/execution/__init__.py,sha256=fFQEW9VejCdbBvt4quNJ2X8udh_PKgewTfzUXHmXzyc,940
|
|
42
|
+
clang_tool_chain/execution/arg_transformers.py,sha256=5JB3IdX4fkskmI4UhJgh650UTp-m10L5zlbIEAtzyvU,23880
|
|
43
|
+
clang_tool_chain/execution/build.py,sha256=YHS1BJTZg5pBS9czVko41mBdfswSPad5hxfitMoLvsI,13275
|
|
44
|
+
clang_tool_chain/execution/build_pipeline.py,sha256=ORJEJ8WYp8c7bhWAa-e3w_ySXwenpUczlmXgoGByToY,17823
|
|
43
45
|
clang_tool_chain/execution/core.py,sha256=7CJ0azznC5lq5bw8amk2kwCIN2I_OnDiKytpapkvrdY,25273
|
|
44
46
|
clang_tool_chain/execution/cosmocc.py,sha256=oGlaPK6Jpz3FaohEkWpRz8sRNu2sT-HYCoIf9xBxJHk,13319
|
|
45
47
|
clang_tool_chain/execution/emscripten.py,sha256=lgxPQpeB1_wWxNILgeyyrW5lEn117dHS9dQ3ikHRn1w,44235
|
|
@@ -47,7 +49,7 @@ clang_tool_chain/execution/iwyu.py,sha256=bmP0d_PZObA1JfmFYp3qIOKCb7y32AWPm2_ReF
|
|
|
47
49
|
clang_tool_chain/execution/lldb.py,sha256=VpxkWTPS6PsyskaKTALeziR5Z5NLwarW174Fm1SMX9k,20718
|
|
48
50
|
clang_tool_chain/execution/nodejs_resolver.py,sha256=8QsJWvIfmt5mBDV7n0ypSjsPyXS-eZTizhBli937I-g,11172
|
|
49
51
|
clang_tool_chain/execution/platform_executor.py,sha256=sF4GyW0ujy2EewG8y2Eo1gUWGzss5G5iIkv02w7-2_o,14362
|
|
50
|
-
clang_tool_chain/execution/sanitizer_env.py,sha256=
|
|
52
|
+
clang_tool_chain/execution/sanitizer_env.py,sha256=g07hDdicGI2QqHzahLm8CKm6c-SthLAkR8kANbPxBIU,7583
|
|
51
53
|
clang_tool_chain/installers/__init__.py,sha256=NAV5woPCEDKSbFr1UmfQsrg4Ua5UdghN4q7H3ymvRsg,279
|
|
52
54
|
clang_tool_chain/installers/base.py,sha256=OS78bau9zoYPitmhla7pKsfCPEj-zLY0DkvVzjE31Tw,15437
|
|
53
55
|
clang_tool_chain/installers/clang.py,sha256=rUtheVRF7mq_1YdmQ3XzIybrJqsHbm2Xf0cbhRbH7RQ,16994
|
|
@@ -57,7 +59,7 @@ clang_tool_chain/installers/iwyu.py,sha256=9aAhdGtOTY6BrLuPtladY8Y2mz1i7FjgbMxZf
|
|
|
57
59
|
clang_tool_chain/installers/lldb.py,sha256=FpG8NMNQk8PoNfg6aeU_plmSQrVET7zo-pTvoK8z838,2261
|
|
58
60
|
clang_tool_chain/installers/nodejs.py,sha256=5N07rotgmCfUaDm1uJfBlIAFKC1iTpgZT0HBRuoYwKI,9343
|
|
59
61
|
clang_tool_chain/linker/__init__.py,sha256=ghzDFpZ2-gPmdDO6K05C7yNbY6pZLANPuUks9TaQwVY,537
|
|
60
|
-
clang_tool_chain/linker/lld.py,sha256=
|
|
62
|
+
clang_tool_chain/linker/lld.py,sha256=OQLmCLNbj2BU0l5HxtHegHvXvblPITg8Gkm_EvJorKw,15381
|
|
61
63
|
clang_tool_chain/platform/__init__.py,sha256=WkV9Y25ua0mtzEGcsIxF-qExtroSTAMKkcElWuQF2BE,342
|
|
62
64
|
clang_tool_chain/platform/detection.py,sha256=PLHyUfmQ5xuohhpz0KSXJWK3d0u0fCsjx1DbM8f1CxQ,5470
|
|
63
65
|
clang_tool_chain/platform/paths.py,sha256=K0IjeVwbmgPlAWQO8mS3r1WS4C2dN6IYrSqPpckeT5c,6088
|
|
@@ -67,8 +69,8 @@ clang_tool_chain/sdk/windows.py,sha256=8zMLAoFz2OKMz-w6Kqxr3A-6Cofto2VWZvCvRi7kn
|
|
|
67
69
|
clang_tool_chain/testing/__init__.py,sha256=-sYqOOCuTV_u-MkmExrD4uKdTHG4RmMwR3D1kIG281Q,208
|
|
68
70
|
clang_tool_chain/testing/diagnostic_runner.py,sha256=mnmFUEOQulY3-Ggu6hKVGZwjrKQNmV6kY80PRTUu2qU,5293
|
|
69
71
|
clang_tool_chain/testing/diagnostic_tests.py,sha256=GmtKWrDcddZTpx9_yIKfhRAy6YOde8dj7SksCWVEME4,6019
|
|
70
|
-
clang_tool_chain-1.0.
|
|
71
|
-
clang_tool_chain-1.0.
|
|
72
|
-
clang_tool_chain-1.0.
|
|
73
|
-
clang_tool_chain-1.0.
|
|
74
|
-
clang_tool_chain-1.0.
|
|
72
|
+
clang_tool_chain-1.0.47.dist-info/METADATA,sha256=_LZi5HuQ35kmyqzkhZHq9ylZGoEPDh33Y-AfKePcY8Q,57945
|
|
73
|
+
clang_tool_chain-1.0.47.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
74
|
+
clang_tool_chain-1.0.47.dist-info/entry_points.txt,sha256=N0a0OVPkCFbf6BisRkHj-m2TcZ-f1mqxfXxAHQxfrQg,2800
|
|
75
|
+
clang_tool_chain-1.0.47.dist-info/licenses/LICENSE,sha256=51FO1oc2pZbQNI0v0_THnznnZIF4iFgawG1xnQ58kKo,10997
|
|
76
|
+
clang_tool_chain-1.0.47.dist-info/RECORD,,
|
|
@@ -20,6 +20,7 @@ clang-tool-chain-format = clang_tool_chain.wrapper:clang_format_main
|
|
|
20
20
|
clang-tool-chain-iwyu = clang_tool_chain.wrapper:iwyu_main
|
|
21
21
|
clang-tool-chain-iwyu-tool = clang_tool_chain.wrapper:iwyu_tool_main
|
|
22
22
|
clang-tool-chain-ld = clang_tool_chain.wrapper:lld_main
|
|
23
|
+
clang-tool-chain-libdeploy = clang_tool_chain.deployment.libdeploy:main
|
|
23
24
|
clang-tool-chain-lldb = clang_tool_chain.wrapper:lldb_main
|
|
24
25
|
clang-tool-chain-lldb-check-python = clang_tool_chain.wrapper:lldb_check_python_main
|
|
25
26
|
clang-tool-chain-meson = clang_tool_chain.wrapper:meson_main
|
|
File without changes
|
|
File without changes
|