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