[llvm-branch-commits] [clang] [llvm] [llvm][fatlto] Drop any CFI related instrumentation after emitting bitcode (PR #112788)
Paul Kirth via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Oct 30 16:54:12 PDT 2024
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/112788
>From ad89d61e60bac57cf8c66a974d741377ebe1db30 Mon Sep 17 00:00:00 2001
From: Paul Kirth <paulkirth at google.com>
Date: Fri, 18 Oct 2024 01:59:26 +0000
Subject: [PATCH 1/2] Use new enum in constructor
Created using spr 1.3.4
---
llvm/lib/Passes/PassBuilderPipelines.cpp | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp
index aec79304ab5c3c..0585e83e59a9ab 100644
--- a/llvm/lib/Passes/PassBuilderPipelines.cpp
+++ b/llvm/lib/Passes/PassBuilderPipelines.cpp
@@ -1631,8 +1631,11 @@ PassBuilder::buildFatLTODefaultPipeline(OptimizationLevel Level, bool ThinLTO,
MPM.addPass(EmbedBitcodePass(ThinLTO, EmitSummary));
// If we're doing FatLTO w/ CFI enabled, we don't want the type tests in the
- // object file.
- MPM.addPass(LowerTypeTestsPass(nullptr, nullptr, true, true));
+ // object code, only in the bitcode section, so drop it before we run
+ // module optimization and generate machine code. If llvm.type.test() isn't in
+ // the IR, this won't do anything.
+ MPM.addPass(
+ LowerTypeTestsPass(nullptr, nullptr, lowertypetests::DropTestKind::All));
// Use the ThinLTO post-link pipeline with sample profiling
if (ThinLTO && PGOOpt && PGOOpt->Action == PGOOptions::SampleUse)
>From f331c70196e399d0e0d4ec8fdb76d3a313b25ac3 Mon Sep 17 00:00:00 2001
From: Paul Kirth <paulkirth at google.com>
Date: Wed, 30 Oct 2024 23:54:00 +0000
Subject: [PATCH 2/2] Update test to use cc1
Created using spr 1.3.4
---
clang/test/CodeGen/fat-lto-objects-cfi.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/clang/test/CodeGen/fat-lto-objects-cfi.cpp b/clang/test/CodeGen/fat-lto-objects-cfi.cpp
index 022e74fd9b6f22..628951847053ac 100644
--- a/clang/test/CodeGen/fat-lto-objects-cfi.cpp
+++ b/clang/test/CodeGen/fat-lto-objects-cfi.cpp
@@ -1,7 +1,7 @@
// REQUIRES: x86-registered-target
-// RUN: %clangxx --target=x86_64-unknown-fuchsia -O2 -flto -ffat-lto-objects \
-// RUN: -fsanitize=cfi -fvisibility=hidden -S -emit-llvm -o - %s \
+// RUN: %clang_cc1 -triple x86_64-unknown-fuchsia -O2 -flto -ffat-lto-objects \
+// RUN: -fsanitize=cfi-icall -fsanitize-trap=cfi-icall -fvisibility=hidden -emit-llvm -o - %s \
// RUN: | FileCheck %s
// CHECK: llvm.embedded.object
More information about the llvm-branch-commits
mailing list