Commit febe1b02 authored by Kai Germaschewski's avatar Kai Germaschewski

kbuild: asm offset generation for ARM

Switch ARM to the new way of asm offset generation.
parent 7feb5557
...@@ -195,29 +195,25 @@ endif ...@@ -195,29 +195,25 @@ endif
MAKEBOOT =$(MAKE) -C arch/$(ARCH)/boot MAKEBOOT =$(MAKE) -C arch/$(ARCH)/boot
MAKETOOLS =$(MAKE) -C arch/$(ARCH)/tools MAKETOOLS =$(MAKE) -C arch/$(ARCH)/tools
# The following is a hack to get 'constants.h' up
# to date before starting compilation
$(patsubst %,_dir_%, $(SUBDIRS)): maketools
$(patsubst %,_modsubdir_%,$(MOD_DIRS)): maketools
# Update machine arch and proc symlinks if something which affects # Update machine arch and proc symlinks if something which affects
# them changed. We use .arch and .proc to indicate when they were # them changed. We use .arch and .proc to indicate when they were
# updated last, otherwise make uses the target directory mtime. # updated last, otherwise make uses the target directory mtime.
include/asm-arm/.arch: $(wildcard include/config/arch/*.h) include/asm-arm/.arch: $(wildcard include/config/arch/*.h)
@echo 'Making asm-arm/arch -> asm-arm/arch-$(INCDIR) symlink' @echo ' Making asm-arm/arch -> asm-arm/arch-$(INCDIR) symlink'
@rm -f include/asm-arm/arch @rm -f include/asm-arm/arch
@ln -sf arch-$(INCDIR) include/asm-arm/arch @ln -sf arch-$(INCDIR) include/asm-arm/arch
@touch $@ @touch $@
include/asm-arm/.proc: $(wildcard include/config/cpu/32.h) $(wildcard include/config/cpu/26.h) include/asm-arm/.proc: $(wildcard include/config/cpu/32.h) $(wildcard include/config/cpu/26.h)
@echo 'Making asm-arm/proc -> asm-arm/proc-$(PROCESSOR) symlink' @echo ' Making asm-arm/proc -> asm-arm/proc-$(PROCESSOR) symlink'
@rm -f include/asm-arm/proc @rm -f include/asm-arm/proc
@ln -sf proc-$(PROCESSOR) include/asm-arm/proc @ln -sf proc-$(PROCESSOR) include/asm-arm/proc
@touch $@ @touch $@
.hdepend: include/asm-arm/.arch include/asm-arm/.proc prepare: include/asm-arm/.arch include/asm-arm/.proc \
include/asm-arm/constants.h
@$(MAKETOOLS)
vmlinux: arch/arm/vmlinux.lds vmlinux: arch/arm/vmlinux.lds
...@@ -234,7 +230,6 @@ CLEAN_FILES += \ ...@@ -234,7 +230,6 @@ CLEAN_FILES += \
arch/arm/vmlinux.lds arch/arm/vmlinux.lds
MRPROPER_FILES += \ MRPROPER_FILES += \
arch/arm/tools/constants.h* \
include/asm-arm/arch include/asm-arm/.arch \ include/asm-arm/arch include/asm-arm/.arch \
include/asm-arm/proc include/asm-arm/.proc \ include/asm-arm/proc include/asm-arm/.proc \
include/asm-arm/constants.h* \ include/asm-arm/constants.h* \
...@@ -247,13 +242,9 @@ archmrproper: FORCE ...@@ -247,13 +242,9 @@ archmrproper: FORCE
archclean: FORCE archclean: FORCE
@$(MAKEBOOT) clean @$(MAKEBOOT) clean
archdep: FORCE
@$(MAKETOOLS) dep
@$(MAKEBOOT) dep
# we need version.h # we need version.h
maketools: include/linux/version.h FORCE maketools: include/linux/version.h FORCE
@$(MAKETOOLS) all @$(MAKETOOLS)
# My testing targets (that short circuit a few dependencies) # My testing targets (that short circuit a few dependencies)
zImg:; @$(MAKEBOOT) zImage zImg:; @$(MAKEBOOT) zImage
...@@ -277,3 +268,13 @@ bp:; @$(MAKEBOOT) bootpImage ...@@ -277,3 +268,13 @@ bp:; @$(MAKEBOOT) bootpImage
echo "$$CFG does not exist"; \ echo "$$CFG does not exist"; \
fi; \ fi; \
) )
arch/$(ARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \
include/config/MARKER
include/asm-$(ARCH)/constants.h.tmp: arch/$(ARCH)/kernel/asm-offsets.s
@$(generate-asm-offsets.h) < $< > $@
include/asm-$(ARCH)/constants.h: include/asm-$(ARCH)/constants.h.tmp
@echo -n ' Generating $@'
@$(update-if-changed)
...@@ -145,5 +145,3 @@ clean: ...@@ -145,5 +145,3 @@ clean:
$(RM) Image zImage bootpImage $(RM) Image zImage bootpImage
@$(MAKE) -C compressed clean @$(MAKE) -C compressed clean
@$(MAKE) -C bootp clean @$(MAKE) -C bootp clean
dep:
/* /*
* linux/arch/arm/tools/getconsdata.c * Copyright (C) 1995-2001 Russell King
* * 2001-2002 Keith Owens
* Copyright (C) 1995-2001 Russell King *
* Generate definitions needed by assembly language modules.
* This code generates raw asm output which is post-processed to extract
* and format the required data.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/config.h> #include <linux/config.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/mm.h> #include <linux/mm.h>
...@@ -31,45 +35,48 @@ ...@@ -31,45 +35,48 @@
#warning GCC 2.95.2 and earlier miscompiles kernels. #warning GCC 2.95.2 and earlier miscompiles kernels.
#endif #endif
#define OFF_TSK(n) (unsigned long)&(((struct task_struct *)0)->n) /* Use marker if you need to separate the values later */
#define OFF_VMA(n) (unsigned long)&(((struct vm_area_struct *)0)->n)
#define DEFN(name,off) asm("\n#define "name" %0" :: "I" (off))
void func(void)
{
DEFN("TSK_USED_MATH", OFF_TSK(used_math));
DEFN("TSK_ACTIVE_MM", OFF_TSK(active_mm));
DEFN("VMA_VM_MM", OFF_VMA(vm_mm)); #define DEFINE(sym, val) \
DEFN("VMA_VM_FLAGS", OFF_VMA(vm_flags)); asm volatile("\n->" #sym " %0 " #val : : "i" (val))
DEFN("VM_EXEC", VM_EXEC); #define BLANK() asm volatile("\n->" : : )
int main(void)
{
DEFINE(TSK_USED_MATH, offsetof(struct task_struct, used_math));
DEFINE(TSK_ACTIVE_MM, offsetof(struct task_struct, active_mm));
BLANK();
DEFINE(VMA_VM_MM, offsetof(struct vm_area_struct, vm_mm));
DEFINE(VMA_VM_FLAGS, offsetof(struct vm_area_struct, vm_flags));
BLANK();
DEFINE(VM_EXEC, VM_EXEC);
BLANK();
#ifdef CONFIG_CPU_32 #ifdef CONFIG_CPU_32
DEFN("HPTE_TYPE_SMALL", PTE_TYPE_SMALL); DEFINE(HPTE_TYPE_SMALL, PTE_TYPE_SMALL);
DEFN("HPTE_AP_READ", PTE_AP_READ); DEFINE(HPTE_AP_READ, PTE_AP_READ);
DEFN("HPTE_AP_WRITE", PTE_AP_WRITE); DEFINE(HPTE_AP_WRITE, PTE_AP_WRITE);
BLANK();
DEFN("LPTE_PRESENT", L_PTE_PRESENT); DEFINE(LPTE_PRESENT, L_PTE_PRESENT);
DEFN("LPTE_YOUNG", L_PTE_YOUNG); DEFINE(LPTE_YOUNG, L_PTE_YOUNG);
DEFN("LPTE_BUFFERABLE", L_PTE_BUFFERABLE); DEFINE(LPTE_BUFFERABLE, L_PTE_BUFFERABLE);
DEFN("LPTE_CACHEABLE", L_PTE_CACHEABLE); DEFINE(LPTE_CACHEABLE, L_PTE_CACHEABLE);
DEFN("LPTE_USER", L_PTE_USER); DEFINE(LPTE_USER, L_PTE_USER);
DEFN("LPTE_WRITE", L_PTE_WRITE); DEFINE(LPTE_WRITE, L_PTE_WRITE);
DEFN("LPTE_EXEC", L_PTE_EXEC); DEFINE(LPTE_EXEC, L_PTE_EXEC);
DEFN("LPTE_DIRTY", L_PTE_DIRTY); DEFINE(LPTE_DIRTY, L_PTE_DIRTY);
#endif #endif
BLANK();
#ifdef CONFIG_CPU_26 #ifdef CONFIG_CPU_26
DEFN("PAGE_PRESENT", _PAGE_PRESENT); DEFINE(PAGE_PRESENT, _PAGE_PRESENT);
DEFN("PAGE_READONLY", _PAGE_READONLY); DEFINE(PAGE_READONLY, _PAGE_READONLY);
DEFN("PAGE_NOT_USER", _PAGE_NOT_USER); DEFINE(PAGE_NOT_USER, _PAGE_NOT_USER);
DEFN("PAGE_OLD", _PAGE_OLD); DEFINE(PAGE_OLD, _PAGE_OLD);
DEFN("PAGE_CLEAN", _PAGE_CLEAN); DEFINE(PAGE_CLEAN, _PAGE_CLEAN);
#endif #endif
BLANK();
DEFN("PAGE_SZ", PAGE_SIZE); DEFINE(PAGE_SZ, PAGE_SIZE);
BLANK();
DEFN("SYS_ERROR0", 0x9f0000); DEFINE(SYS_ERROR0, 0x9f0000);
return 0;
} }
...@@ -4,40 +4,9 @@ ...@@ -4,40 +4,9 @@
# Copyright (C) 2001 Russell King # Copyright (C) 2001 Russell King
# #
all: $(TOPDIR)/include/asm-arm/mach-types.h \ all: $(TOPDIR)/include/asm-arm/mach-types.h
$(TOPDIR)/include/asm-arm/constants.h
$(TOPDIR)/include/asm-arm/mach-types.h: mach-types gen-mach-types $(TOPDIR)/include/asm-arm/mach-types.h: mach-types gen-mach-types
awk -f gen-mach-types mach-types > $@ awk -f gen-mach-types mach-types > $@
# Generate the constants.h header file using the compiler. We get .PHONY: all
# the compiler to spit out assembly code, and then mundge it into
# what we want. We do this in several stages so make picks up on
# any errors that occur along the way.
constants.h: constants-hdr getconstants.c
$(CC) $(CFLAGS) -S -o $@.tmp.1 getconstants.c
sed 's/^\(#define .* \)[#$$]\(.*\)/\1\2/;/^#define/!d' $@.tmp.1 > $@.tmp.2
cat constants-hdr $@.tmp.2 > $@
$(RM) $@.tmp*
# Only update include/asm-arm/constants.h when it has actually changed.
$(TOPDIR)/include/asm-arm/constants.h: constants.h
cmp constants.h $@ >/dev/null 2>&1 || cp -p constants.h $@
# Build our dependencies, and then generate the constants and
# mach-types header files. If we do it now, mkdep will pick
# the dependencies up later on when it runs through the other
# directories
dep:
$(TOPDIR)/scripts/mkdep $(CFLAGS) $(EXTRA_CFLAGS) -- getconstants.c |\
sed s,getconstants.o,constants.h, > .depend
$(MAKE) all
.PHONY: all dep
ifneq ($(wildcard .depend),)
include .depend
endif
/*
* This file is automatically generated from arch/arm/tools/getconstants.c.
* Do not edit! Only include this file in assembly (.S) files!
*/
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment