Skip to content

Commit 341ebbd

Browse files
upgrade to llvm21 (#2223)
Signed-off-by: David Korczynski <[email protected]>
1 parent 2a74554 commit 341ebbd

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

build_all.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ if [ -d $BUILD_BASE ]; then
3030
-DLLVM_BINUTILS_INCDIR=../binutils/include \
3131
-DCMAKE_BUILD_TYPE=Release \
3232
-DLLVM_TARGETS_TO_BUILD="X86" ../llvm-project/llvm/
33-
make llvm-headers
34-
make -j5
33+
make -j5 llvm-headers
34+
make -j10
35+
make
3536
else
3637
echo "Cloning and building binutild-gdb and LLVM from scratch."
3738
mkdir $BUILD_BASE
@@ -56,7 +57,7 @@ else
5657
cd ${BUILD_BASE}
5758
git clone https://github.com/llvm/llvm-project/
5859
cd llvm-project/
59-
git checkout llvmorg-18-init-14420-gea3a3b25
60+
git checkout llvmorg-21.1.0-rc3
6061

6162
echo "Applying diffs to insert Fuzz Introspector plugin in the LLVM pipeline"
6263
$BASE/frontends/llvm/patch-llvm.sh

frontends/llvm/lib/Transforms/FuzzIntrospector/FuzzIntrospector.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2260,7 +2260,8 @@ FuzzIntrospector::getBBDebugInfo(BasicBlock *BB, DILocation *PrevLoc) {
22602260
BranchInst *CurrBI;
22612261
Instruction *CurrTI, *CurrI;
22622262
DILocation *CurrLoc;
2263-
2263+
/* TODO(David): Fix this for LLVM 21. Although I'm not 100% sure we still use this.*/
2264+
/*
22642265
// Traverse all dummy BBs associated with the previous Loc.
22652266
do {
22662267
CurrTI = CurrBB->getTerminator();
@@ -2281,7 +2282,7 @@ FuzzIntrospector::getBBDebugInfo(BasicBlock *BB, DILocation *PrevLoc) {
22812282
}
22822283
if (CurrI)
22832284
Result = getInsnDebugInfo(CurrI);
2284-
2285+
*/
22852286
return Result;
22862287
}
22872288

frontends/llvm/patch-llvm.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,13 @@ if [ -f ./llvm/lib/Transforms/IPO/PassManagerBuilder.cpp ]; then
2929
sed -i 's/MPM.addPass(CrossDSOCFIPass());/MPM.addPass(CrossDSOCFIPass());\n MPM.addPass(FuzzIntrospectorPass());/g' ./llvm/lib/Passes/PassBuilderPipelines.cpp
3030
sed -i 's/MODULE_PASS("annotation2metadata", Annotation2MetadataPass())/MODULE_PASS("annotation2metadata", Annotation2MetadataPass())\nMODULE_PASS("fuzz-introspector", FuzzIntrospectorPass())/g' ./llvm/lib/Passes/PassRegistry.def
3131
else
32-
echo "Applying llvm 18 pathes"
32+
echo "Applying llvm 18 patches"
3333
echo "add_subdirectory(FuzzIntrospector)" >> ./llvm/lib/Transforms/CMakeLists.txt
3434
sed -i 's/Instrumentation/Instrumentation\n FuzzIntrospector/g' ./llvm/lib/Transforms/IPO/CMakeLists.txt
3535

36+
# This is for LLVM 21. Monitor if this affects more.
37+
sed -i 's/LLVM_ABI void initializeMIRNamerPass/LLVM_ABI void initializeFuzzIntrospectorPass(PassRegistry \&);\nLLVM_ABI void initializeMIRNamerPass/g' llvm/include/llvm/InitializePasses.h
38+
3639
sed -i 's/void initializeXRayInstrumentationPass(PassRegistry\&);/void initializeXRayInstrumentationPass(PassRegistry\&);\nvoid initializeFuzzIntrospectorPass(PassRegistry\&);/g' ./llvm/include/llvm/InitializePasses.h
3740
sed -i 's/#include "llvm\/Transforms\/Instrumentation\/ThreadSanitizer.h"/#include "llvm\/Transforms\/Instrumentation\/ThreadSanitizer.h"\n#include "llvm\/Transforms\/FuzzIntrospector\/FuzzIntrospector.h"/g' ./llvm/lib/Passes/PassBuilder.cpp
3841
sed -i 's/#include "llvm\/Transforms\/Instrumentation\/PGOInstrumentation.h"/#include "llvm\/Transforms\/Instrumentation\/PGOInstrumentation.h"\n#include "llvm\/Transforms\/FuzzIntrospector\/FuzzIntrospector.h"/g' ./llvm/lib/Passes/PassBuilderPipelines.cpp

0 commit comments

Comments
 (0)