[compiler-rt] [sanitizer] Handle Gentoo's libstdc++ path (PR #79264)

Sam James via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 24 00:28:30 PST 2024


https://github.com/thesamesam created https://github.com/llvm/llvm-project/pull/79264

On Gentoo, libc++ is indeed in /usr/include/c++/*, but libstdc++ is at e.g. /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14.

Use '/include/g++' as it should be unique enough.

See https://github.com/llvm/llvm-project/pull/78534#issuecomment-1904145839.

>From 232dffd6095bfe0b538b89b9bb0a0bda994fe2a2 Mon Sep 17 00:00:00 2001
From: Sam James <sam at gentoo.org>
Date: Wed, 24 Jan 2024 08:23:03 +0000
Subject: [PATCH] [sanitizer] Handle Gentoo's libstdc++ path

On Gentoo, libc++ is indeed in /usr/include/c++/*, but libstdc++ is at
e.g. /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14.

Use '/include/g++' as it should be unique enough.

See https://github.com/llvm/llvm-project/pull/78534#issuecomment-1904145839.
---
 .../lib/sanitizer_common/sanitizer_symbolizer_report.cpp       | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp
index 8438e019591b58..b700eca3b7beb0 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp
@@ -35,7 +35,8 @@ static bool FrameIsInternal(const SymbolizedStack *frame) {
   const char *file = frame->info.file;
   const char *module = frame->info.module;
   if (file && (internal_strstr(file, "/compiler-rt/lib/") ||
-               internal_strstr(file, "/include/c++/")))
+               internal_strstr(file, "/include/c++/") ||
+               internal_strstr(file, "/include/g++")))
     return true;
   if (module && (internal_strstr(module, "libclang_rt.")))
     return true;



More information about the llvm-commits mailing list