lkml.org 
[lkml]   [2021]   [Jul]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.10 222/593] kbuild: Fix objtool dependency for OBJECT_FILES_NON_STANDARD_<obj> := n
    Date
    From: Josh Poimboeuf <jpoimboe@redhat.com>

    [ Upstream commit 8852c552402979508fdc395ae07aa8761aa46045 ]

    "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: b9ab5ebb14ec ("objtool: Add CONFIG_STACK_VALIDATION option")
    Fixes: ab3257042c26 ("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>
    ---
    scripts/Makefile.build | 5 +++--
    1 file changed, 3 insertions(+), 2 deletions(-)

    diff --git a/scripts/Makefile.build b/scripts/Makefile.build
    index 4c058f12dd73..8bd4e673383f 100644
    --- a/scripts/Makefile.build
    +++ b/scripts/Makefile.build
    @@ -275,7 +275,8 @@ define rule_as_o_S
    endef

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

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

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

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


    \
     
     \ /
      Last update: 2021-07-12 09:10    [W:4.069 / U:0.668 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site