Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

authored by

Nicholas Piggin and committed by
Masahiro Yamada
f49821ee 6358d6e8

+41 -41
+8 -8
Documentation/kbuild/makefiles.txt
··· 153 153 configuration. 154 154 155 155 Kbuild compiles all the $(obj-y) files. It then calls 156 - "$(AR) rcSTP" to merge these files into one built-in.o file. 156 + "$(AR) rcSTP" to merge these files into one built-in.a file. 157 157 This is a thin archive without a symbol table, which makes it 158 158 unsuitable as a linker input. 159 159 160 160 The scripts/link-vmlinux.sh script later makes an aggregate 161 - built-in.o with "${AR} rcsTP", which creates the thin archive 161 + built-in.a with "${AR} rcsTP", which creates the thin archive 162 162 with a symbol table and an index, making it a valid input for 163 163 the final vmlinux link passes. 164 164 165 165 The order of files in $(obj-y) is significant. Duplicates in 166 166 the lists are allowed: the first instance will be linked into 167 - built-in.o and succeeding instances will be ignored. 167 + built-in.a and succeeding instances will be ignored. 168 168 169 169 Link order is significant, because certain functions 170 170 (module_init() / __initcall) will be called during boot in the ··· 228 228 Note: Of course, when you are building objects into the kernel, 229 229 the syntax above will also work. So, if you have CONFIG_EXT2_FS=y, 230 230 kbuild will build an ext2.o file for you out of the individual 231 - parts and then link this into built-in.o, as you would expect. 231 + parts and then link this into built-in.a, as you would expect. 232 232 233 233 --- 3.4 Objects which export symbols 234 234 ··· 238 238 --- 3.5 Library file goals - lib-y 239 239 240 240 Objects listed with obj-* are used for modules, or 241 - combined in a built-in.o for that specific directory. 241 + combined in a built-in.a for that specific directory. 242 242 There is also the possibility to list objects that will 243 243 be included in a library, lib.a. 244 244 All objects listed with lib-y are combined in a single ··· 250 250 251 251 Note that the same kbuild makefile may list files to be built-in 252 252 and to be part of a library. Therefore the same directory 253 - may contain both a built-in.o and a lib.a file. 253 + may contain both a built-in.a and a lib.a file. 254 254 255 255 Example: 256 256 #arch/x86/lib/Makefile ··· 992 992 993 993 $(head-y) lists objects to be linked first in vmlinux. 994 994 $(libs-y) lists directories where a lib.a archive can be located. 995 - The rest list directories where a built-in.o object file can be 995 + The rest list directories where a built-in.a object file can be 996 996 located. 997 997 998 998 $(init-y) objects will be located after $(head-y). ··· 1077 1077 extra-y := head.o init_task.o 1078 1078 1079 1079 In this example, extra-y is used to list object files that 1080 - shall be built, but shall not be linked as part of built-in.o. 1080 + shall be built, but shall not be linked as part of built-in.a. 1081 1081 1082 1082 1083 1083 --- 6.7 Commands useful for building a boot image
+1 -1
Documentation/process/changes.rst
··· 78 78 -------- 79 79 80 80 The build system has, as of 4.13, switched to using thin archives (`ar T`) 81 - rather than incremental linking (`ld -r`) for built-in.o intermediate steps. 81 + rather than incremental linking (`ld -r`) for built-in.a intermediate steps. 82 82 This requires binutils 2.20 or newer. 83 83 84 84 Flex
+7 -7
Makefile
··· 35 35 # Most importantly: sub-Makefiles should only ever modify files in 36 36 # their own directory. If in some directory we have a dependency on 37 37 # a file in another dir (which doesn't happen often, but it's often 38 - # unavoidable when linking the built-in.o targets which finally 38 + # unavoidable when linking the built-in.a targets which finally 39 39 # turn into vmlinux), we will call a sub make in that other dir, and 40 40 # after that we are sure that everything which is in that other dir 41 41 # is now up to date. ··· 982 982 vmlinux-alldirs := $(sort $(vmlinux-dirs) $(patsubst %/,%,$(filter %/, \ 983 983 $(init-) $(core-) $(drivers-) $(net-) $(libs-) $(virt-)))) 984 984 985 - init-y := $(patsubst %/, %/built-in.o, $(init-y)) 986 - core-y := $(patsubst %/, %/built-in.o, $(core-y)) 987 - drivers-y := $(patsubst %/, %/built-in.o, $(drivers-y)) 988 - net-y := $(patsubst %/, %/built-in.o, $(net-y)) 985 + init-y := $(patsubst %/, %/built-in.a, $(init-y)) 986 + core-y := $(patsubst %/, %/built-in.a, $(core-y)) 987 + drivers-y := $(patsubst %/, %/built-in.a, $(drivers-y)) 988 + net-y := $(patsubst %/, %/built-in.a, $(net-y)) 989 989 libs-y1 := $(patsubst %/, %/lib.a, $(libs-y)) 990 - libs-y2 := $(filter-out %.a, $(patsubst %/, %/built-in.o, $(libs-y))) 991 - virt-y := $(patsubst %/, %/built-in.o, $(virt-y)) 990 + libs-y2 := $(patsubst %/, %/built-in.a, $(filter-out %.a, $(libs-y))) 991 + virt-y := $(patsubst %/, %/built-in.a, $(virt-y)) 992 992 993 993 # Externally visible symbols (used by link-vmlinux.sh) 994 994 export KBUILD_VMLINUX_INIT := $(head-y) $(init-y)
+1 -1
arch/blackfin/kernel/bfin_ksyms.c
··· 36 36 /* 37 37 * Because string functions are both inline and exported functions and 38 38 * folder arch/blackfin/lib is configured as a library path in Makefile, 39 - * symbols exported in folder lib is not linked into built-in.o but 39 + * symbols exported in folder lib is not linked into built-in.a but 40 40 * inlined only. In order to export string symbols to kernel module 41 41 * properly, they should be exported here. 42 42 */
+1 -1
arch/powerpc/kernel/Makefile
··· 165 165 $(call cmd,systbl_chk) 166 166 167 167 ifeq ($(CONFIG_PPC_OF_BOOT_TRAMPOLINE),y) 168 - $(obj)/built-in.o: prom_init_check 168 + $(obj)/built-in.a: prom_init_check 169 169 170 170 quiet_cmd_prom_init_check = CALL $< 171 171 cmd_prom_init_check = $(CONFIG_SHELL) $< "$(NM)" "$(obj)/prom_init.o"
+1 -1
drivers/s390/Makefile
··· 5 5 6 6 obj-y += cio/ block/ char/ crypto/ net/ scsi/ virtio/ 7 7 8 - drivers-y += drivers/s390/built-in.o 8 + drivers-y += drivers/s390/built-in.a 9 9
+2 -2
lib/Kconfig.debug
··· 324 324 the analysis would not catch the illegal reference. 325 325 This option tells gcc to inline less (but it does result in 326 326 a larger kernel). 327 - - Run the section mismatch analysis for each module/built-in.o file. 327 + - Run the section mismatch analysis for each module/built-in.a file. 328 328 When we run the section mismatch analysis on vmlinux.o, we 329 329 lose valuable information about where the mismatch was 330 330 introduced. 331 - Running the analysis for each module/built-in.o file 331 + Running the analysis for each module/built-in.a file 332 332 tells where the mismatch happens much closer to the 333 333 source. The drawback is that the same mismatch is 334 334 reported at least twice.
+5 -5
scripts/Makefile.build
··· 77 77 endif 78 78 79 79 ifneq ($(strip $(obj-y) $(need-builtin)),) 80 - builtin-target := $(obj)/built-in.o 80 + builtin-target := $(obj)/built-in.a 81 81 endif 82 82 83 83 modorder-target := $(obj)/modules.order ··· 104 104 cmd_checkdoc = $(srctree)/scripts/kernel-doc -none $< ; 105 105 endif 106 106 107 - # Do section mismatch analysis for each module/built-in.o 107 + # Do section mismatch analysis for each module/built-in.a 108 108 ifdef CONFIG_DEBUG_SECTION_MISMATCH 109 109 cmd_secanalysis = ; scripts/mod/modpost $@ 110 110 endif ··· 458 458 # 459 459 ifdef builtin-target 460 460 461 - # built-in.o archives are made with no symbol table or index which 461 + # built-in.a archives are made with no symbol table or index which 462 462 # makes them small and fast, but unable to be used by the linker. 463 - # scripts/link-vmlinux.sh builds an aggregate built-in.o with a symbol 463 + # scripts/link-vmlinux.sh builds an aggregate built-in.a with a symbol 464 464 # table and index. 465 465 cmd_make_builtin = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS) 466 466 cmd_make_empty_builtin = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS) 467 467 quiet_cmd_link_o_target = AR $@ 468 468 469 - # If the list of objects to link is empty, just create an empty built-in.o 469 + # If the list of objects to link is empty, just create an empty built-in.a 470 470 cmd_link_o_target = $(if $(strip $(obj-y)),\ 471 471 $(cmd_make_builtin) $@ $(filter $(obj-y), $^) \ 472 472 $(cmd_secanalysis),\
+3 -3
scripts/Makefile.lib
··· 27 27 28 28 # Handle objects in subdirs 29 29 # --------------------------------------------------------------------------- 30 - # o if we encounter foo/ in $(obj-y), replace it by foo/built-in.o 30 + # o if we encounter foo/ in $(obj-y), replace it by foo/built-in.a 31 31 # and add the directory to the list of dirs to descend into: $(subdir-y) 32 32 # o if we encounter foo/ in $(obj-m), remove it from $(obj-m) 33 33 # and add the directory to the list of dirs to descend into: $(subdir-m) ··· 35 35 subdir-y += $(__subdir-y) 36 36 __subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m))) 37 37 subdir-m += $(__subdir-m) 38 - obj-y := $(patsubst %/, %/built-in.o, $(obj-y)) 38 + obj-y := $(patsubst %/, %/built-in.a, $(obj-y)) 39 39 obj-m := $(filter-out %/, $(obj-m)) 40 40 41 41 # Subdirectories we need to descend into ··· 54 54 55 55 # $(subdir-obj-y) is the list of objects in $(obj-y) which uses dir/ to 56 56 # tell kbuild to descend 57 - subdir-obj-y := $(filter %/built-in.o, $(obj-y)) 57 + subdir-obj-y := $(filter %/built-in.a, $(obj-y)) 58 58 59 59 # Replace multi-part objects by their individual parts, look at local dir only 60 60 real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m)))
+1 -1
scripts/namespace.pl
··· 164 164 s:^\./::; 165 165 if (/.*\.o$/ && 166 166 ! ( 167 - m:/built-in.o$: 167 + m:/built-in.a$: 168 168 || m:arch/x86/vdso/: 169 169 || m:arch/x86/boot/: 170 170 || m:arch/ia64/ia32/ia32.o$:
+1 -1
usr/initramfs_data.S
··· 10 10 11 11 ld -m elf_i386 --format binary --oformat elf32-i386 -r \ 12 12 -T initramfs_data.scr initramfs_data.cpio.gz -o initramfs_data.o 13 - ld -m elf_i386 -r -o built-in.o initramfs_data.o 13 + ld -m elf_i386 -r -o built-in.a initramfs_data.o 14 14 15 15 For including the .init.ramfs sections, see include/asm-generic/vmlinux.lds. 16 16