Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f49821ee authored by Nicholas Piggin's avatar Nicholas Piggin Committed by Masahiro Yamada
Browse files

kbuild: rename built-in.o to built-in.a



Incremental linking is gone, so rename built-in.o to built-in.a, which
is the usual extension for archive files.

This patch does two things, first is a simple search/replace:

git grep -l 'built-in\.o' | xargs sed -i 's/built-in\.o/built-in\.a/g'

The second is to invert nesting of nested text manipulations to avoid
filtering built-in.a out from libs-y2:

-libs-y2 := $(filter-out %.a, $(patsubst %/, %/built-in.a, $(libs-y)))
+libs-y2 := $(patsubst %/, %/built-in.a, $(filter-out %.a, $(libs-y)))

Signed-off-by: default avatarNicholas Piggin <npiggin@gmail.com>
Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
parent 6358d6e8
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -153,18 +153,18 @@ more details, with real examples.
	configuration.

	Kbuild compiles all the $(obj-y) files.  It then calls
	"$(AR) rcSTP" to merge these files into one built-in.o file.
	"$(AR) rcSTP" to merge these files into one built-in.a file.
	This is a thin archive without a symbol table, which makes it
	unsuitable as a linker input.

	The scripts/link-vmlinux.sh script later makes an aggregate
	built-in.o with "${AR} rcsTP", which creates the thin archive
	built-in.a with "${AR} rcsTP", which creates the thin archive
	with a symbol table and an index, making it a valid input for
	the final vmlinux link passes.

	The order of files in $(obj-y) is significant.  Duplicates in
	the lists are allowed: the first instance will be linked into
	built-in.o and succeeding instances will be ignored.
	built-in.a and succeeding instances will be ignored.

	Link order is significant, because certain functions
	(module_init() / __initcall) will be called during boot in the
@@ -228,7 +228,7 @@ more details, with real examples.
	Note: Of course, when you are building objects into the kernel,
	the syntax above will also work. So, if you have CONFIG_EXT2_FS=y,
	kbuild will build an ext2.o file for you out of the individual
	parts and then link this into built-in.o, as you would expect.
	parts and then link this into built-in.a, as you would expect.

--- 3.4 Objects which export symbols

@@ -238,7 +238,7 @@ more details, with real examples.
--- 3.5 Library file goals - lib-y

	Objects listed with obj-* are used for modules, or
	combined in a built-in.o for that specific directory.
	combined in a built-in.a for that specific directory.
	There is also the possibility to list objects that will
	be included in a library, lib.a.
	All objects listed with lib-y are combined in a single
@@ -250,7 +250,7 @@ more details, with real examples.

	Note that the same kbuild makefile may list files to be built-in
	and to be part of a library. Therefore the same directory
	may contain both a built-in.o and a lib.a file.
	may contain both a built-in.a and a lib.a file.

	Example:
		#arch/x86/lib/Makefile
@@ -992,7 +992,7 @@ When kbuild executes, the following steps are followed (roughly):

	$(head-y) lists objects to be linked first in vmlinux.
	$(libs-y) lists directories where a lib.a archive can be located.
	The rest list directories where a built-in.o object file can be
	The rest list directories where a built-in.a object file can be
	located.

	$(init-y) objects will be located after $(head-y).
@@ -1077,7 +1077,7 @@ When kbuild executes, the following steps are followed (roughly):
		extra-y := head.o init_task.o

	In this example, extra-y is used to list object files that
	shall be built, but shall not be linked as part of built-in.o.
	shall be built, but shall not be linked as part of built-in.a.


--- 6.7 Commands useful for building a boot image
+1 −1
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ Binutils
--------

The build system has, as of 4.13, switched to using thin archives (`ar T`)
rather than incremental linking (`ld -r`) for built-in.o intermediate steps.
rather than incremental linking (`ld -r`) for built-in.a intermediate steps.
This requires binutils 2.20 or newer.

Flex
+7 −7
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ unexport GREP_OPTIONS
# Most importantly: sub-Makefiles should only ever modify files in
# their own directory. If in some directory we have a dependency on
# a file in another dir (which doesn't happen often, but it's often
# unavoidable when linking the built-in.o targets which finally
# unavoidable when linking the built-in.a targets which finally
# turn into vmlinux), we will call a sub make in that other dir, and
# after that we are sure that everything which is in that other dir
# is now up to date.
@@ -982,13 +982,13 @@ vmlinux-dirs := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \
vmlinux-alldirs	:= $(sort $(vmlinux-dirs) $(patsubst %/,%,$(filter %/, \
		     $(init-) $(core-) $(drivers-) $(net-) $(libs-) $(virt-))))

init-y		:= $(patsubst %/, %/built-in.o, $(init-y))
core-y		:= $(patsubst %/, %/built-in.o, $(core-y))
drivers-y	:= $(patsubst %/, %/built-in.o, $(drivers-y))
net-y		:= $(patsubst %/, %/built-in.o, $(net-y))
init-y		:= $(patsubst %/, %/built-in.a, $(init-y))
core-y		:= $(patsubst %/, %/built-in.a, $(core-y))
drivers-y	:= $(patsubst %/, %/built-in.a, $(drivers-y))
net-y		:= $(patsubst %/, %/built-in.a, $(net-y))
libs-y1		:= $(patsubst %/, %/lib.a, $(libs-y))
libs-y2		:= $(filter-out %.a, $(patsubst %/, %/built-in.o, $(libs-y)))
virt-y		:= $(patsubst %/, %/built-in.o, $(virt-y))
libs-y2		:= $(patsubst %/, %/built-in.a, $(filter-out %.a, $(libs-y)))
virt-y		:= $(patsubst %/, %/built-in.a, $(virt-y))

# Externally visible symbols (used by link-vmlinux.sh)
export KBUILD_VMLINUX_INIT := $(head-y) $(init-y)
+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ EXPORT_SYMBOL(memchr);
/*
 * Because string functions are both inline and exported functions and
 * folder arch/blackfin/lib is configured as a library path in Makefile,
 * symbols exported in folder lib  is not linked into built-in.o but
 * symbols exported in folder lib  is not linked into built-in.a but
 * inlined only. In order to export string symbols to kernel module
 * properly, they should be exported here.
 */
+1 −1
Original line number Diff line number Diff line
@@ -165,7 +165,7 @@ systbl_chk: $(src)/systbl_chk.sh $(obj)/systbl_chk.i
	$(call cmd,systbl_chk)

ifeq ($(CONFIG_PPC_OF_BOOT_TRAMPOLINE),y)
$(obj)/built-in.o:		prom_init_check
$(obj)/built-in.a:		prom_init_check

quiet_cmd_prom_init_check = CALL    $<
      cmd_prom_init_check = $(CONFIG_SHELL) $< "$(NM)" "$(obj)/prom_init.o"
Loading