[Bug gas/31323] [x86] GAS does not error out instruction that exceed 15 bytes

2024-02-02 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=31323

H.J. Lu  changed:

   What|Removed |Added

Summary|[x86] GAS does not error|[x86] GAS does not error
   |out instruction that exceed |out instruction that exceed
   |16 bytes|15 bytes

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


[Bug gas/31323] [x86] GAS does not error out instruction that exceed 15 bytes

2024-02-02 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=31323

--- Comment #2 from Sourceware Commits  ---
The master branch has been updated by H.J. Lu :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=46bd909328c3c8f3d6fc7a505b2fad1eea72d872

commit 46bd909328c3c8f3d6fc7a505b2fad1eea72d872
Author: H.J. Lu 
Date:   Thu Feb 1 14:42:08 2024 -0800

x86: Disallow instructions with length > 15 bytes

It is a hard error when an instruction length exceeds the limit of 15
bytes:

[hjl@gnu-cfl-3 tmp]$ cat x.s
.text
xacquire lock addq $0x11223344, %fs:(,%eax)
[hjl@gnu-cfl-3 tmp]$ gcc -c x.s
x.s: Assembler messages:
x.s:2: Warning: instruction length of 16 bytes exceeds the limit of 15
[hjl@gnu-cfl-3 tmp]$ objdump -dw x.o

x.o: file format elf64-x86-64

Disassembly of section .text:

 <.text>:
   0:   64 67 f2 f0 48 81 04 05 00 00 00 00 44 33 22xacquire lock (bad)
   f:   11  .byte 0x11
[hjl@gnu-cfl-3 tmp]$

and

[hjl@gnu-cfl-3 tmp]$ cat z.s
addq $0xe0, %fs:0, %rdx
[hjl@gnu-cfl-3 tmp]$ as -o z.o z.s
z.s: Assembler messages:
z.s:1: Warning: instruction length of 16 bytes exceeds the limit of 15
[hjl@gnu-cfl-3 tmp]$ objdump -dw z.o

z.o: file format elf64-x86-64

Disassembly of section .text:

 <.text>:
   0:   64 62 f4 ec 18 81 04 25 00 00 00 00 e0 00 00(bad)
...
[hjl@gnu-cfl-3 pr31323]$

Instructions with length > 15 bytes are always invalid.  It is quite easy
to generate invalid instructions with AVX now.  We should issue an error
when instruction length exceeds the limit of 15 bytes.

PR gas/31323
* config/tc-i386.c (output_insn): Issue an error when instruction
length exceeds the limit of 15 bytes.
* testsuite/gas/i386/oversized16.l: Updated.
* testsuite/gas/i386/oversized64.l: Likewise.
* testsuite/gas/i386/x86-64-apx-inval.l: New file.
* testsuite/gas/i386/x86-64-apx-inval.s: Likewise.

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


[Bug gas/31323] [x86] GAS does not error out instruction that exceed 15 bytes

2024-02-02 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=31323

--- Comment #3 from Sourceware Commits  ---
The binutils-2_42-branch branch has been updated by H.J. Lu
:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=42cde237366398f6e318232f4ce080bef42f0371

commit 42cde237366398f6e318232f4ce080bef42f0371
Author: H.J. Lu 
Date:   Thu Feb 1 14:42:08 2024 -0800

x86: Disallow instructions with length > 15 bytes

It is a hard error when an instruction length exceeds the limit of 15
bytes:

[hjl@gnu-cfl-3 tmp]$ cat x.s
.text
xacquire lock addq $0x11223344, %fs:(,%eax)
[hjl@gnu-cfl-3 tmp]$ gcc -c x.s
x.s: Assembler messages:
x.s:2: Warning: instruction length of 16 bytes exceeds the limit of 15
[hjl@gnu-cfl-3 tmp]$ objdump -dw x.o

x.o: file format elf64-x86-64

Disassembly of section .text:

 <.text>:
   0:   64 67 f2 f0 48 81 04 05 00 00 00 00 44 33 22xacquire lock (bad)
   f:   11  .byte 0x11
[hjl@gnu-cfl-3 tmp]$

and

[hjl@gnu-cfl-3 tmp]$ cat z.s
addq $0xe0, %fs:0, %rdx
[hjl@gnu-cfl-3 tmp]$ as -o z.o z.s
z.s: Assembler messages:
z.s:1: Warning: instruction length of 16 bytes exceeds the limit of 15
[hjl@gnu-cfl-3 tmp]$ objdump -dw z.o

z.o: file format elf64-x86-64

Disassembly of section .text:

 <.text>:
   0:   64 62 f4 ec 18 81 04 25 00 00 00 00 e0 00 00(bad)
...
[hjl@gnu-cfl-3 pr31323]$

Instructions with length > 15 bytes are always invalid.  It is quite easy
to generate invalid instructions with APX now.  We should issue an error
when instruction length exceeds the limit of 15 bytes.

PR gas/31323
* config/tc-i386.c (output_insn): Issue an error when instruction
length exceeds the limit of 15 bytes.
* testsuite/gas/i386/oversized16.l: Updated.
* testsuite/gas/i386/oversized64.l: Likewise.
* testsuite/gas/i386/x86-64-apx-inval.l: New file.
* testsuite/gas/i386/x86-64-apx-inval.s: Likewise.

(cherry picked from commit 46bd909328c3c8f3d6fc7a505b2fad1eea72d872)

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


[Bug binutils/31333] New: Unused variable in binutils/sim/common/dv-sockser.c

2024-02-02 Thread jdx at o2 dot pl
https://sourceware.org/bugzilla/show_bug.cgi?id=31333

Bug ID: 31333
   Summary: Unused variable in binutils/sim/common/dv-sockser.c
   Product: binutils
   Version: 2.43 (HEAD)
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: binutils
  Assignee: unassigned at sourceware dot org
  Reporter: jdx at o2 dot pl
  Target Milestone: ---
  Host: x86_64-w64-mingw32
Target: h8300-elf

This is what happened when I tried to build rev. e58beedf for H8:

[...]
  CC   h8300/dv-sockser.o
../../../binutils/sim/common/dv-sockser.c: In function 'connected_p':
../../../binutils/sim/common/dv-sockser.c:221:14: error: unused variable
'flags' [-Werror=unused-variable]
  221 |   int numfds,flags;
  |  ^
cc1.exe: all warnings being treated as errors
make[3]: *** [Makefile:5359: h8300/dv-sockser.o] Error 1
make[3]: Leaving directory '/d/Works/xcomp/binutils-build/sim'
make[2]: *** [Makefile:3235: all] Error 2
make[2]: Leaving directory '/d/Works/xcomp/binutils-build/sim'
make[1]: *** [Makefile:10890: all-sim] Error 2
make[1]: Leaving directory '/d/Works/xcomp/binutils-build'
make: *** [Makefile:1045: all] Error 2

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