x86-64: Use UD0/UD2 after indirect jump in PLT entries

Message ID CAMe9rOoFbPvk27h+qnGu9xCfQ5z8LAkrr5L-5HPGR8PDD0XM5g@mail.gmail.com
State New
Headers
Series x86-64: Use UD0/UD2 after indirect jump in PLT entries |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_binutils_check--master-arm success Test passed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 success Test passed

Commit Message

H.J. Lu Sept. 30, 2026, 11:54 p.m. UTC
  Replace NOP with UD0 or UD2 after indirect branch in PLT entries to
implement optimization guide from Intel optimization manual:

Assembly/Compiler Coding Rule 13. (M impact, L generality)

When indirect branches are present, try to put the most likely target
of an indirect branch immediately following the indirect branch.
Alternatively, if indirect branches are common but they cannot be
predicted by branch prediction hardware, then follow the indirect
branch with a UD0/UD2 instruction, which will stop the processor from
decoding down the fall-through path.

bfd/

PR ld/34626
* elf64-x86-64.c (elf_x86_64_lazy_plt0_entry): Replace 4-byte
NOP with a 4-byte UD0.
(elf_x86_64_non_lazy_plt_entry): Replace 2-byte NOP with a
2-byte UD2.
(elf_x86_64_non_lazy_ibt_plt_entry): Replace a 6-byte NOP with
a 6-byte UD0.

ld/

PR ld/34626
* testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d: Adjusted.
* testsuite/ld-ifunc/ifunc-2-x86-64-now.d: Likewise.
* testsuite/ld-ifunc/pr17154-x86-64-now.d: Likewise.
* testsuite/ld-ifunc/pr17154-x86-64.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-1-x32.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-1.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-2a-x32.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-2a.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-2c-x32.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-2c.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-3a-x32.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-3a.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-3c-x32.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-3c.d: Likewise.
* testsuite/ld-x86-64/mark-plt-1d-x32.d: Likewise.
* testsuite/ld-x86-64/mark-plt-1d.d: Likewise.
* testsuite/ld-x86-64/plt.pd: Likewise.
* testsuite/ld-x86-64/plt2.dd: Likewise.
* testsuite/ld-x86-64/pr19636-2d.d: Likewise.
* testsuite/ld-x86-64/pr19636-2l.d: Likewise.
* testsuite/ld-x86-64/pr20830a-now.d: Likewise.
* testsuite/ld-x86-64/pr20830a.d: Likewise.
* testsuite/ld-x86-64/pr20830b-now.d: Likewise.
* testsuite/ld-x86-64/pr20830b.d: Likewise.
* testsuite/ld-x86-64/tlsdesc.pd: Likewise.
  

Comments

Jan Beulich Oct. 1, 2026, 6:16 a.m. UTC | #1
On 01.10.2026 01:54, H.J. Lu wrote:
> Replace NOP with UD0 or UD2 after indirect branch in PLT entries to
> implement optimization guide from Intel optimization manual:
> 
> Assembly/Compiler Coding Rule 13. (M impact, L generality)
> 
> When indirect branches are present, try to put the most likely target
> of an indirect branch immediately following the indirect branch.
> Alternatively, if indirect branches are common but they cannot be
> predicted by branch prediction hardware, then follow the indirect
> branch with a UD0/UD2 instruction, which will stop the processor from
> decoding down the fall-through path.
> 
> bfd/
> 
> PR ld/34626
> * elf64-x86-64.c (elf_x86_64_lazy_plt0_entry): Replace 4-byte
> NOP with a 4-byte UD0.
> (elf_x86_64_non_lazy_plt_entry): Replace 2-byte NOP with a
> 2-byte UD2.
> (elf_x86_64_non_lazy_ibt_plt_entry): Replace a 6-byte NOP with
> a 6-byte UD0.

Compression-wise this isn't very efficient. How about using N bytes of
UDB?

Jan
  

Patch

From c006d59eb3b66b215a4c98b6d78f484f0cbe4fcf Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Fri, 11 Sep 2026 12:18:10 +0800
Subject: [PATCH] x86-64: Use UD0/UD2 after indirect jump in PLT entries

Replace NOP with UD0 or UD2 after indirect branch in PLT entries to
implement optimization guide from Intel optimization manual:

Assembly/Compiler Coding Rule 13. (M impact, L generality)

When indirect branches are present, try to put the most likely target
of an indirect branch immediately following the indirect branch.
Alternatively, if indirect branches are common but they cannot be
predicted by branch prediction hardware, then follow the indirect
branch with a UD0/UD2 instruction, which will stop the processor from
decoding down the fall-through path.

bfd/

	PR ld/34626
	* elf64-x86-64.c (elf_x86_64_lazy_plt0_entry): Replace 4-byte
	NOP with a 4-byte UD0.
	(elf_x86_64_non_lazy_plt_entry): Replace 2-byte NOP with a
	2-byte UD2.
	(elf_x86_64_non_lazy_ibt_plt_entry): Replace a 6-byte NOP with
	a 6-byte UD0.

ld/

	PR ld/34626
	* testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d: Adjusted.
	* testsuite/ld-ifunc/ifunc-2-x86-64-now.d: Likewise.
	* testsuite/ld-ifunc/pr17154-x86-64-now.d: Likewise.
	* testsuite/ld-ifunc/pr17154-x86-64.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-1-x32.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-1.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-2a-x32.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-2a.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-2c-x32.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-2c.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-3a-x32.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-3a.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-3c-x32.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-3c.d: Likewise.
	* testsuite/ld-x86-64/mark-plt-1d-x32.d: Likewise.
	* testsuite/ld-x86-64/mark-plt-1d.d: Likewise.
	* testsuite/ld-x86-64/plt.pd: Likewise.
	* testsuite/ld-x86-64/plt2.dd: Likewise.
	* testsuite/ld-x86-64/pr19636-2d.d: Likewise.
	* testsuite/ld-x86-64/pr19636-2l.d: Likewise.
	* testsuite/ld-x86-64/pr20830a-now.d: Likewise.
	* testsuite/ld-x86-64/pr20830a.d: Likewise.
	* testsuite/ld-x86-64/pr20830b-now.d: Likewise.
	* testsuite/ld-x86-64/pr20830b.d: Likewise.
	* testsuite/ld-x86-64/tlsdesc.pd: Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
 bfd/elf64-x86-64.c                               | 13 +++++++------
 ld/testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d |  2 +-
 ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d       |  2 +-
 ld/testsuite/ld-ifunc/pr17154-x86-64-now.d       |  2 +-
 ld/testsuite/ld-ifunc/pr17154-x86-64.d           |  2 +-
 ld/testsuite/ld-x86-64/ibt-plt-1-x32.d           |  6 +++---
 ld/testsuite/ld-x86-64/ibt-plt-1.d               |  6 +++---
 ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d          |  6 +++---
 ld/testsuite/ld-x86-64/ibt-plt-2a.d              |  6 +++---
 ld/testsuite/ld-x86-64/ibt-plt-2c-x32.d          |  6 +++---
 ld/testsuite/ld-x86-64/ibt-plt-2c.d              |  6 +++---
 ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d          |  6 +++---
 ld/testsuite/ld-x86-64/ibt-plt-3a.d              |  6 +++---
 ld/testsuite/ld-x86-64/ibt-plt-3c-x32.d          |  6 +++---
 ld/testsuite/ld-x86-64/ibt-plt-3c.d              |  6 +++---
 ld/testsuite/ld-x86-64/mark-plt-1d-x32.d         |  2 +-
 ld/testsuite/ld-x86-64/mark-plt-1d.d             |  2 +-
 ld/testsuite/ld-x86-64/plt.pd                    |  2 +-
 ld/testsuite/ld-x86-64/plt2.dd                   |  2 +-
 ld/testsuite/ld-x86-64/pr19636-2d.d              |  2 +-
 ld/testsuite/ld-x86-64/pr19636-2l.d              |  2 +-
 ld/testsuite/ld-x86-64/pr20830a-now.d            |  4 ++--
 ld/testsuite/ld-x86-64/pr20830a.d                |  4 ++--
 ld/testsuite/ld-x86-64/pr20830b-now.d            |  4 ++--
 ld/testsuite/ld-x86-64/pr20830b.d                |  4 ++--
 ld/testsuite/ld-x86-64/tlsdesc.pd                |  2 +-
 26 files changed, 56 insertions(+), 55 deletions(-)

diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index ccefcf1b8b0..48c935f2fb0 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -584,13 +584,13 @@  elf_x86_64_write_core_note (bfd *abfd, char *buf, int *bufsiz,
 
 /* The first entry in a lazy procedure linkage table looks like this.
    See the SVR4 ABI i386 supplement and the x86-64 ABI to see how this
-   works.  */
+   works.  Use UD0 instead of NOP after indirect jump.  */
 
 static const bfd_byte elf_x86_64_lazy_plt0_entry[LAZY_PLT_ENTRY_SIZE] =
 {
   0xff, 0x35, 8, 0, 0, 0,	/* pushq GOT+8(%rip)  */
   0xff, 0x25, 16, 0, 0, 0,	/* jmpq *GOT+16(%rip) */
-  0x0f, 0x1f, 0x40, 0x00	/* nopl 0(%rax)       */
+  0x0f, 0xff, 0x40, 0x00	/* ud0 0x0(%rax),%eax */
 };
 
 /* Subsequent entries in a lazy procedure linkage table look like this.  */
@@ -651,13 +651,14 @@  static const bfd_byte elf_x86_64_lazy_ibt_plt_entry[LAZY_PLT_ENTRY_SIZE] =
   0x66, 0x90			/* xchg %ax,%ax		      */
 };
 
-/* Entries in the non-lazy procedure linkage table look like this.  */
+/* Entries in the non-lazy procedure linkage table look like this.
+   Use UD2 instead of NOP after indirect jump.  */
 
 static const bfd_byte elf_x86_64_non_lazy_plt_entry[NON_LAZY_PLT_ENTRY_SIZE] =
 {
   0xff, 0x25,	     /* jmpq *name@GOTPC(%rip)			      */
   0, 0, 0, 0,	     /* replaced with offset to this symbol in .got.  */
-  0x66, 0x90	     /* xchg %ax,%ax				      */
+  0x0f, 0x0b	     /* ud2					      */
 };
 
 /* Entries for branches with BND prefix in the non-lazy procedure
@@ -684,14 +685,14 @@  static const bfd_byte elf_x86_64_non_lazy_bnd_ibt_plt_entry[LAZY_PLT_ENTRY_SIZE]
 
 /* Entries for branches with IBT-enabled in the non-lazy procedure
    linkage table look like this.  They have the same size as the lazy
-   PLT entry.  */
+   PLT entry.  Use UD0 instead of NOP after indirect jump.  */
 
 static const bfd_byte elf_x86_64_non_lazy_ibt_plt_entry[LAZY_PLT_ENTRY_SIZE] =
 {
   0xf3, 0x0f, 0x1e, 0xfa,	     /* endbr64		       */
   0xff, 0x25,			     /* jmpq *name@GOTPC(%rip) */
   0, 0, 0, 0,  /* replaced with offset to this symbol in .got. */
-  0x66, 0x0f, 0x1f, 0x44, 0x00, 0x00 /* nopw 0x0(%rax,%rax,1)  */
+  0x67, 0x0f, 0xff, 0x44, 0x00, 0x00 /* ud0 0x0(%eax,%eax,1),%eax */
 };
 
 /* The TLSDESC entry in a lazy procedure linkage table.  */
diff --git a/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d b/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d
index 6d98d66ebd4..84b0f7d9213 100644
--- a/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d
+++ b/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d
@@ -12,7 +12,7 @@  Disassembly of section .plt:
 0+170 <\*ABS\*\+0x190@plt-0x10>:
  +[a-f0-9]+:	ff 35 42 01 20 00    	push   0x200142\(%rip\)        # 2002b8 <_GLOBAL_OFFSET_TABLE_\+0x8>
  +[a-f0-9]+:	ff 25 44 01 20 00    	jmp    \*0x200144\(%rip\)        # 2002c0 <_GLOBAL_OFFSET_TABLE_\+0x10>
- +[a-f0-9]+:	0f 1f 40 00          	nopl   0x0\(%rax\)
+ +[a-f0-9]+:	0f ff 40 00          	ud0    0x0\(%rax\),%eax
 
 0+180 <\*ABS\*\+0x190@plt>:
  +[a-f0-9]+:	ff 25 42 01 20 00    	jmp    \*0x200142\(%rip\)        # 2002c8 <_GLOBAL_OFFSET_TABLE_\+0x18>
diff --git a/ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d b/ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d
index 8b248d393b0..c26dac7c7bb 100644
--- a/ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d
+++ b/ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d
@@ -12,7 +12,7 @@  Disassembly of section .plt:
 0+170 <\*ABS\*\+0x190@plt-0x10>:
  +[a-f0-9]+:	ff 35 42 01 20 00    	push   0x200142\(%rip\)        # 2002b8 <_GLOBAL_OFFSET_TABLE_\+0x8>
  +[a-f0-9]+:	ff 25 44 01 20 00    	jmp    \*0x200144\(%rip\)        # 2002c0 <_GLOBAL_OFFSET_TABLE_\+0x10>
- +[a-f0-9]+:	0f 1f 40 00          	nopl   0x0\(%rax\)
+ +[a-f0-9]+:	0f ff 40 00          	ud0    0x0\(%rax\),%eax
 
 0+180 <\*ABS\*\+0x190@plt>:
  +[a-f0-9]+:	ff 25 42 01 20 00    	jmp    \*0x200142\(%rip\)        # 2002c8 <_GLOBAL_OFFSET_TABLE_\+0x18>
diff --git a/ld/testsuite/ld-ifunc/pr17154-x86-64-now.d b/ld/testsuite/ld-ifunc/pr17154-x86-64-now.d
index 4d2ae8413f2..3396687d408 100644
--- a/ld/testsuite/ld-ifunc/pr17154-x86-64-now.d
+++ b/ld/testsuite/ld-ifunc/pr17154-x86-64-now.d
@@ -12,7 +12,7 @@  Disassembly of section .plt:
 0+240 <\*ABS\*\+0x29a@plt-0x10>:
  +[a-f0-9]+:	ff 35 7a 01 20 00    	push   0x20017a\(%rip\)        # 2003c0 <_GLOBAL_OFFSET_TABLE_\+0x8>
  +[a-f0-9]+:	ff 25 7c 01 20 00    	jmp    \*0x20017c\(%rip\)        # 2003c8 <_GLOBAL_OFFSET_TABLE_\+0x10>
- +[a-f0-9]+:	0f 1f 40 00          	nopl   0x0\(%rax\)
+ +[a-f0-9]+:	0f ff 40 00          	ud0    0x0\(%rax\),%eax
 
 0+250 <\*ABS\*\+0x29a@plt>:
  +[a-f0-9]+:	ff 25 7a 01 20 00    	jmp    \*0x20017a\(%rip\)        # 2003d0 <_GLOBAL_OFFSET_TABLE_\+0x18>
diff --git a/ld/testsuite/ld-ifunc/pr17154-x86-64.d b/ld/testsuite/ld-ifunc/pr17154-x86-64.d
index fbe6e225d5c..f0338546691 100644
--- a/ld/testsuite/ld-ifunc/pr17154-x86-64.d
+++ b/ld/testsuite/ld-ifunc/pr17154-x86-64.d
@@ -8,7 +8,7 @@ 
 0+240 <.*>:
  +[a-f0-9]+:	ff 35 5a 01 20 00    	push   0x20015a\(%rip\)        # 2003a0 <_GLOBAL_OFFSET_TABLE_\+0x8>
  +[a-f0-9]+:	ff 25 5c 01 20 00    	jmp    \*0x20015c\(%rip\)        # 2003a8 <_GLOBAL_OFFSET_TABLE_\+0x10>
- +[a-f0-9]+:	0f 1f 40 00          	nopl   0x0\(%rax\)
+ +[a-f0-9]+:	0f ff 40 00          	ud0    0x0\(%rax\),%eax
 
 0+250 <\*ABS\*\+0x29a@plt>:
  +[a-f0-9]+:	ff 25 5a 01 20 00    	jmp    \*0x20015a\(%rip\)        # 2003b0 <_GLOBAL_OFFSET_TABLE_\+0x18>
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-1-x32.d b/ld/testsuite/ld-x86-64/ibt-plt-1-x32.d
index 369a18be453..3a4f2c12b85 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-1-x32.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-1-x32.d
@@ -11,7 +11,7 @@  Disassembly of section .plt:
 [a-f0-9]+ <.plt>:
  +[a-f0-9]+:	ff 35 ([0-9a-f]{2} ){4}[ 	]+push   0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_GLOBAL_OFFSET_TABLE_\+0x8>
  +[a-f0-9]+:	ff 25 ([0-9a-f]{2} ){4}[ 	]+jmp    \*0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_GLOBAL_OFFSET_TABLE_\+0x10>
- +[a-f0-9]+:	0f 1f 40 00          	nopl   0x0\(%rax\)
+ +[a-f0-9]+:	0f ff 40 00          	ud0    0x0\(%rax\),%eax
  +[a-f0-9]+:	f3 0f 1e fa          	endbr64
  +[a-f0-9]+:	68 00 00 00 00       	push   \$0x0
  +[a-f0-9]+:	e9 e2 ff ff ff       	jmp    [a-f0-9]+ <bar1@plt-0x30>
@@ -26,12 +26,12 @@  Disassembly of section .plt.sec:
 [a-f0-9]+ <bar1@plt>:
  +[a-f0-9]+:	f3 0f 1e fa          	endbr64
  +[a-f0-9]+:	ff 25 ([0-9a-f]{2} ){4}[ 	]+jmp    \*0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <bar1>
- +[a-f0-9]+:	66 0f 1f 44 00 00    	nopw   0x0\(%rax,%rax,1\)
+ +[a-f0-9]+:	67 0f ff 44 00 00    	ud0    0x0\(%eax,%eax,1\),%eax
 
 [a-f0-9]+ <bar2@plt>:
  +[a-f0-9]+:	f3 0f 1e fa          	endbr64
  +[a-f0-9]+:	ff 25 ([0-9a-f]{2} ){4}[ 	]+jmp    \*0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <bar2>
- +[a-f0-9]+:	66 0f 1f 44 00 00    	nopw   0x0\(%rax,%rax,1\)
+ +[a-f0-9]+:	67 0f ff 44 00 00    	ud0    0x0\(%eax,%eax,1\),%eax
 
 Disassembly of section .text:
 
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-1.d b/ld/testsuite/ld-x86-64/ibt-plt-1.d
index 283dbf39036..c9675098d1d 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-1.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-1.d
@@ -11,7 +11,7 @@  Disassembly of section .plt:
 [a-f0-9]+ <.plt>:
  +[a-f0-9]+:	ff 35 ([0-9a-f]{2} ){4}[ 	]+push   0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_GLOBAL_OFFSET_TABLE_\+0x8>
  +[a-f0-9]+:	ff 25 ([0-9a-f]{2} ){4}[ 	]+jmp    \*0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_GLOBAL_OFFSET_TABLE_\+0x10>
- +[a-f0-9]+:	0f 1f 40 00          	nopl   0x0\(%rax\)
+ +[a-f0-9]+:	0f ff 40 00          	ud0    0x0\(%rax\),%eax
  +[a-f0-9]+:	f3 0f 1e fa          	endbr64
  +[a-f0-9]+:	68 00 00 00 00       	push   \$0x0
  +[a-f0-9]+:	e9 e2 ff ff ff       	jmp    [a-f0-9]+ <.*>
@@ -26,12 +26,12 @@  Disassembly of section .plt.sec:
 [a-f0-9]+ <bar1@plt>:
  +[a-f0-9]+:	f3 0f 1e fa          	endbr64
  +[a-f0-9]+:	ff 25 ([0-9a-f]{2} ){4}[ 	]+jmp    \*0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <bar1>
- +[a-f0-9]+:	66 0f 1f 44 00 00    	nopw   0x0\(%rax,%rax,1\)
+ +[a-f0-9]+:	67 0f ff 44 00 00    	ud0    0x0\(%eax,%eax,1\),%eax
 
 [a-f0-9]+ <bar2@plt>:
  +[a-f0-9]+:	f3 0f 1e fa          	endbr64
  +[a-f0-9]+:	ff 25 ([0-9a-f]{2} ){4}[ 	]+jmp    \*0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <bar2>
- +[a-f0-9]+:	66 0f 1f 44 00 00    	nopw   0x0\(%rax,%rax,1\)
+ +[a-f0-9]+:	67 0f ff 44 00 00    	ud0    0x0\(%eax,%eax,1\),%eax
 
 Disassembly of section .text:
 
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d b/ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d
index 31201c6498f..08b4bbaab62 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d
@@ -11,7 +11,7 @@  Disassembly of section .plt:
 0+140 <.plt>:
  +[a-f0-9]+:	ff 35 4a 01 20 00    	push   0x20014a\(%rip\)        # 200290 <_GLOBAL_OFFSET_TABLE_\+0x8>
  +[a-f0-9]+:	ff 25 4c 01 20 00    	jmp    \*0x20014c\(%rip\)        # 200298 <_GLOBAL_OFFSET_TABLE_\+0x10>
- +[a-f0-9]+:	0f 1f 40 00          	nopl   0x0\(%rax\)
+ +[a-f0-9]+:	0f ff 40 00          	ud0    0x0\(%rax\),%eax
  +[a-f0-9]+:	f3 0f 1e fa          	endbr64
  +[a-f0-9]+:	68 00 00 00 00       	push   \$0x0
  +[a-f0-9]+:	e9 e2 ff ff ff       	jmp    140 <bar1@plt-0x30>
@@ -26,12 +26,12 @@  Disassembly of section .plt.sec:
 0+170 <bar1@plt>:
  +[a-f0-9]+:	f3 0f 1e fa          	endbr64
  +[a-f0-9]+:	ff 25 26 01 20 00    	jmp    \*0x200126\(%rip\)        # 2002a0 <bar1>
- +[a-f0-9]+:	66 0f 1f 44 00 00    	nopw   0x0\(%rax,%rax,1\)
+ +[a-f0-9]+:	67 0f ff 44 00 00    	ud0    0x0\(%eax,%eax,1\),%eax
 
 0+180 <bar2@plt>:
  +[a-f0-9]+:	f3 0f 1e fa          	endbr64
  +[a-f0-9]+:	ff 25 1e 01 20 00    	jmp    \*0x20011e\(%rip\)        # 2002a8 <bar2>
- +[a-f0-9]+:	66 0f 1f 44 00 00    	nopw   0x0\(%rax,%rax,1\)
+ +[a-f0-9]+:	67 0f ff 44 00 00    	ud0    0x0\(%eax,%eax,1\),%eax
 
 Disassembly of section .text:
 
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-2a.d b/ld/testsuite/ld-x86-64/ibt-plt-2a.d
index 7f66eedbcfd..2fb28d48ca2 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-2a.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-2a.d
@@ -11,7 +11,7 @@  Disassembly of section .plt:
 0+1f0 <.plt>:
  +[a-f0-9]+:	ff 35 ca 01 20 00    	push   0x2001ca\(%rip\)        # 2003c0 <_GLOBAL_OFFSET_TABLE_\+0x8>
  +[a-f0-9]+:	ff 25 cc 01 20 00    	jmp    \*0x2001cc\(%rip\)        # 2003c8 <_GLOBAL_OFFSET_TABLE_\+0x10>
- +[a-f0-9]+:	0f 1f 40 00          	nopl   0x0\(%rax\)
+ +[a-f0-9]+:	0f ff 40 00          	ud0    0x0\(%rax\),%eax
  +[a-f0-9]+:	f3 0f 1e fa          	endbr64
  +[a-f0-9]+:	68 00 00 00 00       	push   \$0x0
  +[a-f0-9]+:	e9 e2 ff ff ff       	jmp    1f0 <.*>
@@ -26,12 +26,12 @@  Disassembly of section .plt.sec:
 0+220 <bar1@plt>:
  +[a-f0-9]+:	f3 0f 1e fa          	endbr64
  +[a-f0-9]+:	ff 25 a6 01 20 00    	jmp    \*0x2001a6\(%rip\)        # 2003d0 <bar1>
- +[a-f0-9]+:	66 0f 1f 44 00 00    	nopw   0x0\(%rax,%rax,1\)
+ +[a-f0-9]+:	67 0f ff 44 00 00    	ud0    0x0\(%eax,%eax,1\),%eax
 
 0+230 <bar2@plt>:
  +[a-f0-9]+:	f3 0f 1e fa          	endbr64
  +[a-f0-9]+:	ff 25 9e 01 20 00    	jmp    \*0x20019e\(%rip\)        # 2003d8 <bar2>
- +[a-f0-9]+:	66 0f 1f 44 00 00    	nopw   0x0\(%rax,%rax,1\)
+ +[a-f0-9]+:	67 0f ff 44 00 00    	ud0    0x0\(%eax,%eax,1\),%eax
 
 Disassembly of section .text:
 
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-2c-x32.d b/ld/testsuite/ld-x86-64/ibt-plt-2c-x32.d
index 32d0b0efd02..eb9a00c88b1 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-2c-x32.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-2c-x32.d
@@ -11,7 +11,7 @@  Disassembly of section .plt:
 [a-f0-9]+ <.plt>:
  +[a-f0-9]+:	ff 35 ([0-9a-f]{2} ){4}[ 	]+push   0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_GLOBAL_OFFSET_TABLE_\+0x8>
  +[a-f0-9]+:	ff 25 ([0-9a-f]{2} ){4}[ 	]+jmp    \*0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_GLOBAL_OFFSET_TABLE_\+0x10>
- +[a-f0-9]+:	0f 1f 40 00          	nopl   0x0\(%rax\)
+ +[a-f0-9]+:	0f ff 40 00          	ud0    0x0\(%rax\),%eax
  +[a-f0-9]+:	f3 0f 1e fa          	endbr64
  +[a-f0-9]+:	68 00 00 00 00       	push   \$0x0
  +[a-f0-9]+:	e9 e2 ff ff ff       	jmp    [a-f0-9]+ <bar1@plt-0x30>
@@ -26,12 +26,12 @@  Disassembly of section .plt.sec:
 [a-f0-9]+ <bar1@plt>:
  +[a-f0-9]+:	f3 0f 1e fa          	endbr64
  +[a-f0-9]+:	ff 25 ([0-9a-f]{2} ){4}[ 	]+jmp    \*0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <bar1>
- +[a-f0-9]+:	66 0f 1f 44 00 00    	nopw   0x0\(%rax,%rax,1\)
+ +[a-f0-9]+:	67 0f ff 44 00 00    	ud0    0x0\(%eax,%eax,1\),%eax
 
 [a-f0-9]+ <bar2@plt>:
  +[a-f0-9]+:	f3 0f 1e fa          	endbr64
  +[a-f0-9]+:	ff 25 ([0-9a-f]{2} ){4}[ 	]+jmp    \*0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <bar2>
- +[a-f0-9]+:	66 0f 1f 44 00 00    	nopw   0x0\(%rax,%rax,1\)
+ +[a-f0-9]+:	67 0f ff 44 00 00    	ud0    0x0\(%eax,%eax,1\),%eax
 
 Disassembly of section .text:
 
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-2c.d b/ld/testsuite/ld-x86-64/ibt-plt-2c.d
index 74184aed366..6289dd427c2 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-2c.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-2c.d
@@ -11,7 +11,7 @@  Disassembly of section .plt:
 [a-f0-9]+ <.plt>:
  +[a-f0-9]+:	ff 35 ([0-9a-f]{2} ){4}[ 	]+push   0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_GLOBAL_OFFSET_TABLE_\+0x8>
  +[a-f0-9]+:	ff 25 ([0-9a-f]{2} ){4}[ 	]+jmp    \*0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_GLOBAL_OFFSET_TABLE_\+0x10>
- +[a-f0-9]+:	0f 1f 40 00          	nopl   0x0\(%rax\)
+ +[a-f0-9]+:	0f ff 40 00          	ud0    0x0\(%rax\),%eax
  +[a-f0-9]+:	f3 0f 1e fa          	endbr64
  +[a-f0-9]+:	68 00 00 00 00       	push   \$0x0
  +[a-f0-9]+:	e9 e2 ff ff ff       	jmp    [a-f0-9]+ <.*>
@@ -26,12 +26,12 @@  Disassembly of section .plt.sec:
 [a-f0-9]+ <bar1@plt>:
  +[a-f0-9]+:	f3 0f 1e fa          	endbr64
  +[a-f0-9]+:	ff 25 ([0-9a-f]{2} ){4}[ 	]+jmp    \*0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <bar1>
- +[a-f0-9]+:	66 0f 1f 44 00 00    	nopw   0x0\(%rax,%rax,1\)
+ +[a-f0-9]+:	67 0f ff 44 00 00    	ud0    0x0\(%eax,%eax,1\),%eax
 
 [a-f0-9]+ <bar2@plt>:
  +[a-f0-9]+:	f3 0f 1e fa          	endbr64
  +[a-f0-9]+:	ff 25 ([0-9a-f]{2} ){4}[ 	]+jmp    \*0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <bar2>
- +[a-f0-9]+:	66 0f 1f 44 00 00    	nopw   0x0\(%rax,%rax,1\)
+ +[a-f0-9]+:	67 0f ff 44 00 00    	ud0    0x0\(%eax,%eax,1\),%eax
 
 Disassembly of section .text:
 
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d b/ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d
index 0ba3d07adad..0eac387064d 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d
@@ -11,7 +11,7 @@  Disassembly of section .plt:
 0+140 <.plt>:
  +[a-f0-9]+:	ff 35 4a 01 20 00    	push   0x20014a\(%rip\)        # 200290 <_GLOBAL_OFFSET_TABLE_\+0x8>
  +[a-f0-9]+:	ff 25 4c 01 20 00    	jmp    \*0x20014c\(%rip\)        # 200298 <_GLOBAL_OFFSET_TABLE_\+0x10>
- +[a-f0-9]+:	0f 1f 40 00          	nopl   0x0\(%rax\)
+ +[a-f0-9]+:	0f ff 40 00          	ud0    0x0\(%rax\),%eax
  +[a-f0-9]+:	f3 0f 1e fa          	endbr64
  +[a-f0-9]+:	68 00 00 00 00       	push   \$0x0
  +[a-f0-9]+:	e9 e2 ff ff ff       	jmp    140 <bar1@plt-0x30>
@@ -26,12 +26,12 @@  Disassembly of section .plt.sec:
 0+170 <bar1@plt>:
  +[a-f0-9]+:	f3 0f 1e fa          	endbr64
  +[a-f0-9]+:	ff 25 26 01 20 00    	jmp    \*0x200126\(%rip\)        # 2002a0 <bar1>
- +[a-f0-9]+:	66 0f 1f 44 00 00    	nopw   0x0\(%rax,%rax,1\)
+ +[a-f0-9]+:	67 0f ff 44 00 00    	ud0    0x0\(%eax,%eax,1\),%eax
 
 0+180 <bar2@plt>:
  +[a-f0-9]+:	f3 0f 1e fa          	endbr64
  +[a-f0-9]+:	ff 25 1e 01 20 00    	jmp    \*0x20011e\(%rip\)        # 2002a8 <bar2>
- +[a-f0-9]+:	66 0f 1f 44 00 00    	nopw   0x0\(%rax,%rax,1\)
+ +[a-f0-9]+:	67 0f ff 44 00 00    	ud0    0x0\(%eax,%eax,1\),%eax
 
 Disassembly of section .text:
 
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-3a.d b/ld/testsuite/ld-x86-64/ibt-plt-3a.d
index 306592ac9cc..61d0412e9d9 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-3a.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-3a.d
@@ -11,7 +11,7 @@  Disassembly of section .plt:
 0+1f0 <.plt>:
  +[a-f0-9]+:	ff 35 ca 01 20 00    	push   0x2001ca\(%rip\)        # 2003c0 <_GLOBAL_OFFSET_TABLE_\+0x8>
  +[a-f0-9]+:	ff 25 cc 01 20 00    	jmp    \*0x2001cc\(%rip\)        # 2003c8 <_GLOBAL_OFFSET_TABLE_\+0x10>
- +[a-f0-9]+:	0f 1f 40 00          	nopl   0x0\(%rax\)
+ +[a-f0-9]+:	0f ff 40 00          	ud0    0x0\(%rax\),%eax
  +[a-f0-9]+:	f3 0f 1e fa          	endbr64
  +[a-f0-9]+:	68 00 00 00 00       	push   \$0x0
  +[a-f0-9]+:	e9 e2 ff ff ff       	jmp    1f0 <.*>
@@ -26,12 +26,12 @@  Disassembly of section .plt.sec:
 0+220 <bar1@plt>:
  +[a-f0-9]+:	f3 0f 1e fa          	endbr64
  +[a-f0-9]+:	ff 25 a6 01 20 00    	jmp    \*0x2001a6\(%rip\)        # 2003d0 <bar1>
- +[a-f0-9]+:	66 0f 1f 44 00 00    	nopw   0x0\(%rax,%rax,1\)
+ +[a-f0-9]+:	67 0f ff 44 00 00    	ud0    0x0\(%eax,%eax,1\),%eax
 
 0+230 <bar2@plt>:
  +[a-f0-9]+:	f3 0f 1e fa          	endbr64
  +[a-f0-9]+:	ff 25 9e 01 20 00    	jmp    \*0x20019e\(%rip\)        # 2003d8 <bar2>
- +[a-f0-9]+:	66 0f 1f 44 00 00    	nopw   0x0\(%rax,%rax,1\)
+ +[a-f0-9]+:	67 0f ff 44 00 00    	ud0    0x0\(%eax,%eax,1\),%eax
 
 Disassembly of section .text:
 
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-3c-x32.d b/ld/testsuite/ld-x86-64/ibt-plt-3c-x32.d
index d104d3d33ed..841e7656bc4 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-3c-x32.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-3c-x32.d
@@ -11,7 +11,7 @@  Disassembly of section .plt:
 [a-f0-9]+ <.plt>:
  +[a-f0-9]+:	ff 35 ([0-9a-f]{2} ){4}[ 	]+push   0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_GLOBAL_OFFSET_TABLE_\+0x8>
  +[a-f0-9]+:	ff 25 ([0-9a-f]{2} ){4}[ 	]+jmp    \*0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_GLOBAL_OFFSET_TABLE_\+0x10>
- +[a-f0-9]+:	0f 1f 40 00          	nopl   0x0\(%rax\)
+ +[a-f0-9]+:	0f ff 40 00          	ud0    0x0\(%rax\),%eax
  +[a-f0-9]+:	f3 0f 1e fa          	endbr64
  +[a-f0-9]+:	68 00 00 00 00       	push   \$0x0
  +[a-f0-9]+:	e9 e2 ff ff ff       	jmp    [a-f0-9]+ <bar1@plt-0x30>
@@ -26,12 +26,12 @@  Disassembly of section .plt.sec:
 [a-f0-9]+ <bar1@plt>:
  +[a-f0-9]+:	f3 0f 1e fa          	endbr64
  +[a-f0-9]+:	ff 25 ([0-9a-f]{2} ){4}[ 	]+jmp    \*0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <bar1>
- +[a-f0-9]+:	66 0f 1f 44 00 00    	nopw   0x0\(%rax,%rax,1\)
+ +[a-f0-9]+:	67 0f ff 44 00 00    	ud0    0x0\(%eax,%eax,1\),%eax
 
 [a-f0-9]+ <bar2@plt>:
  +[a-f0-9]+:	f3 0f 1e fa          	endbr64
  +[a-f0-9]+:	ff 25 ([0-9a-f]{2} ){4}[ 	]+jmp    \*0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <bar2>
- +[a-f0-9]+:	66 0f 1f 44 00 00    	nopw   0x0\(%rax,%rax,1\)
+ +[a-f0-9]+:	67 0f ff 44 00 00    	ud0    0x0\(%eax,%eax,1\),%eax
 
 Disassembly of section .text:
 
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-3c.d b/ld/testsuite/ld-x86-64/ibt-plt-3c.d
index 8be6783efcb..dbe149ea1b3 100644
--- a/ld/testsuite/ld-x86-64/ibt-plt-3c.d
+++ b/ld/testsuite/ld-x86-64/ibt-plt-3c.d
@@ -11,7 +11,7 @@  Disassembly of section .plt:
 [a-f0-9]+ <.plt>:
  +[a-f0-9]+:	ff 35 ([0-9a-f]{2} ){4}[ 	]+push   0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_GLOBAL_OFFSET_TABLE_\+0x8>
  +[a-f0-9]+:	ff 25 ([0-9a-f]{2} ){4}[ 	]+jmp    \*0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_GLOBAL_OFFSET_TABLE_\+0x10>
- +[a-f0-9]+:	0f 1f 40 00          	nopl   0x0\(%rax\)
+ +[a-f0-9]+:	0f ff 40 00          	ud0    0x0\(%rax\),%eax
  +[a-f0-9]+:	f3 0f 1e fa          	endbr64
  +[a-f0-9]+:	68 00 00 00 00       	push   \$0x0
  +[a-f0-9]+:	e9 e2 ff ff ff       	jmp    [a-f0-9]+ <.*>
@@ -26,12 +26,12 @@  Disassembly of section .plt.sec:
 [a-f0-9]+ <bar1@plt>:
  +[a-f0-9]+:	f3 0f 1e fa          	endbr64
  +[a-f0-9]+:	ff 25 ([0-9a-f]{2} ){4}[ 	]+jmp    \*0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <bar1>
- +[a-f0-9]+:	66 0f 1f 44 00 00    	nopw   0x0\(%rax,%rax,1\)
+ +[a-f0-9]+:	67 0f ff 44 00 00    	ud0    0x0\(%eax,%eax,1\),%eax
 
 [a-f0-9]+ <bar2@plt>:
  +[a-f0-9]+:	f3 0f 1e fa          	endbr64
  +[a-f0-9]+:	ff 25 ([0-9a-f]{2} ){4}[ 	]+jmp    \*0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <bar2>
- +[a-f0-9]+:	66 0f 1f 44 00 00    	nopw   0x0\(%rax,%rax,1\)
+ +[a-f0-9]+:	67 0f ff 44 00 00    	ud0    0x0\(%eax,%eax,1\),%eax
 
 Disassembly of section .text:
 
diff --git a/ld/testsuite/ld-x86-64/mark-plt-1d-x32.d b/ld/testsuite/ld-x86-64/mark-plt-1d-x32.d
index 82642056bfc..6494c259463 100644
--- a/ld/testsuite/ld-x86-64/mark-plt-1d-x32.d
+++ b/ld/testsuite/ld-x86-64/mark-plt-1d-x32.d
@@ -7,7 +7,7 @@ 
 0+1020 <bar@plt>:
  +1020:	f3 0f 1e fa          	endbr64
  +1024:	ff 25 86 10 00 00    	jmp    \*0x1086\(%rip\)        # 20b0 <bar>
- +102a:	66 0f 1f 44 00 00    	nopw   0x0\(%rax,%rax,1\)
+ +102a:	67 0f ff 44 00 00    	ud0    0x0\(%eax,%eax,1\),%eax
 
 Disassembly of section .text:
 
diff --git a/ld/testsuite/ld-x86-64/mark-plt-1d.d b/ld/testsuite/ld-x86-64/mark-plt-1d.d
index a4155b2e067..5c1a1485f14 100644
--- a/ld/testsuite/ld-x86-64/mark-plt-1d.d
+++ b/ld/testsuite/ld-x86-64/mark-plt-1d.d
@@ -7,7 +7,7 @@ 
 0+1020 <bar@plt>:
  +1020:	f3 0f 1e fa          	endbr64
  +1024:	ff 25 1e 11 00 00    	jmp    \*0x111e\(%rip\)        # 2148 <bar>
- +102a:	66 0f 1f 44 00 00    	nopw   0x0\(%rax,%rax,1\)
+ +102a:	67 0f ff 44 00 00    	ud0    0x0\(%eax,%eax,1\),%eax
 
 Disassembly of section .text:
 
diff --git a/ld/testsuite/ld-x86-64/plt.pd b/ld/testsuite/ld-x86-64/plt.pd
index 6b4024c5c93..6e2f07e37c8 100644
--- a/ld/testsuite/ld-x86-64/plt.pd
+++ b/ld/testsuite/ld-x86-64/plt.pd
@@ -11,7 +11,7 @@  Disassembly of section .plt:
 [0-9a-f]+ <fn1@plt-0x10>:
  +[0-9a-f]+:	ff 35 ([0-9a-f]{2} ){4} *	push   0x[0-9a-f]+\(%rip\) +# [0-9a-f]+ <_GLOBAL_OFFSET_TABLE_\+0x8>
  +[0-9a-f]+:	ff 25 ([0-9a-f]{2} ){4} *	jmp    \*0x[0-9a-f]+\(%rip\) +# [0-9a-f]+ <_GLOBAL_OFFSET_TABLE_\+0x10>
- +[0-9a-f]+:	0f 1f 40 00          	nopl   0x0\(%rax\)
+ +[a-f0-9]+:	0f ff 40 00          	ud0    0x0\(%rax\),%eax
 
 [0-9a-f]+ <fn1@plt>:
  +[0-9a-f]+:	ff 25 ([0-9a-f]{2} ){4} *	jmp    \*0x[0-9a-f]+\(%rip\) +# [0-9a-f]+ <fn1>
diff --git a/ld/testsuite/ld-x86-64/plt2.dd b/ld/testsuite/ld-x86-64/plt2.dd
index 454bc060dd4..93573ce9aa7 100644
--- a/ld/testsuite/ld-x86-64/plt2.dd
+++ b/ld/testsuite/ld-x86-64/plt2.dd
@@ -12,7 +12,7 @@  Disassembly of section .plt:
 0+400220 <fn1@plt-0x10>:
  +[a-f0-9]+:	ff 35 7a 01 20 00    	push   0x20017a\(%rip\)        # 6003a0 <_GLOBAL_OFFSET_TABLE_\+0x8>
  +[a-f0-9]+:	ff 25 7c 01 20 00    	jmp    \*0x20017c\(%rip\)        # 6003a8 <_GLOBAL_OFFSET_TABLE_\+0x10>
- +[a-f0-9]+:	0f 1f 40 00          	nopl   0x0\(%rax\)
+ +[a-f0-9]+:	0f ff 40 00          	ud0    0x0\(%rax\),%eax
 
 0+400230 <fn1@plt>:
  +[a-f0-9]+:	ff 25 7a 01 20 00    	jmp    \*0x20017a\(%rip\)        # 6003b0 <fn1>
diff --git a/ld/testsuite/ld-x86-64/pr19636-2d.d b/ld/testsuite/ld-x86-64/pr19636-2d.d
index 75c87871684..2ed9dc680cf 100644
--- a/ld/testsuite/ld-x86-64/pr19636-2d.d
+++ b/ld/testsuite/ld-x86-64/pr19636-2d.d
@@ -11,7 +11,7 @@  Disassembly of section .plt:
 0+120 <.plt>:
 [ 	]*[a-f0-9]+:	ff 35 2a 01 20 00    	push   0x20012a\(%rip\)        # 200250 <_GLOBAL_OFFSET_TABLE_\+0x8>
 [ 	]*[a-f0-9]+:	ff 25 2c 01 20 00    	jmp    \*0x20012c\(%rip\)        # 200258 <_GLOBAL_OFFSET_TABLE_\+0x10>
-[ 	]*[a-f0-9]+:	0f 1f 40 00          	nopl   0x0\(%rax\)
+[ 	]*[a-f0-9]+:	0f ff 40 00          	ud0    0x0\(%rax\),%eax
 [ 	]*[a-f0-9]+:	ff 25 2a 01 20 00    	jmp    \*0x20012a\(%rip\)        # 200260 <_GLOBAL_OFFSET_TABLE_\+0x18>
 [ 	]*[a-f0-9]+:	68 00 00 00 00       	push   \$0x0+
 [ 	]*[a-f0-9]+:	e9 00 00 00 00       	jmp    [a-f0-9]+ <.*>
diff --git a/ld/testsuite/ld-x86-64/pr19636-2l.d b/ld/testsuite/ld-x86-64/pr19636-2l.d
index 3cb00d7aac1..c18621f6a6b 100644
--- a/ld/testsuite/ld-x86-64/pr19636-2l.d
+++ b/ld/testsuite/ld-x86-64/pr19636-2l.d
@@ -12,7 +12,7 @@  Disassembly of section .plt:
 0+120 <.plt>:
  +[a-f0-9]+:	ff 35 2a 01 20 00    	push   0x20012a\(%rip\)        # 200250 <_GLOBAL_OFFSET_TABLE_\+0x8>
  +[a-f0-9]+:	ff 25 2c 01 20 00    	jmp    \*0x20012c\(%rip\)        # 200258 <_GLOBAL_OFFSET_TABLE_\+0x10>
- +[a-f0-9]+:	0f 1f 40 00          	nopl   0x0\(%rax\)
+ +[a-f0-9]+:	0f ff 40 00          	ud0    0x0\(%rax\),%eax
  +[a-f0-9]+:	ff 25 2a 01 20 00    	jmp    \*0x20012a\(%rip\)        # 200260 <_GLOBAL_OFFSET_TABLE_\+0x18>
  +[a-f0-9]+:	68 00 00 00 00       	push   \$0x0
  +[a-f0-9]+:	e9 00 00 00 00       	jmp    140 <_start>
diff --git a/ld/testsuite/ld-x86-64/pr20830a-now.d b/ld/testsuite/ld-x86-64/pr20830a-now.d
index 28f595f1c83..a09dce57437 100644
--- a/ld/testsuite/ld-x86-64/pr20830a-now.d
+++ b/ld/testsuite/ld-x86-64/pr20830a-now.d
@@ -52,13 +52,13 @@  Disassembly of section .plt:
 0+1b0 <.plt>:
  +[a-f0-9]+:	ff 35 32 fe 3f 00    	push   0x3ffe32\(%rip\)        # 3fffe8 <_GLOBAL_OFFSET_TABLE_\+0x8>
  +[a-f0-9]+:	ff 25 34 fe 3f 00    	jmp    \*0x3ffe34\(%rip\)        # 3ffff0 <_GLOBAL_OFFSET_TABLE_\+0x10>
- +[a-f0-9]+:	0f 1f 40 00          	nopl   0x0\(%rax\)
+ +[a-f0-9]+:	0f ff 40 00          	ud0    0x0\(%rax\),%eax
 
 Disassembly of section .plt.got:
 
 0+1c0 <func@plt>:
  +[a-f0-9]+:	ff 25 32 fe 3f 00    	jmp    \*0x3ffe32\(%rip\)        # 3ffff8 <func>
- +[a-f0-9]+:	66 90                	xchg   %ax,%ax
+ +[a-f0-9]+:	0f 0b                	ud2
 
 Disassembly of section .text:
 
diff --git a/ld/testsuite/ld-x86-64/pr20830a.d b/ld/testsuite/ld-x86-64/pr20830a.d
index 1d92b10ba71..8610e07edf4 100644
--- a/ld/testsuite/ld-x86-64/pr20830a.d
+++ b/ld/testsuite/ld-x86-64/pr20830a.d
@@ -52,13 +52,13 @@  Disassembly of section .plt:
 0+1b0 <.plt>:
  +[a-f0-9]+:	ff 35 3a fe 3f 00    	push   0x3ffe3a\(%rip\)        # 3ffff0 <_GLOBAL_OFFSET_TABLE_\+0x8>
  +[a-f0-9]+:	ff 25 3c fe 3f 00    	jmp    \*0x3ffe3c\(%rip\)        # 3ffff8 <_GLOBAL_OFFSET_TABLE_\+0x10>
- +[a-f0-9]+:	0f 1f 40 00          	nopl   0x0\(%rax\)
+ +[a-f0-9]+:	0f ff 40 00          	ud0    0x0\(%rax\),%eax
 
 Disassembly of section .plt.got:
 
 0+1c0 <func@plt>:
  +[a-f0-9]+:	ff 25 1a fe 3f 00    	jmp    \*0x3ffe1a\(%rip\)        # 3fffe0 <func>
- +[a-f0-9]+:	66 90                	xchg   %ax,%ax
+ +[a-f0-9]+:	0f 0b                	ud2
 
 Disassembly of section .text:
 
diff --git a/ld/testsuite/ld-x86-64/pr20830b-now.d b/ld/testsuite/ld-x86-64/pr20830b-now.d
index 2cad0234853..163cbc9b15e 100644
--- a/ld/testsuite/ld-x86-64/pr20830b-now.d
+++ b/ld/testsuite/ld-x86-64/pr20830b-now.d
@@ -44,13 +44,13 @@  Disassembly of section .plt:
 0+120 <.plt>:
  +[a-f0-9]+:	ff 35 c2 fe 3f 00    	push   0x3ffec2\(%rip\)        # 3fffe8 <_GLOBAL_OFFSET_TABLE_\+0x8>
  +[a-f0-9]+:	ff 25 c4 fe 3f 00    	jmp    \*0x3ffec4\(%rip\)        # 3ffff0 <_GLOBAL_OFFSET_TABLE_\+0x10>
- +[a-f0-9]+:	0f 1f 40 00          	nopl   0x0\(%rax\)
+ +[a-f0-9]+:	0f ff 40 00          	ud0    0x0\(%rax\),%eax
 
 Disassembly of section .plt.got:
 
 0+130 <func@plt>:
  +[a-f0-9]+:	ff 25 c2 fe 3f 00    	jmp    \*0x3ffec2\(%rip\)        # 3ffff8 <func>
- +[a-f0-9]+:	66 90                	xchg   %ax,%ax
+ +[a-f0-9]+:	0f 0b                	ud2
 
 Disassembly of section .text:
 
diff --git a/ld/testsuite/ld-x86-64/pr20830b.d b/ld/testsuite/ld-x86-64/pr20830b.d
index 303a0242573..238c0835256 100644
--- a/ld/testsuite/ld-x86-64/pr20830b.d
+++ b/ld/testsuite/ld-x86-64/pr20830b.d
@@ -44,13 +44,13 @@  Disassembly of section .plt:
 0+120 <.plt>:
  +[a-f0-9]+:	ff 35 ca fe 3f 00    	push   0x3ffeca\(%rip\)        # 3ffff0 <_GLOBAL_OFFSET_TABLE_\+0x8>
  +[a-f0-9]+:	ff 25 cc fe 3f 00    	jmp    \*0x3ffecc\(%rip\)        # 3ffff8 <_GLOBAL_OFFSET_TABLE_\+0x10>
- +[a-f0-9]+:	0f 1f 40 00          	nopl   0x0\(%rax\)
+ +[a-f0-9]+:	0f ff 40 00          	ud0    0x0\(%rax\),%eax
 
 Disassembly of section .plt.got:
 
 0+130 <func@plt>:
  +[a-f0-9]+:	ff 25 aa fe 3f 00    	jmp    \*0x3ffeaa\(%rip\)        # 3fffe0 <func>
- +[a-f0-9]+:	66 90                	xchg   %ax,%ax
+ +[a-f0-9]+:	0f 0b                	ud2
 
 Disassembly of section .text:
 
diff --git a/ld/testsuite/ld-x86-64/tlsdesc.pd b/ld/testsuite/ld-x86-64/tlsdesc.pd
index 7e124ea32e5..596b1bb3f07 100644
--- a/ld/testsuite/ld-x86-64/tlsdesc.pd
+++ b/ld/testsuite/ld-x86-64/tlsdesc.pd
@@ -12,7 +12,7 @@  Disassembly of section .plt:
 [0-9a-f]+ <.plt>:
  [0-9a-f]+:	ff 35 .. .. 20 00    	push   .*\(%rip\)        # 201328 <_GLOBAL_OFFSET_TABLE_\+0x8>
  [0-9a-f]+:	ff 25 .. .. 20 00    	jmp    \*.*\(%rip\)        # 201330 <_GLOBAL_OFFSET_TABLE_\+0x10>
- [0-9a-f]+:	0f 1f 40 00          	nopl   0x0\(%rax\)
+ [0-9a-f]+:	0f ff 40 00          	ud0    0x0\(%rax\),%eax
  [0-9a-f]+:	f3 0f 1e fa          	endbr64
  [0-9a-f]+:	ff 35 .. .. 20 00    	push   .*\(%rip\)        # 201328 <_GLOBAL_OFFSET_TABLE_\+0x8>
  [0-9a-f]+:	ff 25 .. .. 20 00    	jmp    \*.*\(%rip\)        # 201318 <.*>
-- 
2.55.0