Skip to contentSkip to conversation

rebuilding object files from asm files

DISCUSSION Andi Kleen 2 participants 4 messages Feb 20, 2008 Kbuild

lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

Here's a small kbuild quirk I noticed on 2.6.25rc2. I tried to rebuild the obj file of a assembler file (.S) with make path/to/file.o.

Normally when I do this for .o file only its dependencies and and the object file are built as I expect.

But with an assembler file (like arch/x86/kernel/head_64.o) kbuild starts to rebuild everything.

-Andi

#1 lore raw

Hi Andi.

Quoted 9 lines · Andi Kleen

Here's a small kbuild quirk I noticed on 2.6.25rc2. I tried to rebuild the obj file of a assembler file (.S) with make path/to/file.o.

Normally when I do this for .o file only its dependencies and and the object file are built as I expect.

But with an assembler file (like arch/x86/kernel/head_64.o) kbuild starts to rebuild everything.

Took a look at this.
You will notice that there is a difference in the behaviour betweet arch/x86/kernel/entry_64.o and head_64.o from same dir. For entry_64.o it works as expected.

The 'problem' is that kbuild when deciding to use the rule:
%.o: %.S prepare scripts FORCE

        $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)

Already have done most of the work and mainly is has defined the dependencies for vmlinux.
As head_64.o is listed in $(head-y) kbuild do as told in following rule:

Note: vmlinux-init is equal to $(head-y) + $(init-y)

# The actual objects are generated when descending,

# make sure no implicit rule kicks in
$(sort $(vmlinux-init) $(vmlinux-main)) $(vmlinux-lds): $(vmlinux-dirs) ;

So building head_64.o requires a visit of all directories listed in vmlinux-dirs before it can build head_64.o.

I do not see any clean way to fix this :-(

Sam

author
#2 lore raw
Quoted 5 lines

So building head_64.o requires a visit of all directories listed in vmlinux-dirs before it can build head_64.o.

I do not see any clean way to fix this :-(

I see. Thanks for the investigation. If it only affects head_64.S I guess it is not so bad.

-Andi

#3 lore raw
Quoted 8 lines · Andi Kleen
Quoted 5 lines

So building head_64.o requires a visit of all directories listed in vmlinux-dirs before it can build head_64.o.

I do not see any clean way to fix this :-(

I see. Thanks for the investigation. If it only affects head_64.S I guess it is not so bad.

All of:
head-y := arch/x86/kernel/head_$(BITS).o
head-$(CONFIG_X86_64) += arch/x86/kernel/head64.o
head-y += arch/x86/kernel/init_task.o

But thats limited anyway.

Sam