[llvm] -fsanitize=function: fix .subsections_via_symbols (PR #87527)

Leonard Grey via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 8 08:17:36 PDT 2024


================
@@ -927,6 +927,30 @@ void AsmPrinter::emitDebugValue(const MCExpr *Value, unsigned Size) const {
 
 void AsmPrinter::emitFunctionHeaderComment() {}
 
+void AsmPrinter::emitFunctionPrefix(
+    const SmallVector<const Constant *, 1> &Prefix) {
+  const Function &F = MF->getFunction();
+  if (!MAI->hasSubsectionsViaSymbols()) {
+    for (auto &C : Prefix) {
+      emitGlobalConstant(F.getParent()->getDataLayout(), C);
+    }
+    return;
+  }
+  // Preserving prefix data on platforms which use subsections-via-symbols
+  // is a bit tricky. Here we introduce a symbol for the prefix data
----------------
speednoisemovement wrote:

Done

https://github.com/llvm/llvm-project/pull/87527


More information about the llvm-commits mailing list