s_nop() / s_nops() vs md_cons_align()

Nick Clifton nickc@redhat.com
Fri Nov 17 14:08:33 GMT 2023


Hi Jan,

> may I ask why s_nop() and s_nops(), who are emitting code rather than
> data, invoke md_cons_align()? 

I *think* that is probably a mistake.

The s_nop() code was copied from the s_nops() code and then tweaked
in order to make it generic rather than specific to the x86 targets.
It inherited the call to md_align_cons from there.

I cannot say for sure why the call to md_align_cons was in the s_nops()
code, although I can guess that it might be because the behaviour was
meant to be similar to the .space pseudo-op and the s_space() function
does, correctly, invoke md_align_cons.

If it helps, the original commit was: 62a02d25b6e5


> x86 at least (ab)uses the hook to record
> certain state, yet that's imo wrong when emitting NOPs. 

Agreed.

Unless H.J. has a convincing argument otherwise I would suggest going
ahead with a patch to remove the call from both functions.

Cheers
   Nick





More information about the Binutils mailing list