Re: [PATCH] x86: Disable XCHG to MOV optimization

Jan Beulich <[email protected]>
Newsgroups gmane.comp.gnu.binutils
Message-ID <[email protected]>
On 15.07.2026 10:17, H.J. Lu wrote:
> On Wed, Jul 15, 2026 at 3:46 PM Jan Beulich <[email protected]> wrote:
>> On 15.07.2026 09:37, H.J. Lu wrote:
>>> The only rule for me is that -O can be used safely on any applications.
>>
>> In which case we need to rip out all optimizations (assuming you mean all
>> forms of -O, which I think you do, since elsewhere you said the same more
>> explicitly also for e.g. -Os).
> 
> Please show me a binutils bug report for the broken application because
> of using -O with today's binutils master branch.
> 
>> You did notice though that I'm not the only one who isn't sharing this
>> position of yours. Optimization _can_ break code using trickery. That's
>> to be expected, and people playing tricks need to stay away from enabling
>> optimization. We simply can't make that "safe".
> 
> GNU assembler is used by GCC to generate binaries.  GCC may not
> always generate the optimal encoding.   That is why I added -O to
> assembler in the first place.  There is no point in adding it if it isn't safe.
> We can't break applications because of some assembler optimizations.

As said - I will, once time permits (later this week hopefully).

Jan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.