From 805b14ffc44999952562e8f219d81c21a4fa50b9 Mon Sep 17 00:00:00 2001 From: Romain Malmain Date: Fri, 11 Oct 2024 18:14:25 +0200 Subject: [PATCH] Fix RPATH regex for Ubuntu (#87) * fix rpath regex for ubuntu systems * auto-create compile_commands.json --- .gitignore | 7 +++++-- linker_interceptor.py | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 18346a6a7dd..a737cf0db9b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ -/qemu_libafl_bridge/Cargo.lock -/qemu_libafl_bridge/target/ /GNUmakefile /build/ /.cache/ @@ -22,3 +20,8 @@ GTAGS *.swp *.patch *.gcov + +# --- Begin LibAFL code --- +/.idea +/compile_commands.json +# --- End LibAFL code --- diff --git a/linker_interceptor.py b/linker_interceptor.py index 69c57f97d6c..0dc593cc5c5 100755 --- a/linker_interceptor.py +++ b/linker_interceptor.py @@ -24,7 +24,7 @@ is_linking_qemu = False shared_library_pattern = r"^[^-].*/lib(.*)\.so(\.[0-9].*)?(?!rsp)$" -rpath_pattern = r"^'.*,-rpath,(.*)'$" +rpath_pattern = r".*,-rpath,(.*)'?.*" rpath_link_pattern = r"^.*,-rpath-link,(.*)$" linker_interceptor_pattern = r"(\": \")(.*linker_interceptor.py)( )" @@ -40,6 +40,9 @@ def fix_compile_commands(): with open("compile_commands.json", 'w') as f: f.write(res) + if not os.path.isfile("../compile_commands.json"): + os.symlink("build/compile_commands.json", "../compile_commands.json") + def process_args(args): global out_args, shareds, search, is_linking_qemu prev_o = False