Skip to content

Fixup libafl_libfuzzer with new nightly internal symbol mangling #3093

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 19, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions libafl_libfuzzer/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,13 @@ fn main() -> Result<(), Box<dyn Error>> {

let mut redefinitions_file = BufWriter::new(File::create(&redefined_symbols).unwrap());

let rn_prefix = if cfg!(target_os = "macos") {
// macOS symbols have an extra `_`
"__RN"
} else {
"_RN"
};

let zn_prefix = if cfg!(target_os = "macos") {
// macOS symbols have an extra `_`
"__ZN"
Expand All @@ -188,11 +195,14 @@ fn main() -> Result<(), Box<dyn Error>> {
}
let (_, symbol) = line.rsplit_once(' ').unwrap();

if symbol.starts_with(zn_prefix) {
if symbol.starts_with(rn_prefix) {
let (_prefix, renamed) = symbol.split_once("__rustc").unwrap();
let (size, renamed) = renamed.split_once('_').unwrap();
writeln!(redefinitions_file, "{symbol} {replacement}{size}{renamed}E").unwrap();
} else if symbol.starts_with(zn_prefix) {
writeln!(
redefinitions_file,
"{} {}",
symbol,
"{symbol} {}",
symbol.replacen(zn_prefix, &replacement, 1)
)
.unwrap();
Expand Down
Loading