• Peter Oberparleiter's avatar
    x86, hweight: Fix BUG when booting with CONFIG_GCOV_PROFILE_ALL=y · d2fc4a69
    Peter Oberparleiter authored
    commit 6583327c upstream.
    
    Commit d61931d8
    
    , "x86: Add optimized popcnt variants" introduced
    compile flag -fcall-saved-rdi for lib/hweight.c. When combined with
    options -fprofile-arcs and -O2, this flag causes gcc to generate
    broken constructor code. As a result, a 64 bit x86 kernel compiled
    with CONFIG_GCOV_PROFILE_ALL=y prints message "gcov: could not create
    file" and runs into sproadic BUGs during boot.
    
    The gcc people indicate that these kinds of problems are endemic when
    using ad hoc calling conventions.  It is therefore best to treat any
    file compiled with ad hoc calling conventions as an isolated
    environment and avoid things like profiling or coverage analysis,
    since those subsystems assume a "normal" calling conventions.
    
    This patch avoids the bug by excluding lib/hweight.o from coverage
    profiling.
    Reported-by: default avatarMeelis Roos <mroos@linux.ee>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by:...
    d2fc4a69
Makefile 3.78 KB