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

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 5 19:07:31 PDT 2024


================
@@ -967,21 +991,7 @@ void AsmPrinter::emitFunctionHeader() {
 
   // Emit the prefix data.
   if (F.hasPrefixData()) {
-    if (MAI->hasSubsectionsViaSymbols()) {
-      // Preserving prefix data on platforms which use subsections-via-symbols
-      // is a bit tricky. Here we introduce a symbol for the prefix data
-      // and use the .alt_entry attribute to mark the function's real entry point
-      // as an alternative entry point to the prefix-data symbol.
-      MCSymbol *PrefixSym = OutContext.createLinkerPrivateTempSymbol();
-      OutStreamer->emitLabel(PrefixSym);
-
-      emitGlobalConstant(F.getParent()->getDataLayout(), F.getPrefixData());
-
-      // Emit an .alt_entry directive for the actual function symbol.
-      OutStreamer->emitSymbolAttribute(CurrentFnSym, MCSA_AltEntry);
-    } else {
-      emitGlobalConstant(F.getParent()->getDataLayout(), F.getPrefixData());
-    }
+    emitFunctionPrefix({F.getPrefixData()});
   }
----------------
MaskRay wrote:

remove braces

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


More information about the llvm-commits mailing list