linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Matthias Kaehlcke <mka@chromium.org>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	Nathan Chancellor <natechancellor@gmail.com>
Subject: [PATCH 4.4 08/70] kbuild: Consolidate header generation from ASM offset information
Date: Mon, 26 Nov 2018 11:50:23 +0100	[thread overview]
Message-ID: <20181126105047.696696838@linuxfoundation.org> (raw)
In-Reply-To: <20181126105046.722096341@linuxfoundation.org>

4.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Matthias Kaehlcke <mka@chromium.org>

commit ebf003f0cfb3705e60d40dedc3ec949176c741af upstream.

Largely redundant code is used in different places to generate C headers
from offset information extracted from assembly language output.
Consolidate the code in Makefile.lib and use this instead.

Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 Kbuild                    |   25 -------------------------
 arch/ia64/kernel/Makefile |   26 ++------------------------
 scripts/Makefile.lib      |   28 ++++++++++++++++++++++++++++
 scripts/mod/Makefile      |   28 ++--------------------------
 4 files changed, 32 insertions(+), 75 deletions(-)

--- a/Kbuild
+++ b/Kbuild
@@ -6,31 +6,6 @@
 # 3) Generate asm-offsets.h (may need bounds.h and timeconst.h)
 # 4) Check for missing system calls
 
-# Default sed regexp - multiline due to syntax constraints
-define sed-y
-	"/^->/{s:->#\(.*\):/* \1 */:; \
-	s:^->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \
-	s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
-	s:->::; p;}"
-endef
-
-# Use filechk to avoid rebuilds when a header changes, but the resulting file
-# does not
-define filechk_offsets
-	(set -e; \
-	 echo "#ifndef $2"; \
-	 echo "#define $2"; \
-	 echo "/*"; \
-	 echo " * DO NOT MODIFY."; \
-	 echo " *"; \
-	 echo " * This file was generated by Kbuild"; \
-	 echo " */"; \
-	 echo ""; \
-	 sed -ne $(sed-y); \
-	 echo ""; \
-	 echo "#endif" )
-endef
-
 #####
 # 1) Generate bounds.h
 
--- a/arch/ia64/kernel/Makefile
+++ b/arch/ia64/kernel/Makefile
@@ -50,32 +50,10 @@ CFLAGS_traps.o  += -mfixed-range=f2-f5,f
 # The gate DSO image is built using a special linker script.
 include $(src)/Makefile.gate
 
-# Calculate NR_IRQ = max(IA64_NATIVE_NR_IRQS, XEN_NR_IRQS, ...) based on config
-define sed-y
-	"/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"
-endef
-quiet_cmd_nr_irqs = GEN     $@
-define cmd_nr_irqs
-	(set -e; \
-	 echo "#ifndef __ASM_NR_IRQS_H__"; \
-	 echo "#define __ASM_NR_IRQS_H__"; \
-	 echo "/*"; \
-	 echo " * DO NOT MODIFY."; \
-	 echo " *"; \
-	 echo " * This file was generated by Kbuild"; \
-	 echo " *"; \
-	 echo " */"; \
-	 echo ""; \
-	 sed -ne $(sed-y) $<; \
-	 echo ""; \
-	 echo "#endif" ) > $@
-endef
-
 # We use internal kbuild rules to avoid the "is up to date" message from make
 arch/$(SRCARCH)/kernel/nr-irqs.s: arch/$(SRCARCH)/kernel/nr-irqs.c
 	$(Q)mkdir -p $(dir $@)
 	$(call if_changed_dep,cc_s_c)
 
-include/generated/nr-irqs.h: arch/$(SRCARCH)/kernel/nr-irqs.s
-	$(Q)mkdir -p $(dir $@)
-	$(call cmd,nr_irqs)
+include/generated/nr-irqs.h: arch/$(SRCARCH)/kernel/nr-irqs.s FORCE
+	$(call filechk,offsets,__ASM_NR_IRQS_H__)
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -388,3 +388,31 @@ quiet_cmd_xzmisc = XZMISC  $@
 cmd_xzmisc = (cat $(filter-out FORCE,$^) | \
 	xz --check=crc32 --lzma2=dict=1MiB) > $@ || \
 	(rm -f $@ ; false)
+
+# ASM offsets
+# ---------------------------------------------------------------------------
+
+# Default sed regexp - multiline due to syntax constraints
+define sed-offsets
+	"/^->/{s:->#\(.*\):/* \1 */:; \
+	s:^->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \
+	s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
+	s:->::; p;}"
+endef
+
+# Use filechk to avoid rebuilds when a header changes, but the resulting file
+# does not
+define filechk_offsets
+	(set -e; \
+	 echo "#ifndef $2"; \
+	 echo "#define $2"; \
+	 echo "/*"; \
+	 echo " * DO NOT MODIFY."; \
+	 echo " *"; \
+	 echo " * This file was generated by Kbuild"; \
+	 echo " */"; \
+	 echo ""; \
+	 sed -ne $(sed-offsets); \
+	 echo ""; \
+	 echo "#endif" )
+endef
--- a/scripts/mod/Makefile
+++ b/scripts/mod/Makefile
@@ -5,32 +5,8 @@ modpost-objs	:= modpost.o file2alias.o s
 
 devicetable-offsets-file := devicetable-offsets.h
 
-define sed-y
-	"/^->/{s:->#\(.*\):/* \1 */:; \
-	s:^->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \
-	s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
-	s:->::; p;}"
-endef
-
-quiet_cmd_offsets = GEN     $@
-define cmd_offsets
-	(set -e; \
-	 echo "#ifndef __DEVICETABLE_OFFSETS_H__"; \
-	 echo "#define __DEVICETABLE_OFFSETS_H__"; \
-	 echo "/*"; \
-	 echo " * DO NOT MODIFY."; \
-	 echo " *"; \
-	 echo " * This file was generated by Kbuild"; \
-	 echo " *"; \
-	 echo " */"; \
-	 echo ""; \
-	 sed -ne $(sed-y) $<; \
-	 echo ""; \
-	 echo "#endif" ) > $@
-endef
-
-$(obj)/$(devicetable-offsets-file): $(obj)/devicetable-offsets.s
-	$(call if_changed,offsets)
+$(obj)/$(devicetable-offsets-file): $(obj)/devicetable-offsets.s FORCE
+	$(call filechk,offsets,__DEVICETABLE_OFFSETS_H__)
 
 targets += $(devicetable-offsets-file) devicetable-offsets.s
 



  parent reply	other threads:[~2018-11-26 10:54 UTC|newest]

Thread overview: 81+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-26 10:50 [PATCH 4.4 00/70] 4.4.165-stable review Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 01/70] flow_dissector: do not dissect l4 ports for fragments Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 02/70] ip_tunnel: dont force DF when MTU is locked Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 03/70] net-gro: reset skb->pkt_type in napi_reuse_skb() Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 04/70] tg3: Add PHY reset for 5717/5719/5720 in change ring and flow control paths Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 05/70] ipv6: Fix PMTU updates for UDP/raw sockets in presence of VRF Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 06/70] kbuild: Add better clang cross build support Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 07/70] kbuild: clang: add -no-integrated-as to KBUILD_[AC]FLAGS Greg Kroah-Hartman
2018-11-26 10:50 ` Greg Kroah-Hartman [this message]
2018-11-26 10:50 ` [PATCH 4.4 09/70] kbuild: consolidate redundant sed script ASM offset generation Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 10/70] kbuild: fix asm-offset generation to work with clang Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 11/70] kbuild: drop -Wno-unknown-warning-option from clang options Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 12/70] kbuild, LLVMLinux: Add -Werror to cc-option to support clang Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 13/70] kbuild: use -Oz instead of -Os when using clang Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 14/70] kbuild: Add support to generate LLVM assembly files Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 15/70] modules: mark __inittest/__exittest as __maybe_unused Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 16/70] kbuild: clang: Disable address-of-packed-member warning Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 17/70] crypto: arm64/sha - avoid non-standard inline asm tricks Greg Kroah-Hartman
2020-11-23 20:49   ` dann frazier
2020-12-05 20:39     ` dann frazier
2020-12-06  9:46       ` Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 18/70] efi/libstub/arm64: Force hidden visibility for section markers Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 19/70] efi/libstub/arm64: Set -fpie when building the EFI stub Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 20/70] kbuild: fix linker feature test macros when cross compiling with Clang Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 21/70] kbuild: Set KBUILD_CFLAGS before incl. arch Makefile Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 22/70] kbuild: move cc-option and cc-disable-warning after " Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 23/70] kbuild: clang: fix build failures with sparse check Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 24/70] kbuild: clang: remove crufty HOSTCFLAGS Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 25/70] kbuild: clang: disable unused variable warnings only when constant Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 26/70] kbuild: set no-integrated-as before incl. arch Makefile Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 27/70] kbuild: allow to use GCC toolchain not in Clang search path Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 28/70] arm64: Disable asm-operand-width warning for clang Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 29/70] x86/kbuild: Use cc-option to enable -falign-{jumps/loops} Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 30/70] crypto, x86: aesni - fix token pasting for clang Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 31/70] x86/mm/kaslr: Use the _ASM_MUL macro for multiplication to work around Clang incompatibility Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 32/70] kbuild: Add __cc-option macro Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 33/70] x86/build: Use __cc-option for boot code compiler options Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 34/70] x86/build: Specify stack alignment for clang Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 35/70] x86/boot: #undef memcpy() et al in string.c Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 36/70] x86/build: Fix stack alignment for CLang Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 37/70] x86/build: Use cc-option to validate stack alignment parameter Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 38/70] reiserfs: propagate errors from fill_with_dentries() properly Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 39/70] hfs: prevent btree data loss on root split Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 40/70] hfsplus: " Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 41/70] um: Give start_idle_thread() a return code Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 42/70] fs/exofs: fix potential memory leak in mount option parsing Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 43/70] clk: samsung: exynos5420: Enable PERIS clocks for suspend Greg Kroah-Hartman
2018-11-26 10:50 ` [PATCH 4.4 44/70] platform/x86: acerhdf: Add BIOS entry for Gateway LT31 v1.3307 Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.4 45/70] arm64: percpu: Initialize ret in the default case Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.4 46/70] s390/vdso: add missing FORCE to build targets Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.4 47/70] netfilter: ipset: actually allow allowable CIDR 0 in hash:net,port,net Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.4 48/70] s390/mm: Fix ERROR: "__node_distance" undefined! Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.4 49/70] netfilter: ipset: Correct rcu_dereference() call in ip_set_put_comment() Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.4 50/70] netfilter: xt_IDLETIMER: add sysfs filename checking routine Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.4 51/70] hwmon: (ibmpowernv) Remove bogus __init annotations Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.4 52/70] lib/raid6: Fix arm64 test build Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.4 53/70] i2c: omap: Enable for ARCH_K3 Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.4 54/70] zram: close udev startup race condition as default groups Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.4 55/70] SUNRPC: drop pointless static qualifier in xdr_get_next_encode_buffer() Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.4 56/70] gfs2: Put bitmap buffers in put_super Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.4 57/70] btrfs: fix pinned underflow after transaction aborted Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.4 58/70] Revert "media: videobuf2-core: dont call memop finish when queueing" Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.4 59/70] Revert "Bluetooth: h5: Fix missing dependency on BT_HCIUART_SERDEV" Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.4 60/70] media: v4l: event: Add subscription to list before calling "add" operation Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.4 61/70] uio: Fix an Oops on load Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.4 62/70] usb: cdc-acm: add entry for Hiro (Conexant) modem Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.4 63/70] USB: quirks: Add no-lpm quirk for Raydium touchscreens Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.4 64/70] usb: quirks: Add delay-init quirk for Corsair K70 LUX RGB Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.4 65/70] misc: atmel-ssc: Fix section annotation on atmel_ssc_get_driver_data Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.4 66/70] USB: misc: appledisplay: add 20" Apple Cinema Display Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.4 67/70] drivers/misc/sgi-gru: fix Spectre v1 vulnerability Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.4 68/70] ACPI / platform: Add SMB0001 HID to forbidden_id_list Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.4 69/70] new helper: uaccess_kernel() Greg Kroah-Hartman
2018-11-26 10:51 ` [PATCH 4.4 70/70] HID: uhid: forbid UHID_CREATE under KERNEL_DS or elevated privileges Greg Kroah-Hartman
2018-11-26 16:29 ` [PATCH 4.4 00/70] 4.4.165-stable review kernelci.org bot
2018-11-26 23:49 ` Guenter Roeck
2018-11-26 23:54 ` shuah
2018-11-27  9:56 ` Harsh Shandilya
2018-11-27 14:39   ` Greg Kroah-Hartman
2018-11-27 13:09 ` Naresh Kamboju
2018-11-27 13:29 ` Jon Hunter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181126105047.696696838@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mka@chromium.org \
    --cc=natechancellor@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=yamada.masahiro@socionext.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).