Skip to content

Commit 8852c55

Browse files
committed
kbuild: Fix objtool dependency for 'OBJECT_FILES_NON_STANDARD_<obj> := n'
"OBJECT_FILES_NON_STANDARD_vma.o := n" has a dependency bug. When objtool source is updated, the affected object doesn't get re-analyzed by objtool. Peter's new variable-sized jump label feature relies on objtool rewriting the object file. Otherwise the system can fail to boot. That effectively upgrades this minor dependency issue to a major bug. The problem is that variables in prerequisites are expanded early, during the read-in phase. The '$(objtool_dep)' variable indirectly uses '$@', which isn't yet available when the target prerequisites are evaluated. Use '.SECONDEXPANSION:' which causes '$(objtool_dep)' to be expanded in a later phase, after the target-specific '$@' variable has been defined. Fixes: b9ab5eb ("objtool: Add CONFIG_STACK_VALIDATION option") Fixes: ab32570 ("jump_label, x86: Allow short NOPs") Reported-by: Matthew Wilcox <willy@infradead.org> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
1 parent 48001d2 commit 8852c55

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

scripts/Makefile.build

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,8 @@ define rule_as_o_S
268268
endef
269269

270270
# Built-in and composite module parts
271-
$(obj)/%.o: $(src)/%.c $(recordmcount_source) $(objtool_dep) FORCE
271+
.SECONDEXPANSION:
272+
$(obj)/%.o: $(src)/%.c $(recordmcount_source) $$(objtool_dep) FORCE
272273
$(call if_changed_rule,cc_o_c)
273274
$(call cmd,force_checksrc)
274275

@@ -349,7 +350,7 @@ cmd_modversions_S = \
349350
fi
350351
endif
351352

352-
$(obj)/%.o: $(src)/%.S $(objtool_dep) FORCE
353+
$(obj)/%.o: $(src)/%.S $$(objtool_dep) FORCE
353354
$(call if_changed_rule,as_o_S)
354355

355356
targets += $(filter-out $(subdir-builtin), $(real-obj-y))

0 commit comments

Comments
 (0)