Skip to content

Commit 5f9aaaa

Browse files
jpoimboegregkh
authored andcommitted
kbuild: Fix objtool dependency for 'OBJECT_FILES_NON_STANDARD_<obj> := n'
[ Upstream commit 8852c55 ] "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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 37481ad commit 5f9aaaa

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
@@ -275,7 +275,8 @@ define rule_as_o_S
275275
endef
276276

277277
# Built-in and composite module parts
278-
$(obj)/%.o: $(src)/%.c $(recordmcount_source) $(objtool_dep) FORCE
278+
.SECONDEXPANSION:
279+
$(obj)/%.o: $(src)/%.c $(recordmcount_source) $$(objtool_dep) FORCE
279280
$(call if_changed_rule,cc_o_c)
280281
$(call cmd,force_checksrc)
281282

@@ -356,7 +357,7 @@ cmd_modversions_S = \
356357
fi
357358
endif
358359

359-
$(obj)/%.o: $(src)/%.S $(objtool_dep) FORCE
360+
$(obj)/%.o: $(src)/%.S $$(objtool_dep) FORCE
360361
$(call if_changed_rule,as_o_S)
361362

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

0 commit comments

Comments
 (0)