From patchwork Tue Mar 1 17:14:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emese Revfy X-Patchwork-Id: 8467601 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 84F2BC0553 for ; Tue, 1 Mar 2016 17:16:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 88B1F2014A for ; Tue, 1 Mar 2016 17:16:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6916A2034A for ; Tue, 1 Mar 2016 17:16:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752383AbcCARQF (ORCPT ); Tue, 1 Mar 2016 12:16:05 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:36363 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751051AbcCARP4 (ORCPT ); Tue, 1 Mar 2016 12:15:56 -0500 Received: by mail-wm0-f66.google.com with SMTP id l68so5211397wml.3 for ; Tue, 01 Mar 2016 09:15:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version :content-transfer-encoding; bh=bzbsbM0sGxkPiysW8naoPwrecSQ5boIquIMY5/+3+5k=; b=XlYbUggd8L6OQMFc/zZ0xFkrfYyYPnVRpt0JSn1P+5E3LiUnwqeeBu1kBJKqJUAeaI Loj433rcn+dl5P7LWXKhQP0WMwLmH9LQwMOaxg7muSXvFpbl8QATX0FIm934luNyquQo kK6iMCaVTdyrdek5RGRVxzzDh+MUSggvMgToH21RzHX1AxlglwV0YkfpO2hdBIAL1YVk qXcJvPxdcjGJzWQU1RgYMXDrKK8Om3+ZJFdlNQORbdCdpu6fwOaIw1/ag3+PUmRncOMv Yw9tnMpUUQHOl9Km1X7zbaF0TEyEyuJ3mksCIk+ibgw9tzh5pkKPh0AYiNKgFWuTSJ7q J/RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-transfer-encoding; bh=bzbsbM0sGxkPiysW8naoPwrecSQ5boIquIMY5/+3+5k=; b=BjJ+IbpSkia6SL6/6Nc5Lk3wTNmajI3wB3UTZch76hVJQBnNk/NKxN2ZOgm5tBFvVT W5kTzvJ18vYOG0+A7WceqhkwDeiBVNu8lirCTYeJpI51xxevP5O2kfwj0XaUFTufZF7u t49miTTANjJuPZV/EZTAODonqIbFfxZLtA4OmlXt5eSgb9/pZ7Vm/9Q+0mZW8DWShG8X BDDij3vIOerz73F66+TNQI1ViTaNmfPgFV2soKcrxJEV+TLYdVELIw+D2KNCFTgscf0t TX1wpSlPW/ZoJhQB34cptbmLGkPrcVX7U5ja8Iv+9tz5M3rB5m5A2tY9WEepqPOjmOYu habA== X-Gm-Message-State: AD7BkJKFj0FQ71XIiX7bPMtcMntyJdW883C9VFlBo4j4a/hxZCtYgvcMbB/Qh64rLXQkXQ== X-Received: by 10.28.222.68 with SMTP id v65mr154640wmg.66.1456852554917; Tue, 01 Mar 2016 09:15:54 -0800 (PST) Received: from localhost (beleg.madhouse-project.org. [128.199.36.147]) by smtp.gmail.com with ESMTPSA id ll9sm31822629wjc.29.2016.03.01.09.15.51 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 01 Mar 2016 09:15:52 -0800 (PST) Date: Tue, 1 Mar 2016 18:14:00 +0100 From: Emese Revfy To: linux-kbuild@vger.kernel.org Cc: pageexec@freemail.hu, spender@grsecurity.net, kernel-hardening@lists.openwall.com, mmarek@suse.com, keescook@chromium.org, linux@rasmusvillemoes.dk, fengguang.wu@intel.com Subject: [PATCH v4 0/3] Introduce GCC plugin infrastructure Message-Id: <20160301181400.9c623ee9230381da90b89b2a@gmail.com> X-Mailer: Sylpheed 3.4.3 (GTK+ 2.24.29; x86_64-pc-linux-gnu) Mime-Version: 1.0 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch set introduce the GCC plugin infrastructure with examples for testing and documentation. GCC plugins are loadable modules that provide extra features to the compiler. They are useful for runtime instrumentation and static analysis. The infrastructure supports all gcc versions from 4.5 to 6.0, building out-of-tree modules and building in a separate directory. Cross-compilation is supported too but currently only the x86 architecture enables plugins. This infrastructure was ported from grsecurity/PaX. It is a CII project supported by the Linux Foundation. Emese Revfy (3): GCC plugin infrastructure Add Cyclomatic complexity plugin Documentations of the GCC plugin infrastructre Changes from v3: * Fix some indentation related warnings (Suggested by checkpatch.pl) * Add maintainer entries * Don't run gcc_plugin.sh when the GCC_PLUGINS option is disabled or unsupported (Reported-by: Fengguang Wu ) I found a kbuild bug (or feature?) related to this patch. When a config option is disabled then the symbol gets undefined only when you run make clean. The easiest way to reproduce it is with e.g., CC_STACKPROTECTOR_STRONG: * patch in warning here: * enable CC_STACKPROTECTOR_STRONG in menuconfig * run make and it prints out the "AAAAAAAA" * enable CC_STACKPROTECTOR_NONE in menuconfig * run make and it prints out the "AAAAAAAA" * run make clean, run make again and it doesn't print out the "AAAAAAAA" Changes from v2: * Fixed incorrectly encoded characters * Generate the GIMPLE, IPA, SIMPLE_IPA and RTL pass structures (Suggested-by: Rasmus Villemoes ) * Write plugin related warning messages to stderr instead of stdout (Suggested-by: Kees Cook ) * Mention the installation of the gcc plugin headers (Documentation) Changes from v1: * Move the gcc-plugins make target into a separate Makefile because there may be a lot of plugins (Suggested-by: Rasmus Villemoes) * Simplify the dependencies of the plugin related config option (Suggested-by: Kees Cook ) * Removed the unnecessary example plugin --- Documentation/dontdiff | 1 + Documentation/gcc-plugins.txt | 82 ++++ MAINTAINERS | 8 + Makefile | 41 +- arch/Kconfig | 24 + arch/x86/Kconfig | 1 + init/Makefile | 3 + scripts/Makefile.build | 2 +- scripts/Makefile.clean | 3 +- scripts/Makefile.gcc-plugins | 32 ++ scripts/Makefile.host | 69 ++- scripts/gcc-plugin.sh | 51 ++ scripts/link-vmlinux.sh | 2 +- scripts/package/builddeb | 1 + tools/gcc/Makefile | 19 + tools/gcc/cyc_complexity_plugin.c | 73 +++ tools/gcc/gcc-common.h | 803 +++++++++++++++++++++++++++++++ tools/gcc/gcc-generate-gimple-pass.h | 173 +++++++ tools/gcc/gcc-generate-ipa-pass.h | 287 +++++++++++ tools/gcc/gcc-generate-rtl-pass.h | 173 +++++++ tools/gcc/gcc-generate-simple_ipa-pass.h | 173 +++++++ 21 files changed, 2006 insertions(+), 15 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/Makefile b/Makefile index a1a7708..9e6961f 100644 --- a/Makefile +++ b/Makefile @@ -664,6 +664,7 @@ ifdef CONFIG_CC_STACKPROTECTOR_REGULAR else ifdef CONFIG_CC_STACKPROTECTOR_STRONG stackp-flag := -fstack-protector-strong + $(warning AAAAAAAA) ifeq ($(call cc-option, $(stackp-flag)),) $(warning Cannot use CONFIG_CC_STACKPROTECTOR_STRONG: \ -fstack-protector-strong not supported by compiler)