public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* s_nop() / s_nops() vs md_cons_align()
@ 2023-11-17 13:42 Jan Beulich
  2023-11-17 14:08 ` Nick Clifton
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2023-11-17 13:42 UTC (permalink / raw)
  To: Nick Clifton, H.J. Lu; +Cc: Binutils

Nick, H.J.,

may I ask why s_nop() and s_nops(), who are emitting code rather than
data, invoke md_cons_align()? x86 at least (ab)uses the hook to record
certain state, yet that's imo wrong when emitting NOPs. (The hook
function also can't tell apart the various reasons of being called.)

Jan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: s_nop() / s_nops() vs md_cons_align()
  2023-11-17 13:42 s_nop() / s_nops() vs md_cons_align() Jan Beulich
@ 2023-11-17 14:08 ` Nick Clifton
  2023-11-17 14:17   ` Jan Beulich
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Clifton @ 2023-11-17 14:08 UTC (permalink / raw)
  To: Jan Beulich, H.J. Lu; +Cc: Binutils

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




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: s_nop() / s_nops() vs md_cons_align()
  2023-11-17 14:08 ` Nick Clifton
@ 2023-11-17 14:17   ` Jan Beulich
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Beulich @ 2023-11-17 14:17 UTC (permalink / raw)
  To: Nick Clifton, H.J. Lu; +Cc: Binutils

On 17.11.2023 15:08, Nick Clifton wrote:
> 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.

I have that as part of a slightly larger patch (where I ran into the
conflict). I will want to run a full set of tests on that, of course, to
be at least reasonably certain that no target has grown a dependency on
the present behavior.

Jan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-11-17 14:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-17 13:42 s_nop() / s_nops() vs md_cons_align() Jan Beulich
2023-11-17 14:08 ` Nick Clifton
2023-11-17 14:17   ` Jan Beulich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).