bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gas/32528] New: Different codegen between `mov al, byte [rdi]` and


From: taolzu at gmail dot com
Subject: [Bug gas/32528] New: Different codegen between `mov al, byte [rdi]` and `mov al, [rdi]`
Date: Tue, 07 Jan 2025 22:05:13 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=32528

            Bug ID: 32528
           Summary: Different codegen between `mov al, byte [rdi]` and
                    `mov al, [rdi]`
           Product: binutils
           Version: 2.43
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gas
          Assignee: unassigned at sourceware dot org
          Reporter: taolzu at gmail dot com
  Target Milestone: ---

Consider the following x86-64 assembly with intel syntax. I expect two
instruction produce the same output:
```
mov al, byte [rdi]
mov al, [rdi]
```

In reality, gas compiled them to:
```
0x00000000   3                   8a4701  mov al, byte [rdi + 1]
0x00000003   2                     8a07  mov al, byte [rdi]
```

Software information:

```
> as --version
GNU assembler (GNU Binutils for Debian) 2.43.50.20241215
Copyright (C) 2024 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `x86_64-linux-gnu'.
> gcc --version
gcc (Debian 14.2.0-8) 14.2.0
> uname -a
Linux hostname 6.11.7-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.11.7-1 (2024-11-09)
x86_64 GNU/Linux
```

Command line options: `as -64 -o step2 step1`
where step1 has the following content:
```
    .section .shellcode,"awx"
    .global _start
    .global __start
    _start:
    __start:
    .intel_syntax noprefix
    .p2align 0
    mov al, byte [rdi]
```

Thanks for reading!

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]