Skip to content

Commit

Permalink
lisa._kmod: Warn about non ideal toolchain in more situations
Browse files Browse the repository at this point in the history
FIX

Warn about toolchain mismatching what the kernel was compiled with in
absolute terms.
  • Loading branch information
douglas-raillard-arm committed Jan 19, 2024
1 parent 4183896 commit d679b17
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lisa/_kmod.py
Original file line number Diff line number Diff line change
Expand Up @@ -1465,6 +1465,9 @@ def _resolve_toolchain(cls, abi, build_conf, target=None):
def priority_to(cc):
return lambda _cc: 0 if cc in _cc.name else 1

def is_perfect(cc):
return cc_priority(cc) == 0

cc_priority = priority_to('clang')

if target:
Expand Down Expand Up @@ -1505,6 +1508,9 @@ def cc_priority(cc):
return version_key(version)
else:
return (3,)

def is_perfect(cc):
return cc_priority(cc) == (0, 0)
else:
try:
proc_version = target.read_value('/proc/version')
Expand Down Expand Up @@ -1682,7 +1688,7 @@ def version_cmd(cc, cross_compile):
raise ValueError(f'Could not detect which CROSS_COMPILE value to use')

ideal_cc, _ = ccs[0]
if str(cc) != str(ideal_cc):
if str(cc) != str(ideal_cc) or not is_perfect(cc):
logger.warning(f'Could not find ideal CC={ideal_cc} but found CC={cc} instead. Results may vary from working fine to crashing the kernel')

return (cc, cross_compile, cc_key)
Expand Down

0 comments on commit d679b17

Please sign in to comment.