Commit a91c4fb5 authored by Sam Ravnborg's avatar Sam Ravnborg

Merge mars.ravnborg.org:/home/sam/bk/kbuild-mm2

into mars.ravnborg.org:/home/sam/bk/kbuild
parents 744dbb74 948a4d33
...@@ -938,6 +938,37 @@ When kbuild executes the following steps are followed (roughly): ...@@ -938,6 +938,37 @@ When kbuild executes the following steps are followed (roughly):
will be displayed with "make KBUILD_VERBOSE=0". will be displayed with "make KBUILD_VERBOSE=0".
--- 6.8 Preprocessing linker scripts
When the vmlinux image is build the linker script:
arch/$(ARCH)/kernel/vmlinux.lds is used.
The script is a preprocessed variant of the file vmlinux.lds.S
located in the same directory.
kbuild knows .lds file and includes a rule *lds.S -> *lds.
Example:
#arch/i386/kernel/Makefile
always := vmlinux.lds
#Makefile
export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH)
The assigment to $(always) is used to tell kbuild to build the
target: vmlinux.lds.
The assignment to $(CPPFLAGS_vmlinux.lds) tell kbuild to use the
specified options when building the target vmlinux.lds.
When building the *.lds target kbuild used the variakles:
CPPFLAGS : Set in top-level Makefile
EXTRA_CPPFLAGS : May be set in the kbuild makefile
CPPFLAGS_$(@F) : Target specific flags.
Note that the full filename is used in this
assignment.
The kbuild infrastructure for *lds file are used in several
architecture specific files.
=== 7 Kbuild Variables === 7 Kbuild Variables
The top Makefile exports the following variables: The top Makefile exports the following variables:
......
...@@ -545,7 +545,7 @@ endef ...@@ -545,7 +545,7 @@ endef
quiet_cmd_sysmap = SYSMAP quiet_cmd_sysmap = SYSMAP
cmd_sysmap = $(CONFIG_SHELL) $(srctree)/scripts/mksysmap cmd_sysmap = $(CONFIG_SHELL) $(srctree)/scripts/mksysmap
LDFLAGS_vmlinux += -T arch/$(ARCH)/kernel/vmlinux.lds.s LDFLAGS_vmlinux += -T arch/$(ARCH)/kernel/vmlinux.lds
# Generate section listing all symbols and add it into vmlinux # Generate section listing all symbols and add it into vmlinux
# It's a three stage process: # It's a three stage process:
...@@ -591,13 +591,13 @@ cmd_kallsyms = $(NM) -n $< | $(KALLSYMS) $(foreach x,$(CONFIG_KALLSYMS_ALL),--al ...@@ -591,13 +591,13 @@ cmd_kallsyms = $(NM) -n $< | $(KALLSYMS) $(foreach x,$(CONFIG_KALLSYMS_ALL),--al
.tmp_kallsyms%.S: .tmp_vmlinux% $(KALLSYMS) .tmp_kallsyms%.S: .tmp_vmlinux% $(KALLSYMS)
$(call cmd,kallsyms) $(call cmd,kallsyms)
.tmp_vmlinux1: $(vmlinux-objs) arch/$(ARCH)/kernel/vmlinux.lds.s FORCE .tmp_vmlinux1: $(vmlinux-objs) arch/$(ARCH)/kernel/vmlinux.lds FORCE
$(call if_changed_rule,vmlinux__) $(call if_changed_rule,vmlinux__)
.tmp_vmlinux2: $(vmlinux-objs) .tmp_kallsyms1.o arch/$(ARCH)/kernel/vmlinux.lds.s FORCE .tmp_vmlinux2: $(vmlinux-objs) .tmp_kallsyms1.o arch/$(ARCH)/kernel/vmlinux.lds FORCE
$(call if_changed_rule,vmlinux__) $(call if_changed_rule,vmlinux__)
.tmp_vmlinux3: $(vmlinux-objs) .tmp_kallsyms2.o arch/$(ARCH)/kernel/vmlinux.lds.s FORCE .tmp_vmlinux3: $(vmlinux-objs) .tmp_kallsyms2.o arch/$(ARCH)/kernel/vmlinux.lds FORCE
$(call if_changed_rule,vmlinux__) $(call if_changed_rule,vmlinux__)
endif endif
...@@ -618,13 +618,13 @@ define rule_vmlinux ...@@ -618,13 +618,13 @@ define rule_vmlinux
$(rule_verify_kallsyms) $(rule_verify_kallsyms)
endef endef
vmlinux: $(vmlinux-objs) $(kallsyms.o) arch/$(ARCH)/kernel/vmlinux.lds.s FORCE vmlinux: $(vmlinux-objs) $(kallsyms.o) arch/$(ARCH)/kernel/vmlinux.lds FORCE
$(call if_changed_rule,vmlinux) $(call if_changed_rule,vmlinux)
# The actual objects are generated when descending, # The actual objects are generated when descending,
# make sure no implicit rule kicks in # make sure no implicit rule kicks in
$(sort $(vmlinux-objs)) arch/$(ARCH)/kernel/vmlinux.lds.s: $(vmlinux-dirs) ; $(sort $(vmlinux-objs)) arch/$(ARCH)/kernel/vmlinux.lds: $(vmlinux-dirs) ;
# Handle descending into subdirectories listed in $(vmlinux-dirs) # Handle descending into subdirectories listed in $(vmlinux-dirs)
# Preset locale variables to speed up the build process. Limit locale # Preset locale variables to speed up the build process. Limit locale
...@@ -682,7 +682,7 @@ prepare-all: prepare0 prepare ...@@ -682,7 +682,7 @@ prepare-all: prepare0 prepare
# Leave this as default for preprocessing vmlinux.lds.S, which is now # Leave this as default for preprocessing vmlinux.lds.S, which is now
# done in arch/$(ARCH)/kernel/Makefile # done in arch/$(ARCH)/kernel/Makefile
export AFLAGS_vmlinux.lds.o += -P -C -U$(ARCH) export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH)
# Single targets # Single targets
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Makefile for the linux kernel. # Makefile for the linux kernel.
# #
extra-y := head.o vmlinux.lds.s extra-y := head.o vmlinux.lds
EXTRA_AFLAGS := $(CFLAGS) EXTRA_AFLAGS := $(CFLAGS)
EXTRA_CFLAGS := -Werror -Wno-sign-compare EXTRA_CFLAGS := -Werror -Wno-sign-compare
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
LDFLAGS_vmlinux :=-p --no-undefined -X LDFLAGS_vmlinux :=-p --no-undefined -X
LDFLAGS_BLOB :=--format binary LDFLAGS_BLOB :=--format binary
AFLAGS_vmlinux.lds.o = -DTEXTADDR=$(TEXTADDR) -DDATAADDR=$(DATAADDR) CPPFLAGS_vmlinux.lds = -DTEXTADDR=$(TEXTADDR) -DDATAADDR=$(DATAADDR)
OBJCOPYFLAGS :=-O binary -R .note -R .comment -S OBJCOPYFLAGS :=-O binary -R .note -R .comment -S
GZFLAGS :=-9 GZFLAGS :=-9
#CFLAGS +=-pipe #CFLAGS +=-pipe
......
...@@ -26,7 +26,7 @@ endif ...@@ -26,7 +26,7 @@ endif
head-y := head.o head-y := head.o
obj-$(CONFIG_DEBUG_LL) += debug.o obj-$(CONFIG_DEBUG_LL) += debug.o
extra-y := $(head-y) init_task.o vmlinux.lds.s extra-y := $(head-y) init_task.o vmlinux.lds
# Spell out some dependencies that aren't automatically figured out # Spell out some dependencies that aren't automatically figured out
$(obj)/entry-armv.o: $(obj)/entry-header.S include/asm-arm/constants.h $(obj)/entry-armv.o: $(obj)/entry-header.S include/asm-arm/constants.h
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
LDFLAGS_vmlinux :=-p -X LDFLAGS_vmlinux :=-p -X
LDFLAGS_BLOB :=--format binary LDFLAGS_BLOB :=--format binary
AFLAGS_vmlinux.lds.o = -DTEXTADDR=$(TEXTADDR) -DDATAADDR=$(DATAADDR) CPPFLAGS_vmlinux.lds = -DTEXTADDR=$(TEXTADDR) -DDATAADDR=$(DATAADDR)
OBJCOPYFLAGS :=-O binary -R .note -R .comment -S OBJCOPYFLAGS :=-O binary -R .note -R .comment -S
GZFLAGS :=-9 GZFLAGS :=-9
......
...@@ -14,5 +14,5 @@ obj-y := compat.o dma.o entry.o irq.o \ ...@@ -14,5 +14,5 @@ obj-y := compat.o dma.o entry.o irq.o \
obj-$(CONFIG_FIQ) += fiq.o obj-$(CONFIG_FIQ) += fiq.o
obj-$(CONFIG_MODULES) += armksyms.o obj-$(CONFIG_MODULES) += armksyms.o
extra-y := init_task.o vmlinux.lds.s extra-y := init_task.o vmlinux.lds
...@@ -29,7 +29,7 @@ LDFLAGS_BLOB := --format binary --oformat elf32-cris \ ...@@ -29,7 +29,7 @@ LDFLAGS_BLOB := --format binary --oformat elf32-cris \
OBJCOPYFLAGS := -O binary -R .note -R .comment -S OBJCOPYFLAGS := -O binary -R .note -R .comment -S
AFLAGS_vmlinux.lds.o = -DDRAM_VIRTUAL_BASE=0x$(CONFIG_ETRAX_DRAM_VIRTUAL_BASE) CPPFLAGS_vmlinux.lds = -DDRAM_VIRTUAL_BASE=0x$(CONFIG_ETRAX_DRAM_VIRTUAL_BASE)
AFLAGS += -mlinux AFLAGS += -mlinux
CFLAGS := $(CFLAGS) -mlinux -march=$(arch-y) -pipe CFLAGS := $(CFLAGS) -mlinux -march=$(arch-y) -pipe
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# Makefile for the linux kernel. # Makefile for the linux kernel.
# #
extra-y := vmlinux.lds.s extra-y := vmlinux.lds
obj-y := process.o traps.o irq.o ptrace.o setup.o \ obj-y := process.o traps.o irq.o ptrace.o setup.o \
time.o sys_cris.o semaphore.o time.o sys_cris.o semaphore.o
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Makefile for the linux kernel. # Makefile for the linux kernel.
# #
extra-y := vmlinux.lds.s extra-y := vmlinux.lds
obj-y := process.o traps.o ptrace.o ints.o \ obj-y := process.o traps.o ptrace.o ints.o \
sys_h8300.o time.o semaphore.o signal.o \ sys_h8300.o time.o semaphore.o signal.o \
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Makefile for the linux kernel. # Makefile for the linux kernel.
# #
extra-y := head.o init_task.o vmlinux.lds.s extra-y := head.o init_task.o vmlinux.lds
obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o vm86.o \ obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o vm86.o \
ptrace.o i8259.o ioport.o ldt.o setup.o time.o sys_i386.o \ ptrace.o i8259.o ioport.o ldt.o setup.o time.o sys_i386.o \
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Makefile for the linux kernel. # Makefile for the linux kernel.
# #
extra-y := head.o init_task.o vmlinux.lds.s extra-y := head.o init_task.o vmlinux.lds
obj-y := acpi.o entry.o efi.o efi_stub.o gate-data.o fsys.o ia64_ksyms.o irq.o irq_ia64.o \ obj-y := acpi.o entry.o efi.o efi_stub.o gate-data.o fsys.o ia64_ksyms.o irq.o irq_ia64.o \
irq_lsapic.o ivt.o machvec.o pal.o patch.o process.o perfmon.o ptrace.o sal.o \ irq_lsapic.o ivt.o machvec.o pal.o patch.o process.o perfmon.o ptrace.o sal.o \
...@@ -21,25 +21,25 @@ obj-$(CONFIG_IA64_CYCLONE) += cyclone.o ...@@ -21,25 +21,25 @@ obj-$(CONFIG_IA64_CYCLONE) += cyclone.o
# The gate DSO image is built using a special linker script. # The gate DSO image is built using a special linker script.
targets += gate.so gate-syms.o targets += gate.so gate-syms.o
extra-y += gate.so gate-syms.o gate.lds.s gate.o extra-y := gate.so gate-syms.o gate.lds gate.o
# fp_emulate() expects f2-f5,f16-f31 to contain the user-level state. # fp_emulate() expects f2-f5,f16-f31 to contain the user-level state.
CFLAGS_traps.o += -mfixed-range=f2-f5,f16-f31 CFLAGS_traps.o += -mfixed-range=f2-f5,f16-f31
AFLAGS_gate.lds.o += -P -C -U$(ARCH) CPPFLAGS_gate.lds := -P -C -U$(ARCH)
quiet_cmd_gate = GATE $@ quiet_cmd_gate = GATE $@
cmd_gate = $(CC) -nostdlib $(GATECFLAGS_$(@F)) -Wl,-T,$(filter-out FORCE,$^) -o $@ cmd_gate = $(CC) -nostdlib $(GATECFLAGS_$(@F)) -Wl,-T,$(filter-out FORCE,$^) -o $@
GATECFLAGS_gate.so = -shared -s -Wl,-soname=linux-gate.so.1 GATECFLAGS_gate.so = -shared -s -Wl,-soname=linux-gate.so.1
$(obj)/gate.so: $(obj)/gate.lds.s $(obj)/gate.o FORCE $(obj)/gate.so: $(obj)/gate.lds $(obj)/gate.o FORCE
$(call if_changed,gate) $(call if_changed,gate)
$(obj)/built-in.o: $(obj)/gate-syms.o $(obj)/built-in.o: $(obj)/gate-syms.o
$(obj)/built-in.o: ld_flags += -R $(obj)/gate-syms.o $(obj)/built-in.o: ld_flags += -R $(obj)/gate-syms.o
GATECFLAGS_gate-syms.o = -r GATECFLAGS_gate-syms.o = -r
$(obj)/gate-syms.o: $(src)/gate.lds.s $(obj)/gate.o FORCE $(obj)/gate-syms.o: $(obj)/gate.lds $(obj)/gate.o FORCE
$(call if_changed,gate) $(call if_changed,gate)
# gate-data.o contains the gate DSO image as data in section .data.gate. # gate-data.o contains the gate DSO image as data in section .data.gate.
......
...@@ -7,7 +7,7 @@ ifndef CONFIG_SUN3 ...@@ -7,7 +7,7 @@ ifndef CONFIG_SUN3
else else
extra-y := sun3-head.o extra-y := sun3-head.o
endif endif
extra-y += vmlinux.lds.s extra-y += vmlinux.lds
obj-y := entry.o process.o traps.o ints.o signal.o ptrace.o \ obj-y := entry.o process.o traps.o ints.o signal.o ptrace.o \
sys_m68k.o time.o semaphore.o setup.o m68k_ksyms.o sys_m68k.o time.o semaphore.o setup.o m68k_ksyms.o
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Makefile for arch/m68knommu/kernel. # Makefile for arch/m68knommu/kernel.
# #
extra-y := vmlinux.lds.s extra-y := vmlinux.lds
obj-y += dma.o entry.o init_task.o m68k_ksyms.o process.o ptrace.o semaphore.o \ obj-y += dma.o entry.o init_task.o m68k_ksyms.o process.o ptrace.o semaphore.o \
setup.o signal.o syscalltable.o sys_m68k.o time.o traps.o setup.o signal.o syscalltable.o sys_m68k.o time.o traps.o
......
...@@ -643,7 +643,7 @@ endif ...@@ -643,7 +643,7 @@ endif
# none has been choosen above. # none has been choosen above.
# #
AFLAGS_vmlinux.lds.o := \ CPPFLAGS_vmlinux.lds := \
-D"LOADADDR=$(load-y)" \ -D"LOADADDR=$(load-y)" \
-D"JIFFIES=$(JIFFIES)" \ -D"JIFFIES=$(JIFFIES)" \
-imacros $(srctree)/include/asm-$(ARCH)/sn/mapped_kernel.h -imacros $(srctree)/include/asm-$(ARCH)/sn/mapped_kernel.h
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Makefile for the Linux/MIPS kernel. # Makefile for the Linux/MIPS kernel.
# #
extra-y := head.o init_task.o vmlinux.lds.s extra-y := head.o init_task.o vmlinux.lds
obj-y += cpu-probe.o branch.o entry.o genex.o irq.o process.o \ obj-y += cpu-probe.o branch.o entry.o genex.o irq.o process.o \
ptrace.o reset.o semaphore.o setup.o signal.o syscall.o \ ptrace.o reset.o semaphore.o setup.o signal.o syscall.o \
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
head-y := head.o head-y := head.o
head-$(CONFIG_PARISC64) := head64.o head-$(CONFIG_PARISC64) := head64.o
extra-y := init_task.o $(head-y) vmlinux.lds.s extra-y := init_task.o $(head-y) vmlinux.lds
AFLAGS_entry.o := -traditional AFLAGS_entry.o := -traditional
AFLAGS_pacache.o := -traditional AFLAGS_pacache.o := -traditional
......
...@@ -70,7 +70,7 @@ BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd vmlinux.sm ...@@ -70,7 +70,7 @@ BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd vmlinux.sm
all: zImage all: zImage
AFLAGS_vmlinux.lds.o := -Upowerpc CPPFLAGS_vmlinux.lds := -Upowerpc
# All the instructions talk about "make bzImage". # All the instructions talk about "make bzImage".
bzImage: zImage bzImage: zImage
......
...@@ -9,7 +9,7 @@ extra-$(CONFIG_E500) := head_e500.o ...@@ -9,7 +9,7 @@ extra-$(CONFIG_E500) := head_e500.o
extra-$(CONFIG_8xx) := head_8xx.o extra-$(CONFIG_8xx) := head_8xx.o
extra-$(CONFIG_6xx) += idle_6xx.o extra-$(CONFIG_6xx) += idle_6xx.o
extra-$(CONFIG_POWER4) += idle_power4.o extra-$(CONFIG_POWER4) += idle_power4.o
extra-y += vmlinux.lds.s extra-y += vmlinux.lds
obj-y := entry.o traps.o irq.o idle.o time.o misc.o \ obj-y := entry.o traps.o irq.o idle.o time.o misc.o \
process.o signal.o ptrace.o align.o \ process.o signal.o ptrace.o align.o \
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# #
EXTRA_CFLAGS += -mno-minimal-toc EXTRA_CFLAGS += -mno-minimal-toc
extra-y := head.o vmlinux.lds.s extra-y := head.o vmlinux.lds
obj-y := setup.o entry.o traps.o irq.o idle.o dma.o \ obj-y := setup.o entry.o traps.o irq.o idle.o dma.o \
time.o process.o signal.o syscalls.o misc.o ptrace.o \ time.o process.o signal.o syscalls.o misc.o ptrace.o \
......
...@@ -10,7 +10,7 @@ obj-y := bitmap.o traps.o time.o process.o \ ...@@ -10,7 +10,7 @@ obj-y := bitmap.o traps.o time.o process.o \
extra-$(CONFIG_ARCH_S390_31) += head.o extra-$(CONFIG_ARCH_S390_31) += head.o
extra-$(CONFIG_ARCH_S390X) += head64.o extra-$(CONFIG_ARCH_S390X) += head64.o
extra-y += init_task.o vmlinux.lds.s extra-y += init_task.o vmlinux.lds
obj-$(CONFIG_MODULES) += s390_ksyms.o module.o obj-$(CONFIG_MODULES) += s390_ksyms.o module.o
obj-$(CONFIG_SMP) += smp.o obj-$(CONFIG_SMP) += smp.o
......
...@@ -122,7 +122,7 @@ drivers-$(CONFIG_OPROFILE) += arch/sh/oprofile/ ...@@ -122,7 +122,7 @@ drivers-$(CONFIG_OPROFILE) += arch/sh/oprofile/
boot := arch/sh/boot boot := arch/sh/boot
AFLAGS_vmlinux.lds.o := -traditional CPPFLAGS_vmlinux.lds := -traditional
prepare: target_links prepare: target_links
......
...@@ -22,7 +22,7 @@ CONFIG_MEMORY_START ?= 0x0c000000 ...@@ -22,7 +22,7 @@ CONFIG_MEMORY_START ?= 0x0c000000
CONFIG_BOOT_LINK_OFFSET ?= 0x00800000 CONFIG_BOOT_LINK_OFFSET ?= 0x00800000
IMAGE_OFFSET := $(shell printf "0x%8x" $$[0x80000000+$(CONFIG_MEMORY_START)+$(CONFIG_BOOT_LINK_OFFSET)]) IMAGE_OFFSET := $(shell printf "0x%8x" $$[0x80000000+$(CONFIG_MEMORY_START)+$(CONFIG_BOOT_LINK_OFFSET)])
LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -e startup -T $(obj)/../../kernel/vmlinux.lds.s LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -e startup -T $(obj)/../../kernel/vmlinux.lds
$(obj)/vmlinux: $(OBJECTS) $(obj)/piggy.o FORCE $(obj)/vmlinux: $(OBJECTS) $(obj)/piggy.o FORCE
$(call if_changed,ld) $(call if_changed,ld)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Makefile for the Linux/SuperH kernel. # Makefile for the Linux/SuperH kernel.
# #
extra-y := head.o init_task.o vmlinux.lds.s extra-y := head.o init_task.o vmlinux.lds
obj-y := process.o signal.o entry.o traps.o irq.o \ obj-y := process.o signal.o entry.o traps.o irq.o \
ptrace.o setup.o time.o sys_sh.o semaphore.o \ ptrace.o setup.o time.o sys_sh.o semaphore.o \
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
# #
targets := vmlinux vmlinux.bin vmlinux.bin.gz \ targets := vmlinux vmlinux.bin vmlinux.bin.gz \
head.o misc.o cache.o piggy.o vmlinux.lds.o head.o misc.o cache.o piggy.o vmlinux.lds
EXTRA_AFLAGS := -traditional EXTRA_AFLAGS := -traditional
...@@ -25,7 +25,7 @@ OBJECTS := $(obj)/head.o $(obj)/misc.o $(obj)/cache.o ...@@ -25,7 +25,7 @@ OBJECTS := $(obj)/head.o $(obj)/misc.o $(obj)/cache.o
ZIMAGE_OFFSET = $(shell printf "0x%8x" $$[$(CONFIG_MEMORY_START)+0x400000+0x10000]) ZIMAGE_OFFSET = $(shell printf "0x%8x" $$[$(CONFIG_MEMORY_START)+0x400000+0x10000])
LDFLAGS_vmlinux := -Ttext $(ZIMAGE_OFFSET) -e startup \ LDFLAGS_vmlinux := -Ttext $(ZIMAGE_OFFSET) -e startup \
-T $(obj)/../../kernel/vmlinux.lds.s \ -T $(obj)/../../kernel/vmlinux.lds \
--no-warn-mismatch --no-warn-mismatch
$(obj)/vmlinux: $(OBJECTS) $(obj)/piggy.o FORCE $(obj)/vmlinux: $(OBJECTS) $(obj)/piggy.o FORCE
...@@ -41,6 +41,6 @@ $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE ...@@ -41,6 +41,6 @@ $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
LDFLAGS_piggy.o := -r --format binary --oformat elf32-sh64-linux -T LDFLAGS_piggy.o := -r --format binary --oformat elf32-sh64-linux -T
OBJCOPYFLAGS += -R .empty_zero_page OBJCOPYFLAGS += -R .empty_zero_page
$(obj)/piggy.o: $(obj)/vmlinux.lds.s $(obj)/vmlinux.bin.gz FORCE $(obj)/piggy.o: $(obj)/vmlinux.lds $(obj)/vmlinux.bin.gz FORCE
$(call if_changed,ld) $(call if_changed,ld)
...@@ -37,7 +37,7 @@ endef ...@@ -37,7 +37,7 @@ endef
BTOBJS := $(HEAD_Y) $(INIT_Y) BTOBJS := $(HEAD_Y) $(INIT_Y)
BTLIBS := $(CORE_Y) $(LIBS_Y) $(DRIVERS_Y) $(NET_Y) BTLIBS := $(CORE_Y) $(LIBS_Y) $(DRIVERS_Y) $(NET_Y)
LDFLAGS_image := -T arch/sparc/kernel/vmlinux.lds.s $(BTOBJS) \ LDFLAGS_image := -T arch/sparc/kernel/vmlinux.lds $(BTOBJS) \
--start-group $(BTLIBS) --end-group \ --start-group $(BTLIBS) --end-group \
$(kallsyms.o) $(obj)/btfix.o $(kallsyms.o) $(obj)/btfix.o
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Makefile for the linux kernel. # Makefile for the linux kernel.
# #
extra-y := head.o init_task.o vmlinux.lds.s extra-y := head.o init_task.o vmlinux.lds
EXTRA_AFLAGS := -ansi EXTRA_AFLAGS := -ansi
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
CHECK := $(CHECK) -D__sparc__=1 -D__sparc_v9__=1 CHECK := $(CHECK) -D__sparc__=1 -D__sparc_v9__=1
AFLAGS_vmlinux.lds.o += -Usparc CPPFLAGS_vmlinux.lds += -Usparc
CC := $(shell if $(CC) -m64 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo $(CC); else echo sparc64-linux-gcc; fi ) CC := $(shell if $(CC) -m64 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo $(CC); else echo sparc64-linux-gcc; fi )
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
EXTRA_AFLAGS := -ansi EXTRA_AFLAGS := -ansi
EXTRA_CFLAGS := -Werror EXTRA_CFLAGS := -Werror
extra-y := head.o init_task.o vmlinux.lds.s extra-y := head.o init_task.o vmlinux.lds
obj-y := process.o setup.o cpu.o idprom.o \ obj-y := process.o setup.o cpu.o idprom.o \
traps.o devices.o auxio.o \ traps.o devices.o auxio.o \
......
...@@ -77,7 +77,7 @@ vmlinux: $(ARCH_DIR)/main.o ...@@ -77,7 +77,7 @@ vmlinux: $(ARCH_DIR)/main.o
# CONFIG_MODE_SKAS + CONFIG_STATIC_LINK case. # CONFIG_MODE_SKAS + CONFIG_STATIC_LINK case.
LINK_TT = -static LINK_TT = -static
LD_SCRIPT_TT := uml.lds.s LD_SCRIPT_TT := uml.lds
ifeq ($(CONFIG_STATIC_LINK),y) ifeq ($(CONFIG_STATIC_LINK),y)
LINK-y += $(LINK_TT) LINK-y += $(LINK_TT)
...@@ -98,12 +98,12 @@ CPP_MODE_TT := $(shell [ "$(CONFIG_MODE_TT)" = "y" ] && echo -DMODE_TT) ...@@ -98,12 +98,12 @@ CPP_MODE_TT := $(shell [ "$(CONFIG_MODE_TT)" = "y" ] && echo -DMODE_TT)
CONFIG_KERNEL_STACK_ORDER ?= 2 CONFIG_KERNEL_STACK_ORDER ?= 2
STACK_SIZE := $(shell echo $$[ 4096 * (1 << $(CONFIG_KERNEL_STACK_ORDER)) ] ) STACK_SIZE := $(shell echo $$[ 4096 * (1 << $(CONFIG_KERNEL_STACK_ORDER)) ] )
AFLAGS_vmlinux.lds.o = -U$(SUBARCH) \ CPPFLAGS_vmlinux.lds = -U$(SUBARCH) \
-DSTART=$$(($(TOP_ADDR) - $(SIZE))) -DELF_ARCH=$(ELF_ARCH) \ -DSTART=$$(($(TOP_ADDR) - $(SIZE))) -DELF_ARCH=$(ELF_ARCH) \
-DELF_FORMAT=\"$(ELF_FORMAT)\" $(CPP_MODE_TT) \ -DELF_FORMAT=\"$(ELF_FORMAT)\" $(CPP_MODE_TT) \
-DKERNEL_STACK_SIZE=$(STACK_SIZE) -DKERNEL_STACK_SIZE=$(STACK_SIZE)
AFLAGS_$(LD_SCRIPT-y:.s=).o = $(AFLAGS_vmlinux.lds.o) -P -C -Uum CPPFLAGS_$(LD_SCRIPT-y) = $(CPPFLAGS_vmlinux.lds) -P -C -Uum
LD_SCRIPT-y := $(ARCH_DIR)/$(LD_SCRIPT-y) LD_SCRIPT-y := $(ARCH_DIR)/$(LD_SCRIPT-y)
...@@ -122,7 +122,7 @@ USER_CFLAGS := $(patsubst -D__KERNEL__,,$(USER_CFLAGS)) $(ARCH_INCLUDE) \ ...@@ -122,7 +122,7 @@ USER_CFLAGS := $(patsubst -D__KERNEL__,,$(USER_CFLAGS)) $(ARCH_INCLUDE) \
# To get a definition of F_SETSIG # To get a definition of F_SETSIG
USER_CFLAGS += -D_GNU_SOURCE USER_CFLAGS += -D_GNU_SOURCE
CLEAN_FILES += linux x.i gmon.out $(ARCH_DIR)/uml.lds.s \ CLEAN_FILES += linux x.i gmon.out $(ARCH_DIR)/uml.lds \
$(ARCH_DIR)/dyn_link.ld.s $(GEN_HEADERS) $(ARCH_DIR)/dyn_link.ld.s $(GEN_HEADERS)
$(ARCH_DIR)/main.o: $(ARCH_DIR)/main.c $(ARCH_DIR)/main.o: $(ARCH_DIR)/main.c
......
...@@ -12,7 +12,7 @@ LINK-$(CONFIG_GPROF) += $(PROFILE) ...@@ -12,7 +12,7 @@ LINK-$(CONFIG_GPROF) += $(PROFILE)
MODE_INCLUDE += -I$(TOPDIR)/$(ARCH_DIR)/kernel/skas/include MODE_INCLUDE += -I$(TOPDIR)/$(ARCH_DIR)/kernel/skas/include
LINK_SKAS = -Wl,-rpath,/lib LINK_SKAS = -Wl,-rpath,/lib
LD_SCRIPT_SKAS = dyn.lds.s LD_SCRIPT_SKAS = dyn.lds
GEN_HEADERS += $(ARCH_DIR)/kernel/skas/include/skas_ptregs.h GEN_HEADERS += $(ARCH_DIR)/kernel/skas/include/skas_ptregs.h
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# Licensed under the GPL # Licensed under the GPL
# #
extra-y := vmlinux.lds.s extra-y := vmlinux.lds
obj-y = checksum.o config.o exec_kern.o exitcode.o frame_kern.o frame.o \ obj-y = checksum.o config.o exec_kern.o exitcode.o frame_kern.o frame.o \
helper.o init_task.o irq.o irq_user.o ksyms.o mem.o mem_user.o \ helper.o init_task.o irq.o irq_user.o ksyms.o mem.o mem_user.o \
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
# for more details. # for more details.
# #
extra-y := head.o init_task.o vmlinux.lds.s extra-y := head.o init_task.o vmlinux.lds
obj-y += intv.o entry.o process.o syscalls.o time.o semaphore.o setup.o \ obj-y += intv.o entry.o process.o syscalls.o time.o semaphore.o setup.o \
signal.o irq.o mach.o ptrace.o bug.o signal.o irq.o mach.o ptrace.o bug.o
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Makefile for the linux kernel. # Makefile for the linux kernel.
# #
extra-y := head.o head64.o init_task.o vmlinux.lds.s extra-y := head.o head64.o init_task.o vmlinux.lds
EXTRA_AFLAGS := -traditional EXTRA_AFLAGS := -traditional
obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o \ obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o \
ptrace.o i8259.o ioport.o ldt.o setup.o time.o sys_x86_64.o \ ptrace.o i8259.o ioport.o ldt.o setup.o time.o sys_x86_64.o \
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Makefile for the linux kernel. # Makefile for the linux kernel.
# #
extra-y := head.o head64.o init_task.o vmlinux.lds.s extra-y := head.o head64.o init_task.o vmlinux.lds
EXTRA_AFLAGS := -traditional EXTRA_AFLAGS := -traditional
obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o \ obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o \
ptrace.o i8259.o ioport.o ldt.o setup.o time.o sys_x86_64.o \ ptrace.o i8259.o ioport.o ldt.o setup.o time.o sys_x86_64.o \
......
...@@ -219,6 +219,14 @@ cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $< ...@@ -219,6 +219,14 @@ cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $<
targets += $(real-objs-y) $(real-objs-m) $(lib-y) targets += $(real-objs-y) $(real-objs-m) $(lib-y)
targets += $(extra-y) $(MAKECMDGOALS) $(always) targets += $(extra-y) $(MAKECMDGOALS) $(always)
# Linker scripts preprocessor (.lds.S -> .lds)
# ---------------------------------------------------------------------------
quiet_cmd_cpp_lds_S = LDS $@
cmd_cpp_lds_S = $(CPP) $(cpp_flags) -D__ASSEMBLY__ -o $@ $<
%.lds: %.lds.S FORCE
$(call if_changed_dep,cpp_lds_S)
# Build the compiled-in targets # Build the compiled-in targets
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
......
...@@ -100,6 +100,7 @@ modname_flags = $(if $(filter 1,$(words $(modname))),-DKBUILD_MODNAME=$(subst $ ...@@ -100,6 +100,7 @@ modname_flags = $(if $(filter 1,$(words $(modname))),-DKBUILD_MODNAME=$(subst $
_c_flags = $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) _c_flags = $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o)
_a_flags = $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o) _a_flags = $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o)
_cpp_flags = $(CPPFLAGS) $(EXTRA_CPPFLAGS) $(CPPFLAGS_$(@F))
# If building the kernel in a separate objtree expand all occurrences # If building the kernel in a separate objtree expand all occurrences
# of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/'). # of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/').
...@@ -107,6 +108,7 @@ _a_flags = $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o) ...@@ -107,6 +108,7 @@ _a_flags = $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o)
ifeq ($(KBUILD_SRC),) ifeq ($(KBUILD_SRC),)
__c_flags = $(_c_flags) __c_flags = $(_c_flags)
__a_flags = $(_a_flags) __a_flags = $(_a_flags)
__cpp_flags = $(_cpp_flags)
else else
# Prefix -I with $(srctree) if it is not an absolute path # Prefix -I with $(srctree) if it is not an absolute path
...@@ -120,6 +122,7 @@ flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o))) ...@@ -120,6 +122,7 @@ flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o)))
# FIXME: Replace both with specific CFLAGS* statements in the makefiles # FIXME: Replace both with specific CFLAGS* statements in the makefiles
__c_flags = $(call addtree,-I$(obj)) $(call flags,_c_flags) __c_flags = $(call addtree,-I$(obj)) $(call flags,_c_flags)
__a_flags = $(call flags,_a_flags) __a_flags = $(call flags,_a_flags)
__cpp_flags = $(call flags,_cpp_flags)
endif endif
c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \ c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \
...@@ -129,6 +132,8 @@ c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \ ...@@ -129,6 +132,8 @@ c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \
a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \ a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \
$(__a_flags) $(modkern_aflags) $(__a_flags) $(modkern_aflags)
cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(__cpp_flags)
ld_flags = $(LDFLAGS) $(EXTRA_LDFLAGS) ld_flags = $(LDFLAGS) $(EXTRA_LDFLAGS)
# Finds the multi-part object the current object will be linked into # Finds the multi-part object the current object will be linked into
......
...@@ -51,6 +51,7 @@ _modpost: $(modules) ...@@ -51,6 +51,7 @@ _modpost: $(modules)
# Includes step 3,4 # Includes step 3,4
quiet_cmd_modpost = MODPOST quiet_cmd_modpost = MODPOST
cmd_modpost = scripts/mod/modpost \ cmd_modpost = scripts/mod/modpost \
$(if $(CONFIG_MODVERSIONS),-m) \
$(if $(KBUILD_EXTMOD),-i,-o) $(symverfile) \ $(if $(KBUILD_EXTMOD),-i,-o) $(symverfile) \
$(filter-out FORCE,$^) $(filter-out FORCE,$^)
......
...@@ -343,7 +343,6 @@ handle_modversions(struct module *mod, struct elf_info *info, ...@@ -343,7 +343,6 @@ handle_modversions(struct module *mod, struct elf_info *info,
crc = (unsigned int) sym->st_value; crc = (unsigned int) sym->st_value;
add_exported_symbol(symname + strlen(CRC_PFX), add_exported_symbol(symname + strlen(CRC_PFX),
mod, &crc); mod, &crc);
modversions = 1;
} }
break; break;
case SHN_UNDEF: case SHN_UNDEF:
...@@ -649,7 +648,6 @@ read_dump(const char *fname) ...@@ -649,7 +648,6 @@ read_dump(const char *fname)
if (!(mod = find_module(modname))) { if (!(mod = find_module(modname))) {
if (is_vmlinux(modname)) { if (is_vmlinux(modname)) {
modversions = 1;
have_vmlinux = 1; have_vmlinux = 1;
} }
mod = new_module(NOFAIL(strdup(modname))); mod = new_module(NOFAIL(strdup(modname)));
...@@ -696,11 +694,14 @@ main(int argc, char **argv) ...@@ -696,11 +694,14 @@ main(int argc, char **argv)
char *dump_read = NULL, *dump_write = NULL; char *dump_read = NULL, *dump_write = NULL;
int opt; int opt;
while ((opt = getopt(argc, argv, "i:o:")) != -1) { while ((opt = getopt(argc, argv, "i:mo:")) != -1) {
switch(opt) { switch(opt) {
case 'i': case 'i':
dump_read = optarg; dump_read = optarg;
break; break;
case 'm':
modversions = 1;
break;
case 'o': case 'o':
dump_write = optarg; dump_write = optarg;
break; break;
......
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