diff options
| -rw-r--r-- | scripts/Makefile.build | 54 |
1 files changed, 17 insertions, 37 deletions
diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 91b63ba926fc..cdb25d163b42 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build | |||
| @@ -154,35 +154,30 @@ $(obj)/%.ll: $(src)/%.c FORCE | |||
| 154 | # (See cmd_cc_o_c + relevant part of rule_cc_o_c) | 154 | # (See cmd_cc_o_c + relevant part of rule_cc_o_c) |
| 155 | 155 | ||
| 156 | quiet_cmd_cc_o_c = CC $(quiet_modtag) $@ | 156 | quiet_cmd_cc_o_c = CC $(quiet_modtag) $@ |
| 157 | cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< | ||
| 157 | 158 | ||
| 158 | ifndef CONFIG_MODVERSIONS | 159 | ifdef CONFIG_MODVERSIONS |
| 159 | cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< | ||
| 160 | |||
| 161 | else | ||
| 162 | # When module versioning is enabled the following steps are executed: | 160 | # When module versioning is enabled the following steps are executed: |
| 163 | # o compile a .tmp_<file>.o from <file>.c | 161 | # o compile a <file>.o from <file>.c |
| 164 | # o if .tmp_<file>.o doesn't contain a __ksymtab version, i.e. does | 162 | # o if <file>.o doesn't contain a __ksymtab version, i.e. does |
| 165 | # not export symbols, we just rename .tmp_<file>.o to <file>.o and | 163 | # not export symbols, it's done. |
| 166 | # are done. | ||
| 167 | # o otherwise, we calculate symbol versions using the good old | 164 | # o otherwise, we calculate symbol versions using the good old |
| 168 | # genksyms on the preprocessed source and postprocess them in a way | 165 | # genksyms on the preprocessed source and postprocess them in a way |
| 169 | # that they are usable as a linker script | 166 | # that they are usable as a linker script |
| 170 | # o generate <file>.o from .tmp_<file>.o using the linker to | 167 | # o generate .tmp_<file>.o from <file>.o using the linker to |
| 171 | # replace the unresolved symbols __crc_exported_symbol with | 168 | # replace the unresolved symbols __crc_exported_symbol with |
| 172 | # the actual value of the checksum generated by genksyms | 169 | # the actual value of the checksum generated by genksyms |
| 173 | 170 | # o remove .tmp_<file>.o to <file>.o | |
| 174 | cmd_cc_o_c = $(CC) $(c_flags) -c -o $(@D)/.tmp_$(@F) $< | ||
| 175 | 171 | ||
| 176 | cmd_modversions_c = \ | 172 | cmd_modversions_c = \ |
| 177 | if $(OBJDUMP) -h $(@D)/.tmp_$(@F) | grep -q __ksymtab; then \ | 173 | if $(OBJDUMP) -h $@ | grep -q __ksymtab; then \ |
| 178 | $(call cmd_gensymtypes_c,$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \ | 174 | $(call cmd_gensymtypes_c,$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \ |
| 179 | > $(@D)/.tmp_$(@F:.o=.ver); \ | 175 | > $(@D)/.tmp_$(@F:.o=.ver); \ |
| 180 | \ | 176 | \ |
| 181 | $(LD) $(KBUILD_LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \ | 177 | $(LD) $(KBUILD_LDFLAGS) -r -o $(@D)/.tmp_$(@F) $@ \ |
| 182 | -T $(@D)/.tmp_$(@F:.o=.ver); \ | 178 | -T $(@D)/.tmp_$(@F:.o=.ver); \ |
| 183 | rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \ | ||
| 184 | else \ | ||
| 185 | mv -f $(@D)/.tmp_$(@F) $@; \ | 179 | mv -f $(@D)/.tmp_$(@F) $@; \ |
| 180 | rm -f $(@D)/.tmp_$(@F:.o=.ver); \ | ||
| 186 | fi; | 181 | fi; |
| 187 | endif | 182 | endif |
| 188 | 183 | ||
| @@ -241,19 +236,12 @@ ifneq ($(RETPOLINE_CFLAGS),) | |||
| 241 | endif | 236 | endif |
| 242 | endif | 237 | endif |
| 243 | 238 | ||
| 244 | |||
| 245 | ifdef CONFIG_MODVERSIONS | ||
| 246 | objtool_o = $(@D)/.tmp_$(@F) | ||
| 247 | else | ||
| 248 | objtool_o = $(@) | ||
| 249 | endif | ||
| 250 | |||
| 251 | # 'OBJECT_FILES_NON_STANDARD := y': skip objtool checking for a directory | 239 | # 'OBJECT_FILES_NON_STANDARD := y': skip objtool checking for a directory |
| 252 | # 'OBJECT_FILES_NON_STANDARD_foo.o := 'y': skip objtool checking for a file | 240 | # 'OBJECT_FILES_NON_STANDARD_foo.o := 'y': skip objtool checking for a file |
| 253 | # 'OBJECT_FILES_NON_STANDARD_foo.o := 'n': override directory skip for a file | 241 | # 'OBJECT_FILES_NON_STANDARD_foo.o := 'n': override directory skip for a file |
| 254 | cmd_objtool = $(if $(patsubst y%,, \ | 242 | cmd_objtool = $(if $(patsubst y%,, \ |
| 255 | $(OBJECT_FILES_NON_STANDARD_$(basetarget).o)$(OBJECT_FILES_NON_STANDARD)n), \ | 243 | $(OBJECT_FILES_NON_STANDARD_$(basetarget).o)$(OBJECT_FILES_NON_STANDARD)n), \ |
| 256 | $(__objtool_obj) $(objtool_args) "$(objtool_o)";) | 244 | $(__objtool_obj) $(objtool_args) $@;) |
| 257 | objtool_obj = $(if $(patsubst y%,, \ | 245 | objtool_obj = $(if $(patsubst y%,, \ |
| 258 | $(OBJECT_FILES_NON_STANDARD_$(basetarget).o)$(OBJECT_FILES_NON_STANDARD)n), \ | 246 | $(OBJECT_FILES_NON_STANDARD_$(basetarget).o)$(OBJECT_FILES_NON_STANDARD)n), \ |
| 259 | $(__objtool_obj)) | 247 | $(__objtool_obj)) |
| @@ -357,34 +345,26 @@ $(obj)/%.s: $(src)/%.S FORCE | |||
| 357 | $(call if_changed_dep,cpp_s_S) | 345 | $(call if_changed_dep,cpp_s_S) |
| 358 | 346 | ||
| 359 | quiet_cmd_as_o_S = AS $(quiet_modtag) $@ | 347 | quiet_cmd_as_o_S = AS $(quiet_modtag) $@ |
| 348 | cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $< | ||
| 360 | 349 | ||
| 361 | ifndef CONFIG_MODVERSIONS | 350 | ifdef CONFIG_MODVERSIONS |
| 362 | cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $< | ||
| 363 | |||
| 364 | else | ||
| 365 | 351 | ||
| 366 | ASM_PROTOTYPES := $(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/asm-prototypes.h) | 352 | ASM_PROTOTYPES := $(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/asm-prototypes.h) |
| 367 | 353 | ||
| 368 | ifeq ($(ASM_PROTOTYPES),) | 354 | ifneq ($(ASM_PROTOTYPES),) |
| 369 | cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $< | ||
| 370 | |||
| 371 | else | ||
| 372 | 355 | ||
| 373 | # versioning matches the C process described above, with difference that | 356 | # versioning matches the C process described above, with difference that |
| 374 | # we parse asm-prototypes.h C header to get function definitions. | 357 | # we parse asm-prototypes.h C header to get function definitions. |
| 375 | 358 | ||
| 376 | cmd_as_o_S = $(CC) $(a_flags) -c -o $(@D)/.tmp_$(@F) $< | ||
| 377 | |||
| 378 | cmd_modversions_S = \ | 359 | cmd_modversions_S = \ |
| 379 | if $(OBJDUMP) -h $(@D)/.tmp_$(@F) | grep -q __ksymtab; then \ | 360 | if $(OBJDUMP) -h $@ | grep -q __ksymtab; then \ |
| 380 | $(call cmd_gensymtypes_S,$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \ | 361 | $(call cmd_gensymtypes_S,$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \ |
| 381 | > $(@D)/.tmp_$(@F:.o=.ver); \ | 362 | > $(@D)/.tmp_$(@F:.o=.ver); \ |
| 382 | \ | 363 | \ |
| 383 | $(LD) $(KBUILD_LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \ | 364 | $(LD) $(KBUILD_LDFLAGS) -r -o $(@D)/.tmp_$(@F) $@ \ |
| 384 | -T $(@D)/.tmp_$(@F:.o=.ver); \ | 365 | -T $(@D)/.tmp_$(@F:.o=.ver); \ |
| 385 | rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \ | ||
| 386 | else \ | ||
| 387 | mv -f $(@D)/.tmp_$(@F) $@; \ | 366 | mv -f $(@D)/.tmp_$(@F) $@; \ |
| 367 | rm -f $(@D)/.tmp_$(@F:.o=.ver); \ | ||
| 388 | fi; | 368 | fi; |
| 389 | endif | 369 | endif |
| 390 | endif | 370 | endif |
