musllvm

A pure LLVM/Clang cross compiler toolchain targeting musl C
git clone git://git.daat.foo/musllvm.git
Log | Files | Refs | README | LICENSE

0023-clang-error-when-using-ifunc-attribute-on-unsupporte.patch (969B)


      1 From 6838a67da41425e2268ce7b4e807669986c3699e Mon Sep 17 00:00:00 2001
      2 From: q66 <q66@chimera-linux.org>
      3 Date: Fri, 29 Nov 2024 19:46:27 +0100
      4 Subject: [PATCH 23/29] clang: error when using ifunc attribute on unsupported
      5  targets
      6 
      7 ---
      8  clang/lib/Sema/SemaDeclAttr.cpp | 7 +++++++
      9  1 file changed, 7 insertions(+)
     10 
     11 diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
     12 index f351663c6..7138d953b 100644
     13 --- a/clang/lib/Sema/SemaDeclAttr.cpp
     14 +++ b/clang/lib/Sema/SemaDeclAttr.cpp
     15 @@ -1721,6 +1721,13 @@ static void handleIFuncAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
     16      return;
     17    }
     18  
     19 +  // Unsupported targets should raise a diagnostic error.
     20 +  if (!S.Context.getTargetInfo().supportsIFunc()) {
     21 +    S.Diag(AL.getLoc(), diag::err_keyword_not_supported_on_target)
     22 +      << AL << AL.getRange();
     23 +    return;
     24 +  }
     25 +
     26    markUsedForAliasOrIfunc(S, D, AL, Str);
     27    D->addAttr(::new (S.Context) IFuncAttr(S.Context, AL, Str));
     28  }
     29 -- 
     30 2.49.0
     31