Skip to content

Commit ebda1ee

Browse files
infra: bump llvm21
Signed-off-by: David Korczynski <[email protected]>
1 parent 5a50107 commit ebda1ee

File tree

5 files changed

+48
-29
lines changed

5 files changed

+48
-29
lines changed

infra/base-images/base-builder/indexer/clang_wrapper.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,13 @@ def _get_build_id_from_elf_notes(contents: bytes) -> str | None:
132132
assert elf_data
133133

134134
for file_info in elf_data:
135-
for note_entry in file_info["Notes"]:
135+
for note_entry in file_info["NoteSections"]:
136136
note_section = note_entry["NoteSection"]
137137
if note_section["Name"] == ".note.gnu.build-id":
138-
note_details = note_section["Note"]
139-
if "Build ID" in note_details:
140-
return note_details["Build ID"]
138+
note_details = note_section["Notes"]
139+
for note_detail in note_details:
140+
if "Build ID" in note_detail:
141+
return note_detail["Build ID"]
141142
return None
142143

143144

infra/base-images/base-builder/indexer/index_build.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
DEFAULT_COVERAGE_FLAGS = '-fsanitize-coverage=bb,no-prune,trace-pc-guard'
4949
DEFAULT_FUZZING_ENGINE = 'fuzzing_engine.cc'
5050

51-
_CLANG_VERSION = os.getenv('CLANG_VERSION', '18')
51+
_CLANG_VERSION = os.getenv('CLANG_VERSION', '21')
5252
_CLANG_TOOLCHAIN = Path(os.getenv('CLANG_TOOLCHAIN', '/usr/local'))
5353
_TOOLCHAIN_WITH_WRAPPER = Path('/opt/toolchain')
5454

@@ -160,24 +160,23 @@ def _get_build_id_from_elf_notes(elf_file: str, contents: bytes) -> str | None:
160160
The build id, or None if it could not be found.
161161
"""
162162

163-
try:
164-
elf_data = json.loads(contents)
165-
except json.JSONDecodeError:
166-
logging.error('failed to decode ELF notes for %s', elf_file)
167-
return None
168-
163+
elf_data = json.loads(contents)
169164
assert elf_data
170165

171166
for file_info in elf_data:
172-
for note_entry in file_info['Notes']:
173-
note_section = note_entry['NoteSection']
174-
if note_section['Name'] == '.note.gnu.build-id':
175-
note_details = note_section['Note']
176-
if 'Build ID' in note_details:
177-
return note_details['Build ID']
167+
for note_entry in file_info["NoteSections"]:
168+
note_section = note_entry["NoteSection"]
169+
if note_section["Name"] == ".note.gnu.build-id":
170+
note_details = note_section["Notes"]
171+
for note_detail in note_details:
172+
if "Build ID" in note_detail:
173+
return note_detail["Build ID"]
178174
return None
179175

180176

177+
178+
179+
181180
def get_build_id(elf_file: str) -> str | None:
182181
"""This invokes llvm-readelf to get the build ID of the given ELF file."""
183182

infra/base-images/base-builder/precompile_honggfuzz

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ make clean
3333
# These CFLAGs match honggfuzz's default, with the exception of -mtune to
3434
# improve portability and `-D_HF_LINUX_NO_BFD` to remove assembly instructions
3535
# from the filenames.
36-
CC=clang CFLAGS="-O3 -funroll-loops -D_HF_LINUX_NO_BFD" make
36+
sed -i 's/-Werror//g' Makefile
37+
CC=clang CFLAGS="-O3 -funroll-loops -D_HF_LINUX_NO_BFD -Wno-unterminated-string-initialization -Wno-error" make
3738

3839
# libhfuzz.a will be added by CC/CXX linker directly during linking,
3940
# but it's defined here to satisfy the build infrastructure

infra/base-images/base-clang/Dockerfile

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,17 @@ RUN apt-get update && apt-get install -y wget sudo && \
3333
SUDO_FORCE_REMOVE=yes apt-get autoremove --purge -y wget sudo && \
3434
rm -rf /usr/local/doc/cmake /usr/local/bin/cmake-gui
3535

36-
RUN apt-get update && apt-get install -y git && \
37-
git clone https://github.com/ossf/fuzz-introspector.git fuzz-introspector && \
38-
cd fuzz-introspector && \
39-
git checkout 332d674f00b8abc4c9ebf10e9c42e5b72b331c63 && \
40-
git submodule init && \
41-
git submodule update && \
42-
apt-get autoremove --purge -y git && \
43-
rm -rf .git
36+
#RUN apt-get update && apt-get install -y git && \
37+
# git clone https://github.com/ossf/fuzz-introspector.git fuzz-introspector && \
38+
# cd fuzz-introspector && \
39+
# git checkout 332d674f00b8abc4c9ebf10e9c42e5b72b331c63 && \
40+
# git submodule init && \
41+
# git submodule update && \
42+
# apt-get autoremove --purge -y git && \
43+
# rm -rf .git
4444

4545
COPY checkout_build_install_llvm.sh /root/
46+
#COPY llvm-project $SRC/llvm-project
4647
# Keep all steps in the same script to decrease the number of intermediate
4748
# layes in docker file.
4849
ARG FULL_LLVM_BUILD
@@ -73,6 +74,7 @@ ENV CFLAGS -O1 \
7374
-Wno-error=deprecated-declarations \
7475
-Wno-error=implicit-function-declaration \
7576
-Wno-error=implicit-int \
77+
-Wno-error=unknown-warning-option \
7678
-Wno-error=vla-cxx-extension \
7779
-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
7880
ENV CXXFLAGS_EXTRA "-stdlib=libc++"

infra/base-images/base-clang/checkout_build_install_llvm.sh

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,15 @@ apt-get update && apt-get install -y $LLVM_DEP_PACKAGES --no-install-recommends
6060
# languages, projects, ...) is needed.
6161
# Check CMAKE_VERSION infra/base-images/base-clang/Dockerfile was released
6262
# recently enough to fully support this clang version.
63-
OUR_LLVM_REVISION=llvmorg-18.1.8
63+
OUR_LLVM_REVISION=llvmorg-21.1.0-rc3
6464

6565
mkdir $SRC/chromium_tools
6666
cd $SRC/chromium_tools
6767
git clone https://chromium.googlesource.com/chromium/src/tools/clang
6868
cd clang
6969
# Pin clang script due to https://github.com/google/oss-fuzz/issues/7617
70-
git checkout 9eb79319239629c1b23cf7a59e5ebb2bab319a34
70+
OUR_CLANG_REVISION=329189001bce28e8f90dfa1c96075731a7a8f7de
71+
git checkout $OUR_CLANG_REVISION
7172

7273
LLVM_SRC=$SRC/llvm-project
7374
# Checkout
@@ -97,7 +98,21 @@ clone_with_retries https://github.com/llvm/llvm-project.git $LLVM_SRC
9798
git -C $LLVM_SRC checkout $OUR_LLVM_REVISION
9899
echo "Using LLVM revision: $OUR_LLVM_REVISION"
99100

100-
# For fuzz introspector.
101+
# Prepare fuzz introspector.
102+
echo "Installing fuzz introspector"
103+
#if [[ -n "$FULL_LLVM_BUILD" ]]; then
104+
# FUZZ_INTROSPECTOR_CHECKOUT=341ebbd72bc9116733bcfcfab5adfd7f9b633e07
105+
# else
106+
# FUZZ_INTROSPECTOR_CHECKOUT=332d674f00b8abc4c9ebf10e9c42e5b72b331c63
107+
#fi
108+
FUZZ_INTROSPECTOR_CHECKOUT=341ebbd72bc9116733bcfcfab5adfd7f9b633e07
109+
110+
git clone https://github.com/ossf/fuzz-introspector.git /fuzz-introspector
111+
cd /fuzz-introspector
112+
git checkout $FUZZ_INTROSPECTOR_CHECKOUT
113+
git submodule init
114+
git submodule update
115+
101116
echo "Applying introspector changes"
102117
OLD_WORKING_DIR=$PWD
103118
cd $LLVM_SRC
@@ -107,6 +122,7 @@ cp -rf /fuzz-introspector/frontends/llvm/lib/Transforms/FuzzIntrospector ./llvm/
107122
# LLVM currently does not support dynamically loading LTO passes. Thus, we
108123
# hardcode it into Clang instead. Ref: https://reviews.llvm.org/D77704
109124
/fuzz-introspector/frontends/llvm/patch-llvm.sh
125+
110126
cd $OLD_WORKING_DIR
111127

112128
mkdir -p $WORK/llvm-stage2 $WORK/llvm-stage1

0 commit comments

Comments
 (0)