offsets.h generation
At present, if you change something that means offsets.h should be regenerated, the automatic dependencies mechanism doesn't do it.
Herewith a patch that adds proper dependency generation for
printoffsets.s (and hence offsets.h)
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.1091 -> 1.1092
# arch/ia64/Makefile 1.48 -> 1.49
# arch/ia64/tools/Makefile 1.12 -> 1.13
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/05/19 [email protected] 1.1092
# [IA64] Add dependencies so that offsets.h gets regenerated if it has to be. # --------------------------------------------
#
arch/ia64/Makefile +3 -1
@@ -86,10 +86,12 @@ prepare: include/asm-ia64/offsets.h +include/asm-ia64/offsets.h : arch/ia64/tools/offsets.h + boot: lib/lib.a vmlinux $(Q)$(MAKE) $(build)=$(boot) $@ -include/asm-ia64/offsets.h: +arch/ia64/tools/offsets.h include/asm-ia64/offsets.h: $(Q)$(MAKE) $(build)=$(tools) $@ define archhelp
arch/ia64/tools/Makefile +4 -3
@@ -32,8 +32,7 @@ $(obj)/print_offsets: $(src)/print_offsets.c FORCE [ -r $(TARGET) ] || echo "#define IA64_TASK_SIZE 0" > $(TARGET) - $(CC) $(CFLAGS) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) \ - $(src)/print_offsets.c -o $@ + $(CC) $(c_flags) $(src)/print_offsets.c -o $@ FORCE:
@@ -44,7 +43,9 @@ $(obj)/print_offsets.s: $(src)/print_offsets.c [ -r $(TARGET) ] || echo "#define IA64_TASK_SIZE 0" > $(TARGET) - $(CC) $(CFLAGS) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) -S $^ -o $@ + $(CC) $(c_flags) -MT $@ -S $^ -o $@ + scripts/fixdep $(depfile) $@ "$(CC) $(c_flags) -MT $@ -S $^ -o $@" > $(obj)/.print_offsets.s.cmd + rm $(depfile) endif
On Mon, May 19, 2003 at 02:30:57PM +1000, Peter Chubb wrote:
Content-Description: message body text
Quoted 6 lines
At present, if you change something that means
offsets.hshould be regenerated, the automatic dependencies mechanism doesn't do it.Herewith a patch that adds proper dependency generation for
printoffsets.s (and henceoffsets.h)
I agree with the intention, but not the solution.
Other architectures generate a .s file from a .c file, and filechk_gen-asm-offsets in the top-level Makefile is used to retreive the asm offset parameters.
In this way you use the kbuild mecanishm to find dependencies, and ia64 shift to do it the same way as other architectures. See i386, sparc and other for a template how to do it. Note that most of the architectures list too much dependencies in the arch specific makefile. I will clean that up sometime.
Would you mind trying to look into this solution?
Sam
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Sam" == Sam Ravnborg <[email protected]> writes:
Sam> On Mon, May 19, 2003 at 02:30:57PM +1000, Peter Chubb wrote:
Sam> Content-Description: message body text
Quoted 5 lines
Quoted 5 lines
At present, if you change something that means
offsets.hshould be regenerated, the automatic dependencies mechanism doesn't do it.Herewith a patch that adds proper dependency generation for printoffsets.s (and hence
offsets.h)
Sam> I agree with the intention, but not the solution. Other Sam> architectures generate a .s file from a .c file, and Sam> filechk_gen-asm-offsets in the top-level Makefile is used to Sam> retreive the asm offset parameters.
OK, here's a patch that does it that way. Because some of the needed header files in turn depend on a symbol from offsets.h, I had to create a dummy one `by hand' if it didn't previously exist. A timestamp file, include/asm-ia64/.offsets.h.stamp, tracks when this was done so that 'make' after 'make clean' works; and 'make' after 'make' works.
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.1091 -> 1.1092 # arch/ia64/Makefile 1.48 -> 1.49 # (new) -> 1.1 arch/ia64/kernel/asm-offsets.c
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/05/20 [email protected] 1.1092
# Generate include/asm/offsets.h in a way compatible with the other architectures, so that
# dependencies are maintained correctly.
# --------------------------------------------
#
arch/ia64/Makefile +12 -6
@@ -66,7 +66,6 @@ drivers-$(CONFIG_IA64_GENERIC) += arch/ia64/hp/common/ arch/ia64/hp/zx1/ arch/ia64/hp/sim/ boot := arch/ia64/boot -tools := arch/ia64/tools .PHONY: boot compressed check
@@ -80,17 +79,24 @@ archclean: $(Q)$(MAKE) $(clean)=$(boot) - $(Q)$(MAKE) $(clean)=$(tools) -CLEAN_FILES += include/asm-ia64/offsets.h vmlinux.gz bootloader +CLEAN_FILES += include/asm-ia64/offsets.h include/asm-ia64/.offsets.h.stamp vmlinux.gz bootloader -prepare: include/asm-ia64/offsets.h +prepare: include/asm-ia64/offsets.h +arch/$(ARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \ + include/config/MARKER include/asm-$(ARCH)/.offsets.h.stamp + +include/asm-$(ARCH)/.offsets.h.stamp: + [ -f include/asm-$(ARCH)/offsets.h ] || echo "#define IA64_TASK_SIZE 0" > include/asm-$(ARCH)/offsets.h + touch $@ + + +include/asm-$(ARCH)/offsets.h: arch/$(ARCH)/kernel/asm-offsets.s + $(call filechk,gen-asm-offsets) boot: lib/lib.a vmlinux $(Q)$(MAKE) $(build)=$(boot) $@ -include/asm-ia64/offsets.h: - $(Q)$(MAKE) $(build)=$(tools) $@ define archhelp echo ' compressed - Build compressed kernel image'
arch/ia64/kernel/asm-offsets.c new file +182 -0
182 lines not on this page · raw message
Quoted 2 lines · Peter Chubb
OK, here's a patch that does it that way.
Much better, thanks. A few more comments.
I assume that deletion of files in arch/ia64/tools will follow in seperate cset.
Quoted 6 lines
Because some of the needed
header files in turn depend on a symbol fromoffsets.h, I had to create a dummy one `by hand' if it didn't previously exist. A timestamp file,include/asm-ia64/.offsets.h.stamp, tracks when this was done so that 'make' after 'make clean' works; and 'make' after 'make' works.
David: Can we remove this circular dependency to get rid of this ugly workaround?
Review
Quoted 2 lines
(quoted diff) +1
-1-CLEAN_FILES += include/asm-ia64/offsets.h vmlinux.gz bootloader +CLEAN_FILES += include/asm-ia64/offsets.h include/asm-ia64/.offsets.h.stamp vmlinux.gz bootloader
Break in two lines.
Review
Quoted 5 lines
(quoted diff) +3
-1-prepare: include/asm-ia64/offsets.h +prepare: include/asm-ia64/offsets.h +arch/$(ARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \ + include/config/MARKER include/asm-$(ARCH)/.offsets.h.stamp
Dependency on include/asm include/linux/version.h and include/config/MARKER is not needed.
I would prefer to have dependencies for arch/$(ARCH)/kernel/asm-offsets.s located in kernel/Makefile from where the .s fil is actually build. Note that it is the general %.s : %.c rule from the top-level Makefile that kicks in and make sure the .s file get build when needed.
Review
Quoted 4 lines
(quoted diff) +4
-0+ +include/asm-$(ARCH)/.offsets.h.stamp: + [ -f include/asm-$(ARCH)/offsets.h ] || echo "#define IA64_TASK_SIZE 0" > include/asm-$(ARCH)/offsets.h + touch $@
So this part should go in kernel/MAkefile as well.
Quoted 1 line
+#include "
../kernel/sigframe.h"
This include should be without "../kernel".
Thanks for cleaning this up.
Sam
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Peter Chubb
Peter> OK, here's a patch that does it that way. Because some of Peter> the needed header files in turn depend on a symbol from Peter> offsets.h, I had to create a dummy one `by hand' if it didn't Peter> previously exist. A timestamp file,
Peter> include/asm-ia64/.offsets.h.stamp, tracks when this was done Peter> so that 'make' after 'make clean' works; and 'make' after Peter> 'make' works.
Is processor.h the only cause of this recursive dependency? As far as I remember, we don't even need to include offsets.h in processor.h anymore. It used to be necessary for get_wchan(), but that's now an out-of-line function.
--david
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
"David" = David Mosberger <[email protected]> writes:
On Tue, 20 May 2003 11:26:31 +1000, Peter Chubb <[email protected]> said:
Peter> OK, here's a patch that does it that way. Because some of the Peter> needed header files in turn depend on a symbol from offsets.h, Peter> I had to create a dummy one `by hand' if it didn't previously Peter> exist. A timestamp file, include/asm-ia64/.offsets.h.stamp, Peter> tracks when this was done so that 'make' after 'make clean' Peter> works; and 'make' after 'make' works.
David> Is processor.h the only cause of this recursive dependency? As David> far as I remember, we don't even need to include offsets.h in David> processor.h anymore. It used to be necessary for get_wchan(), David> but that's now an out-of-line function.
I'll try deleting that one tomorrow when I'm in at work... if we can get rid of it, everything becomes *much* cleaner.
Peter C
David> Is processor.h the only cause of this recursive dependency? As David> far as I remember, we don't even need to include offsets.h in David> processor.h anymore. It used to be necessary for get_wchan(), David> but that's now an out-of-line function.
Now there's also a dependency in thread_info.h that unfortunately can't be worked around, and in ptrace.h
Anyway, here's hopefully the final patch, against the IA64-2.5 BK tree as of this morning.
arch/ia64/Makefile +4 -5
@@ -66,7 +66,6 @@ drivers-$(CONFIG_IA64_GENERIC) += arch/ia64/hp/common/ arch/ia64/hp/zx1/ arch/ia64/hp/sim/ boot := arch/ia64/boot -tools := arch/ia64/tools .PHONY: boot compressed check
@@ -80,17 +79,17 @@ archclean: $(Q)$(MAKE) $(clean)=$(boot) - $(Q)$(MAKE) $(clean)=$(tools) CLEAN_FILES += include/asm-ia64/offsets.h vmlinux.gz bootloader -prepare: include/asm-ia64/offsets.h +prepare: include/asm-ia64/offsets.h + +include/asm-$(ARCH)/offsets.h: arch/$(ARCH)/kernel/asm-offsets.s + $(call filechk,gen-asm-offsets) boot: lib/lib.a vmlinux $(Q)$(MAKE) $(build)=$(boot) $@ -include/asm-ia64/offsets.h: - $(Q)$(MAKE) $(build)=$(tools) $@ define archhelp echo ' compressed - Build compressed kernel image'
arch/ia64/kernel/Makefile +8 -0
@@ -18,3 +18,11 @@ obj-$(CONFIG_IOSAPIC) += iosapic.o obj-$(CONFIG_MODULES) += module.o obj-$(CONFIG_SMP) += smp.o smpboot.o + +arch/$(ARCH)/kernel/asm-offsets.s: include/asm-$(ARCH)/.offsets.h.stamp + +include/asm-$(ARCH)/.offsets.h.stamp: + [ -s include/asm-$(ARCH)/offsets.h ] || echo "#define IA64_TASK_SIZE 0" > include/asm-$(ARCH)/offsets.h + touch $@ + +CLEAN_FILES += include/asm-ia64/.offsets.h.stamp
arch/ia64/kernel/asm-offsets.c +182 -0
182 lines not on this page · raw message
arch/ia64/tools/Makefile +0 -51
51 lines not on this page · raw message
arch/ia64/tools/print_offsets.awk +0 -72
72 lines not on this page · raw message
arch/ia64/tools/print_offsets.c +0 -220
220 lines not on this page · raw message
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Peter Chubb
Peter> Anyway, here's hopefully the final patch, against the Peter> IA64-2.5 BK tree as of this morning.
Argh, bad timing: I just commited Rohit's patch for the streamlined syscall path, which of course makes a number of changes to print_offsets.c ;-(
I'd push it right now, except that I need to twists bk to let me do it ("bk undo" just never works quite as well as I'd like...).
--david
OK, here's a patch against this morning's BK tree. (or would you prefer I stuck a BK tree in a publicly accessible place, that you could pull from?)
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.1099 -> 1.1101
# arch/ia64/Makefile 1.49 -> 1.50
# arch/ia64/tools/print_offsets.c 1.18 -> (deleted)
# arch/ia64/kernel/Makefile 1.17 -> 1.18
# (new) -> 1.1 arch/ia64/kernel/asm-offsets.c
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/05/26 [email protected] 1.1100
# IA64: generate include/asm/offsets.h in a way similar to all other architectures. #
# Delete references to arch/ia64/tools; use standard sed script to generate offsets.h. #
# This gets the dependencies right for offsets.h
#
# (Next change set removes arch/ia64/tools/ directory)
# --------------------------------------------
# 03/05/26 [email protected] 1.1101
# IA64: Remove now-unneeded arch/ia64/tools subdirectory
# --------------------------------------------
#
arch/ia64/Makefile +4 -5
@@ -66,7 +66,6 @@ drivers-$(CONFIG_IA64_GENERIC) += arch/ia64/hp/common/ arch/ia64/hp/zx1/ arch/ia64/hp/sim/ boot := arch/ia64/boot -tools := arch/ia64/tools .PHONY: boot compressed check
@@ -80,17 +79,17 @@ archclean: $(Q)$(MAKE) $(clean)=$(boot) - $(Q)$(MAKE) $(clean)=$(tools) CLEAN_FILES += include/asm-ia64/offsets.h vmlinux.gz bootloader -prepare: include/asm-ia64/offsets.h +prepare: include/asm-ia64/offsets.h + +include/asm-$(ARCH)/offsets.h: arch/$(ARCH)/kernel/asm-offsets.s + $(call filechk,gen-asm-offsets) boot: lib/lib.a vmlinux $(Q)$(MAKE) $(build)=$(boot) $@ -include/asm-ia64/offsets.h: - $(Q)$(MAKE) $(build)=$(tools) $@ define archhelp echo ' compressed - Build compressed kernel image'
arch/ia64/kernel/Makefile +8 -0
@@ -18,3 +18,11 @@ obj-$(CONFIG_IOSAPIC) += iosapic.o obj-$(CONFIG_MODULES) += module.o obj-$(CONFIG_SMP) += smp.o smpboot.o + +arch/$(ARCH)/kernel/asm-offsets.s: include/asm-$(ARCH)/.offsets.h.stamp + +include/asm-$(ARCH)/.offsets.h.stamp: + [ -s include/asm-$(ARCH)/offsets.h ] || echo "#define IA64_TASK_SIZE 0" > include/asm-$(ARCH)/offsets.h + touch $@ + +CLEAN_FILES += include/asm-ia64/.offsets.h.stamp
arch/ia64/kernel/asm-offsets.c new file +189 -0
189 lines not on this page · raw message
arch/ia64/tools/print_offsets.c deleted +0 -224
224 lines not on this page · raw message
And here's the next changeset to get rid of the rest of arch/ia64/tools/*:
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.1101 -> 1.1102
# arch/ia64/tools/Makefile 1.12 -> (deleted)
# arch/ia64/tools/print_offsets.awk 1.6 -> (deleted)
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/05/27 [email protected] 1.1102
# Delete the rest of arch/ia64/tools.
#
# .del-print_offsets.awk~ce325580e04f9929:
# Delete: arch/ia64/tools/print_offsets.awk
# .del-Makefile~90bde6a95198c56c:
# Delete: arch/ia64/tools/Makefile
# --------------------------------------------
#
arch/ia64/tools/Makefile deleted +0 -51
@@ -1,51 +0,0 @@ -CFLAGS = -g -O2 -Wall $(CPPFLAGS) - -TARGET = include/asm-ia64/offsets.h - -src = $(obj) - -clean-files := print_offsets.s print_offsets offsets.h - -$(TARGET): $(obj)/offsets.h - @if ! cmp -s $(obj)/offsets.h ${TARGET}; then \ - echo -e "*** Updating ${TARGET}..."; \ - cp $(obj)/offsets.h ${TARGET}; \ - else \ - echo "*** ${TARGET} is up to date"; \ - fi - -# -# If we're cross-compiling, we use the cross-compiler to translate -# print_offsets.c into an assembly file and then awk to translate this -# file into offsets.h. This avoids having to use a simulator to -# generate this file. This is based on an idea suggested by Asit -# Mallick. If we're running natively, we can of course just build -# print_offsets and run it. --davidm -# - -ifeq ($(CROSS_COMPILE),) - -$(obj)/offsets.h: $(obj)/print_offsets - $(obj)/print_offsets > $(obj)/offsets.h - -comma := , - -$(obj)/print_offsets: $(src)/print_offsets.c FORCE - [ -r $(TARGET) ] || echo "#define IA64_TASK_SIZE 0" > $(TARGET) - $(CC) $(CFLAGS) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) \ - $(src)/print_offsets.c -o $@ - -FORCE: - -else - -$(obj)/offsets.h: $(obj)/print_offsets.s - $(AWK) -f $(src)/print_offsets.awk $^ > $@ - -$(obj)/print_offsets.s: $(src)/print_offsets.c - [ -r $(TARGET) ] || echo "#define IA64_TASK_SIZE 0" > $(TARGET) - $(CC) $(CFLAGS) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) -S $^ -o $@ - -endif - -.PHONY: all modules modules_install
arch/ia64/tools/print_offsets.awk deleted +0 -72
72 lines not on this page · raw message
And here's the next changeset to get rid of the rest of arch/ia64/tools/*:
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.1101 -> 1.1102
# arch/ia64/tools/Makefile 1.12 -> (deleted)
# arch/ia64/tools/print_offsets.awk 1.6 -> (deleted)
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/05/27 [email protected] 1.1102
# Delete the rest of arch/ia64/tools.
#
# .del-print_offsets.awk~ce325580e04f9929:
# Delete: arch/ia64/tools/print_offsets.awk
# .del-Makefile~90bde6a95198c56c:
# Delete: arch/ia64/tools/Makefile
# --------------------------------------------
#
arch/ia64/tools/Makefile deleted +0 -51
@@ -1,51 +0,0 @@ -CFLAGS = -g -O2 -Wall $(CPPFLAGS) - -TARGET = include/asm-ia64/offsets.h - -src = $(obj) - -clean-files := print_offsets.s print_offsets offsets.h - -$(TARGET): $(obj)/offsets.h - @if ! cmp -s $(obj)/offsets.h ${TARGET}; then \ - echo -e "*** Updating ${TARGET}..."; \ - cp $(obj)/offsets.h ${TARGET}; \ - else \ - echo "*** ${TARGET} is up to date"; \ - fi - -# -# If we're cross-compiling, we use the cross-compiler to translate -# print_offsets.c into an assembly file and then awk to translate this -# file into offsets.h. This avoids having to use a simulator to -# generate this file. This is based on an idea suggested by Asit -# Mallick. If we're running natively, we can of course just build -# print_offsets and run it. --davidm -# - -ifeq ($(CROSS_COMPILE),) - -$(obj)/offsets.h: $(obj)/print_offsets - $(obj)/print_offsets > $(obj)/offsets.h - -comma := , - -$(obj)/print_offsets: $(src)/print_offsets.c FORCE - [ -r $(TARGET) ] || echo "#define IA64_TASK_SIZE 0" > $(TARGET) - $(CC) $(CFLAGS) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) \ - $(src)/print_offsets.c -o $@ - -FORCE: - -else - -$(obj)/offsets.h: $(obj)/print_offsets.s - $(AWK) -f $(src)/print_offsets.awk $^ > $@ - -$(obj)/print_offsets.s: $(src)/print_offsets.c - [ -r $(TARGET) ] || echo "#define IA64_TASK_SIZE 0" > $(TARGET) - $(CC) $(CFLAGS) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) -S $^ -o $@ - -endif - -.PHONY: all modules modules_install
arch/ia64/tools/print_offsets.awk deleted +0 -72
72 lines not on this page · raw message
David Mosberger
AppliedPeter> OK, here's a patch against this morning's BK tree.
Applied, thanks.
Peter> or would you prefer I stuck a BK tree in a publicly Peter> accessible place, that you could pull from?)
Nah, that's OK. With patches it's much easier to make trivial changes, such as deleting the trailing whitespace that everybody seems to love so much... ;-)
--david