Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5609646imu; Mon, 26 Nov 2018 02:58:27 -0800 (PST) X-Google-Smtp-Source: AFSGD/ULlhnNI6o783/CxmCsrEkIZy+HmrMe15K7mtvRSXn99YtQmffD3Do6jT3PXbIx/A37AGU0 X-Received: by 2002:a17:902:161:: with SMTP id 88mr12041524plb.306.1543229907689; Mon, 26 Nov 2018 02:58:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543229907; cv=none; d=google.com; s=arc-20160816; b=MESvjyq4IA+YXpf+EfRh5wFTKz/SJXJuWrGU3DrFR2CwjHRS4DIzc2n/53LIrzaUhN GFb22v0w3Hbtqegj/Ooe4IVsJk6GvzP1ImekgAJ2cabYp+iN9t968prLEza6CTx7nmJB qENF1rSblZ2n68sETyC7NQRxrn4B5nmcxsS2at/ZAb8+Kn1RTOyZOOBU58/UDHs+3wgT StfHaNrk7vrGkGUw0xuy9++4YGJiFnpdyw2n/MxApFesT7krErKm87N6tRxYKNY0Jv4j 9fidUZE8/LQs3gZSWyM8eQoYlW3qf3jISs28CVTxG4C7G84ywP+7Eb/lCzepkmTgRbjo bs+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Uxm4te+MkIpVGCefzpl9EZ0L3HJddTlaIPv92QwHHHc=; b=CNS5tZEvZvqJSxs2lDq9RsZ9dHLRrG4oQwKqBhUjvqy4Hn9xIhFlStyAANRQ1bflWy 0rXOTJxrOrz6W1Q3vYo8MJxhufEKkX185DPEycwWdDX//Xu7EHuB02cnUQhI9sNUQ+h2 YSbmSth1kqrwx118hH17VEeHkqEk3YoTCU68Dthqzj2eSqkNFQYvV8u0lBEdG610X/Cx Ne84Ji/B6RXfoLvAS2ZDGqf0CjnOjIxsAc+XR4HIjPVwYE/HWggamKvYUDBW8N2KFqPD dAewN45Rcnm5UuhOk11nA2P16U6dkzOKomiL7U6g0W6d+Rrm6FwlrZHge+aGezAIU+lx gT3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qQTTO+4p; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w15si33774031plk.357.2018.11.26.02.58.12; Mon, 26 Nov 2018 02:58:27 -0800 (PST) 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=@kernel.org header.s=default header.b=qQTTO+4p; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728006AbeKZVtO (ORCPT + 99 others); Mon, 26 Nov 2018 16:49:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:58090 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726923AbeKZVtO (ORCPT ); Mon, 26 Nov 2018 16:49:14 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4C6452089F; Mon, 26 Nov 2018 10:55:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543229729; bh=4I7qxp/fUZsbpm/Pj7R9FQCAeCgi+ta56c8M3R8rXyE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qQTTO+4p9WwFb3xdH7F5k4rX5atvBxL8RikChDJMoox9WrhG0cPujW8iS/98iJgPL uLrOz6UEedp5IktPIu1UHExr+11K8Qmr2gjqwZAl+UTtqHTx2JDf89XyZJ4G00ToKf n0V0fSjuzTDuc+ed7DKTVslcPFaaFPraCUPZ0ork= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Vin=C3=ADcius=20Tinti?= , Behan Webster , Matthias Kaehlcke , Masahiro Yamada , Nathan Chancellor Subject: [PATCH 4.4 14/70] kbuild: Add support to generate LLVM assembly files Date: Mon, 26 Nov 2018 11:50:29 +0100 Message-Id: <20181126105048.259902707@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181126105046.722096341@linuxfoundation.org> References: <20181126105046.722096341@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Vinícius Tinti commit 433db3e260bc8134d4a46ddf20b3668937e12556 upstream. Add rules to kbuild in order to generate LLVM assembly files with the .ll extension when using clang. # from c code make CC=clang kernel/pid.ll Signed-off-by: Vinícius Tinti Signed-off-by: Behan Webster Signed-off-by: Matthias Kaehlcke Signed-off-by: Masahiro Yamada [nc: Fix conflicts due to lack of commit 6b90bd4ba40b3 in linux-4.4.y] Signed-off-by: Nathan Chancellor Signed-off-by: Greg Kroah-Hartman --- .gitignore | 1 + Makefile | 5 +++++ scripts/Makefile.build | 8 ++++++++ 3 files changed, 14 insertions(+) --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,7 @@ *.lzo *.patch *.gcno +*.ll modules.builtin Module.symvers *.dwo --- a/Makefile +++ b/Makefile @@ -1307,6 +1307,8 @@ help: @echo ' (default: $$(INSTALL_MOD_PATH)/lib/firmware)' @echo ' dir/ - Build all files in dir and below' @echo ' dir/file.[ois] - Build specified target only' + @echo ' dir/file.ll - Build the LLVM assembly file' + @echo ' (requires compiler support for LLVM assembly generation)' @echo ' dir/file.lst - Build specified mixed source/assembly target only' @echo ' (requires a recent binutils and recent build (System.map))' @echo ' dir/file.ko - Build module including final link' @@ -1482,6 +1484,7 @@ clean: $(clean-dirs) -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ -o -name '*.symtypes' -o -name 'modules.order' \ -o -name modules.builtin -o -name '.tmp_*.o.*' \ + -o -name '*.ll' \ -o -name '*.gcno' \) -type f -print | xargs rm -f # Generate tags for editors @@ -1585,6 +1588,8 @@ endif $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) %.symtypes: %.c prepare scripts FORCE $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) +%.ll: %.c prepare scripts FORCE + $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) # Modules /: prepare scripts FORCE --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -175,6 +175,14 @@ cmd_cc_symtypes_c = $(obj)/%.symtypes : $(src)/%.c FORCE $(call cmd,cc_symtypes_c) +# LLVM assembly +# Generate .ll files from .c +quiet_cmd_cc_ll_c = CC $(quiet_modtag) $@ + cmd_cc_ll_c = $(CC) $(c_flags) -emit-llvm -S -o $@ $< + +$(obj)/%.ll: $(src)/%.c FORCE + $(call if_changed_dep,cc_ll_c) + # C (.c) files # The C file is compiled and updated dependency information is generated. # (See cmd_cc_o_c + relevant part of rule_cc_o_c)