binutils Newspaper
NOVEMBER 30, 2026
x86 — Proposed

x86: limit coverage of -mlfence-after-load

Refines the -mlfence-after-load option by excluding instructions that do not affect EFLAGS or subsequent memory accesses.

This patch refines the -mlfence-after-load option by excluding several x86 instructions that were previously covered but do not impact EFLAGS or subsequent memory accesses. Instructions like POP with memory operands, NOT, certain shift/rotate operations, LIDT, and INVPCID are now excluded from triggering an LFENCE insertion.

In Details

This patch adjusts the load_insn_p function in tc-i386.c which determines whether an instruction warrants an LFENCE insertion due to the -mlfence-after-load option. It removes several instructions (POP, NOT, certain shifts/rotates, LIDT, INVPCID) from the set that trigger LFENCE, as they do not modify EFLAGS or affect subsequent memory operations in a way that necessitates this mitigation.

For Context
x86
A family of instruction set architectures (ISAs) for CPUs, commonly used in personal computers and servers.
-mlfence-after-load
An assembler option that controls the insertion of an LFENCE (load fence) instruction after certain load operations.
LFENCE
A processor instruction that orders memory loads, preventing subsequent loads from being reordered before it.
EFLAGS
A special register in x86 architecture that stores status flags and control bits, modified by many instructions.
instruction
A command that a CPU can execute.
Filed Under: binutilsx86optimizationsecurity