Re: [Intel-wired-lan] objtool warning in ice_free_prof_mask
From: Josh Poimboeuf
Date: Mon Apr 07 2025 - 20:15:10 EST
On Mon, Apr 07, 2025 at 11:49:35PM +0200, Oleksandr Natalenko wrote:
> $ make drivers/net/ethernet/intel/ice/ice.o
> …
> LD [M] drivers/net/ethernet/intel/ice/ice.o
> drivers/net/ethernet/intel/ice/ice.o: error: objtool: ice_free_prof_mask.isra.0() falls through to next function ice_free_flow_profs.cold()
> drivers/net/ethernet/intel/ice/ice.o: error: objtool: ice_free_prof_mask.isra.0.cold() is missing an ELF size annotation
Thanks, I was able to recreate.
This is the -O3 optimizer noticing that ice_write_prof_mask_reg() is
only called with ICE_BLK_RSS or ICE_BLK_FD. So it optimizes out the
impossible 'default' case in this switch statement:
switch (blk) {
case ICE_BLK_RSS:
offset = GLQF_HMASK(mask_idx);
val = FIELD_PREP(GLQF_HMASK_MSK_INDEX_M, idx);
val |= FIELD_PREP(GLQF_HMASK_MASK_M, mask);
break;
case ICE_BLK_FD:
offset = GLQF_FDMASK(mask_idx);
val = FIELD_PREP(GLQF_FDMASK_MSK_INDEX_M, idx);
val |= FIELD_PREP(GLQF_FDMASK_MASK_M, mask);
break;
default:
ice_debug(hw, ICE_DBG_PKG, "No profile masks for block %d\n",
blk);
return;
}
Unfortunately, instead of finishing the optimization, it inserts
undefined behavior for the 'default' case by branching off to some
random code.
So there doesn't seem to be any underlying bug, it's just that objtool
doesn't like undefined behavior.
So for building with -O3 I'd recommend just disabling
CONFIG_OBJTOOL_WERROR and ignoring any objtool warnings.
--
Josh