Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5466844imm; Tue, 18 Sep 2018 09:58:01 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbTpg93p60zvy86Nc+hRf9g6Z5Id0BE/XQolzTi/yYvKtcfoHTgh3QAXM39x39ZHZiqYhzY X-Received: by 2002:a65:5581:: with SMTP id j1-v6mr28239426pgs.203.1537289881298; Tue, 18 Sep 2018 09:58:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537289881; cv=none; d=google.com; s=arc-20160816; b=EDnJaZpEpjjnRlx6oGvlSRnUh5lPt5I7Ql3iE44Yc/eeHIC2u8IZOJhXM50bRdOp1v erSq2fEHIR5xI2um0oRFzbnN0v42QkqrPCU+vb19EmuPwuPox/0lPXYLnL9IcTxivlX3 ZUxHJ3pbgjvt/fTzC1AIlyBPd8LtLVo2MuCSekPx/Elh8UivNOmo4E7tuIsFdPIuCL4g AbYiFrOglgJl25KOz1uwiUypMs9dRJJ45AAGOUfWHJgcK1ZP/8W0HrA4mpBNDeLA1l2o 44p2Cb7PxN//hNLQ8CEJw3Lu3UlbMubIFAfidblc5SY5TCQDeU27c55+RuiQVJq/mzDh Dp4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=9HtIKUpVKYxgznAebLhJ+GTOb81tqMTVvVX/aOyPgJU=; b=OgtPyXXP/zE++/YqI6zAZ8EPhHE9HLF7b3MVUYkz3xfbntm3i4JAwfwLUTrmJuX342 zPjAEwUCO3WAvYgLA2+2di+n8F+lsr1PU5ioaAvAmszSm+C+w7aUsl81Lvu3rzt/vDo2 ghVrsCLjNjfCawwKtpdEeiZh6qmFGwd7TLywdQ4cEX3hQt3Rx7WM9H0LeM/OFZWwf2Rf oU2UM4axz7oBgI1Jqnn72AGeHREWjop5JFAiQmnPhHtz0hkcdoUfIRJhNnTvlMm0Z+2S tHF92GhSdbFtcSp7mYu6YljX3E6VdgvqVgQ6xVkiw1TouHrSFKsRgDzG1Zap6EdYc/sk GwYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=W94IRGVM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x3-v6si18634617pgo.542.2018.09.18.09.57.46; Tue, 18 Sep 2018 09:58:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=W94IRGVM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730434AbeIRWa1 (ORCPT + 99 others); Tue, 18 Sep 2018 18:30:27 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:38702 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730153AbeIRWaW (ORCPT ); Tue, 18 Sep 2018 18:30:22 -0400 Received: by mail-wm1-f66.google.com with SMTP id t25-v6so3655445wmi.3; Tue, 18 Sep 2018 09:56:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9HtIKUpVKYxgznAebLhJ+GTOb81tqMTVvVX/aOyPgJU=; b=W94IRGVMKzgYITGNEWaWIXx6cBAOpYNHEi1tERfPeiC1dsFbsimPIvlRocTsUjM8CF 7xN0FpuGCkY0SKBxWKWzpUkRzVvoyyWZ8nV3VR2BZ30+QCnhVnsJtRthha7Kcjum+825 YB3YtMd2PvGcFnItxcuQO052n0y6nKtt+Wy2MPf7ixZPpJNTIGm1Md+6m1xs+WuS91un y0usYT5HmU3pbjYjug3sGQDaYSaKhBmGgyyNKaR+sxAKutR3otYERoVnw3Y7xryoocem b8vO5/puabt2Hc9FfbJJ4EMVPnRoe/4hmpTtqCvuxOz79NT4CuoyxzpJUGHYBi9dF+Rn qpQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9HtIKUpVKYxgznAebLhJ+GTOb81tqMTVvVX/aOyPgJU=; b=ovNARRQQymoim6i9j54jm7X5gQYRECvfnjy4ee21QfQyLxpSDEhXT/fq2L147/FQJ/ oGhYfHTUVcq4nxOTih77XkqHkQxCn0UNaWCONQNZG2zan6h3VKq+rudK15uTzbk+ba/d 0Fv2Ss5xdcQhg+K2K7EntI3UySnhPopojpQPXMaBBNRqSMyYHXRfCH7YM7+KqLT1p8NG fJv2h+vsvCmIKyb136EZ6RiMxHYID38f52crJkGwFNxco148OvMwUy+rFITZ70uFKCAS 2kAzR/Q/0F5ZO/KMUxfs1KdaaZMN7rxdJyYfHQW3xRu2dTFXH2r1pKlnDX1APt2Pfskf YPZQ== X-Gm-Message-State: APzg51AazECmcmpUl9wv3k+z3HVFf2Y9pyX9TA+TCQefD60yCoh7MBA9 aLqadlkuTVuXP91KQJxjMB0= X-Received: by 2002:a1c:b686:: with SMTP id g128-v6mr15236897wmf.83.1537289814078; Tue, 18 Sep 2018 09:56:54 -0700 (PDT) Received: from localhost.localdomain (62.83.35.8.dyn.user.ono.com. [62.83.35.8]) by smtp.gmail.com with ESMTPSA id g2-v6sm2934768wme.20.2018.09.18.09.56.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Sep 2018 09:56:53 -0700 (PDT) From: Miguel Ojeda To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, Miguel Ojeda , Rasmus Villemoes , Eli Friedman , Christopher Li , Kees Cook , Ingo Molnar , Geert Uytterhoeven , Masahiro Yamada , Joe Perches , Dominique Martinet , Linus Torvalds , linux-sparse@vger.kernel.org Subject: [PATCH v2 2/2] Compiler Attributes: naked can be shared Date: Tue, 18 Sep 2018 18:55:42 +0200 Message-Id: <20180918165542.4691-3-miguel.ojeda.sandonis@gmail.com> In-Reply-To: <20180918165542.4691-1-miguel.ojeda.sandonis@gmail.com> References: <20180918165542.4691-1-miguel.ojeda.sandonis@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The naked attribute is supported by at least gcc >= 4.6 (for ARM, which is the only current user), gcc >= 8 (for x86), clang >= 3.1 and icc >= 13. See https://godbolt.org/z/350Dyc Therefore, move it out of compiler-gcc.h so that the definition is shared by all compilers. This also fixes Clang support for ARM32 --- 815f0ddb346c ("include/linux/compiler*.h: make compiler-*.h mutually exclusive"). Cc: Rasmus Villemoes Cc: Eli Friedman Cc: Christopher Li Cc: Kees Cook Cc: Ingo Molnar Cc: Geert Uytterhoeven Cc: Greg Kroah-Hartman Cc: Masahiro Yamada Cc: Joe Perches Cc: Dominique Martinet Cc: Linus Torvalds Cc: linux-sparse@vger.kernel.org Suggested-by: Arnd Bergmann Tested-by: Stefan Agner Reviewed-by: Stefan Agner Reviewed-by: Luc Van Oostenryck Reviewed-by: Nick Desaulniers Signed-off-by: Miguel Ojeda --- include/linux/compiler-gcc.h | 8 -------- include/linux/compiler_types.h | 8 ++++++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index 25d3dd6b2702..4d36b27214fd 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h @@ -79,14 +79,6 @@ #define __noretpoline __attribute__((indirect_branch("keep"))) #endif -/* - * it doesn't make sense on ARM (currently the only user of __naked) - * to trace naked functions because then mcount is called without - * stack and frame pointer being set up and there is no chance to - * restore the lr register to the value before mcount was called. - */ -#define __naked __attribute__((naked)) notrace - #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) #define __optimize(level) __attribute__((__optimize__(level))) diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h index 3525c179698c..db192becfec4 100644 --- a/include/linux/compiler_types.h +++ b/include/linux/compiler_types.h @@ -226,6 +226,14 @@ struct ftrace_likely_data { #define notrace __attribute__((no_instrument_function)) #endif +/* + * it doesn't make sense on ARM (currently the only user of __naked) + * to trace naked functions because then mcount is called without + * stack and frame pointer being set up and there is no chance to + * restore the lr register to the value before mcount was called. + */ +#define __naked __attribute__((naked)) notrace + #define __compiler_offsetof(a, b) __builtin_offsetof(a, b) /* -- 2.17.1