[compiler-rt] [CFI] update ignorelist to work with libstdc++ make_shared (PR #118599)
Wu Yingcong via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 3 23:06:23 PST 2024
https://github.com/yingcong-wu updated https://github.com/llvm/llvm-project/pull/118599
>From 9a9a538ba8b90ec33144bf70fe809a3acc05b8e9 Mon Sep 17 00:00:00 2001
From: "Wu, Yingcong" <yingcong.wu at intel.com>
Date: Wed, 4 Dec 2024 07:54:57 +0100
Subject: [PATCH 1/3] add ingore entry
---
compiler-rt/lib/cfi/cfi_ignorelist.txt | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/compiler-rt/lib/cfi/cfi_ignorelist.txt b/compiler-rt/lib/cfi/cfi_ignorelist.txt
index 4a0f03949ca8cf..ae20be4a5f341e 100644
--- a/compiler-rt/lib/cfi/cfi_ignorelist.txt
+++ b/compiler-rt/lib/cfi/cfi_ignorelist.txt
@@ -15,3 +15,7 @@ src:*xstddef
# This ctor is used by std::make_shared and needs to cast to uninitialized T*
# in order to call std::allocator_traits<T>::construct.
fun:_ZNSt23_Sp_counted_ptr_inplace*
+
+# std::make_shared use __aligned_buffer as storage, and cast to
+# uninitialized T* (libstdc++)
+fun:*__aligned_buffer*
>From 6862c881d2b1db54a016e1e8e81d3a53b1d7e152 Mon Sep 17 00:00:00 2001
From: "Wu, Yingcong" <yingcong.wu at intel.com>
Date: Wed, 4 Dec 2024 08:05:14 +0100
Subject: [PATCH 2/3] add test case
---
compiler-rt/test/cfi/make_shared.cpp | 11 +++++++++++
1 file changed, 11 insertions(+)
create mode 100644 compiler-rt/test/cfi/make_shared.cpp
diff --git a/compiler-rt/test/cfi/make_shared.cpp b/compiler-rt/test/cfi/make_shared.cpp
new file mode 100644
index 00000000000000..30d5d285511922
--- /dev/null
+++ b/compiler-rt/test/cfi/make_shared.cpp
@@ -0,0 +1,11 @@
+// RUN: %clangxx_cfi %s -o %t
+// RUN: %t
+
+#include <memory>
+
+struct Foo {
+ Foo() {}
+ virtual ~Foo() {}
+};
+
+int main(int argc, char **argv) { std::make_shared<Foo>(); }
>From cf70a394035b2669c2bd5a174ffe8084e1f9a033 Mon Sep 17 00:00:00 2001
From: "Wu, Yingcong" <yingcong.wu at intel.com>
Date: Wed, 4 Dec 2024 08:06:12 +0100
Subject: [PATCH 3/3] update test case
---
compiler-rt/test/cfi/make_shared.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/compiler-rt/test/cfi/make_shared.cpp b/compiler-rt/test/cfi/make_shared.cpp
index 30d5d285511922..9e2a2ceeac2192 100644
--- a/compiler-rt/test/cfi/make_shared.cpp
+++ b/compiler-rt/test/cfi/make_shared.cpp
@@ -1,5 +1,5 @@
// RUN: %clangxx_cfi %s -o %t
-// RUN: %t
+// RUN: %run %t
#include <memory>
More information about the llvm-commits
mailing list