[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug binutils/32531] New: [GAS] Intel Assembly Bugs (Mishandle Directive
From: |
witbring at gmail dot com |
Subject: |
[Bug binutils/32531] New: [GAS] Intel Assembly Bugs (Mishandle Directive Names) |
Date: |
Wed, 08 Jan 2025 11:29:57 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=32531
Bug ID: 32531
Summary: [GAS] Intel Assembly Bugs (Mishandle Directive Names)
Product: binutils
Version: 2.38
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: binutils
Assignee: unassigned at sourceware dot org
Reporter: witbring at gmail dot com
Target Milestone: ---
I am reporting GNU AS bug found during research.
The tests were conducted using the latest version (v2.38).
The issue occurs in the same way with previous versions as well.
When some directive names are used in memory operands, incorrect binary code is
generated.
It seems that the issue arises due to handling the data labels used in the mov
instruction as directives.`
1. Example Code
```
.intel_syntax noprefix
.data
byte:
word:
qword:
.long 0
.text
test:
mov edx, DWORD PTR [byte]
mov edx, DWORD PTR [word]
mov edx, DWORD PTR [qword]
```
2. Compilation Command
```
gcc -c test.c
```
3. Compiled Binary Output
The memory operands were replaced with constant values in the compiled binary
code.
```
0000000000000000 <test>:
0: 8b 14 25 01 00 00 00 mov edx,DWORD PTR ds:0x1
7: 8b 14 25 02 00 00 00 mov edx,DWORD PTR ds:0x2
e: 8b 14 25 02 00 00 00 mov edx,DWORD PTR ds:0x4
```
This related bug can also be observed when we use other labels such as qword.
rd, qword, tbyte, owrd, xmmword, ymmword, zmmword, far, and near.
This bug can also be reproduced on Godbolt:
https://godbolt.org/z/hj49W734M
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug binutils/32531] New: [GAS] Intel Assembly Bugs (Mishandle Directive Names),
witbring at gmail dot com <=