From 8d6180a72b1a0e2e6408b6f6d792d3d0fc2b450d Mon Sep 17 00:00:00 2001 From: "tim.heldmann" Date: Mon, 29 Jun 2026 14:49:34 +0200 Subject: [PATCH 1/2] Separate CaGe Readme from Tools readme --- tools/README.md | 42 +-------------------- tools/cage/README.md | 87 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+), 40 deletions(-) create mode 100644 tools/cage/README.md diff --git a/tools/README.md b/tools/README.md index b9788eed..b495f777 100644 --- a/tools/README.md +++ b/tools/README.md @@ -4,46 +4,8 @@ This folder contains tools for creating and merging call graphs using the MetaCG ## CaGe -CaGe is MetaCG's link-time call graph generator. -To use it, the target application needs to be built with (full) LTO using the LLD linker. - -### Basic Usage -Let's consider a project that consists of two source files, `example_a.cpp` and `example_b.cpp`. -A standard build process consists of a compile and a link step: -``` -# Compile step -clang++ example_a.cpp -o example_a.o -clang++ example_b.cpp -o example_b.o - -# Link step -clang++ example_a.o example_b.o -o example -``` - -Modifying this build process to generate a call graph with CaGe is straightforward. -All necessary compile flags can be generated with `metacg-config`: - -``` -# Compile step -clang++ $(metacg-config --cage-cxxflags) example_a.cpp -o example_a.o -clang++ $(metacg-config --cage-cxxflags) example_b.cpp -o example_b.o - -# Link step -clang++ $(metacg-config --cage-ldflags --cage-pass-option -cg-file=example.mcg) example_a.o example_b.o -o example -``` - -### Build system integration -Integrating CaGe into build systems, e.g. Make and CMake, is simple. -Many Make projects already define `CXXFLAGS` and `LDFLAGS` variables, which can be extended with the respective -`metacg-config` output. -For CMake projects, the relevant options are `CMAKE_CXX_FLAGS`, `CMAKE_EXE_LINKER_FLAGS` and `CMAKE_SHARED_LINKER_FLAGS`. - -### Pass options -Pass options can be set by passing `--cage-pass-option