]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
x86/APX: use CS: in place of ES: in @gotpcrel and @gottpoff relaxation
authorJan Beulich <jbeulich@suse.com>
Fri, 21 Feb 2025 09:23:21 +0000 (10:23 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 21 Feb 2025 09:23:21 +0000 (10:23 +0100)
H.J. requested this adjustment; I'm unaware of any specific technical
background.

bfd/elf64-x86-64.c
ld/testsuite/ld-x86-64/load3a.d
ld/testsuite/ld-x86-64/load3b.d
ld/testsuite/ld-x86-64/tlsbindesc.dd

index 0e360771d1291094dd4e0f42a918b221dac3541a..5accb752a43fd7ac0bf1a938944b8aa1203c542a 100644 (file)
@@ -2362,13 +2362,13 @@ elf_x86_64_convert_load_reloc (bfd *abfd,
 
       bfd_put_8 (abfd, opcode, contents + roff - 2);
 
-      /* For MOVRS zap the 0f38 or EVEX prefix, applying meaningless ES
+      /* For MOVRS zap the 0f38 or EVEX prefix, applying meaningless CS
         segment overrides instead.  When necessary also install the REX2
         prefix and payload (which may not have been written yet).  */
       if (movrs)
        {
-         bfd_put_8 (abfd, 0x26, contents + roff - movrs);
-         bfd_put_8 (abfd, 0x26, contents + roff - movrs + 1);
+         bfd_put_8 (abfd, 0x2e, contents + roff - movrs);
+         bfd_put_8 (abfd, 0x2e, contents + roff - movrs + 1);
          if (movrs == 6)
            {
              bfd_put_8 (abfd, 0xd5, contents + roff - 4);
@@ -4361,11 +4361,11 @@ elf_x86_64_relocate_section (bfd *output_bfd,
                     byte.  */
                  if (type == 0x8b)
                    {
-                     /* For MOVRS emit meaningless ES prefixes.  */
+                     /* For MOVRS emit meaningless CS prefixes.  */
                      if (bfd_get_8 (input_bfd, contents + roff - 4) == 0x0f)
                        {
-                         bfd_put_8 (output_bfd, 0x26, contents + roff - 4);
-                         rex2 = 0x26;
+                         bfd_put_8 (output_bfd, 0x2e, contents + roff - 4);
+                         rex2 = 0x2e;
                          rex2_mask = 0;
                        }
                      type = 0xc7;
@@ -4403,10 +4403,10 @@ elf_x86_64_relocate_section (bfd *output_bfd,
                  unsigned int reg = bfd_get_8 (input_bfd, contents + roff - 1);
                  reg >>= 3;
 
-                 /* Replace 0f38 by meaningless ES prefixes, shifting the REX
+                 /* Replace 0f38 by meaningless CS prefixes, shifting the REX
                     prefix forward.  */
-                 bfd_put_8 (output_bfd, 0x26, contents + roff - 5);
-                 bfd_put_8 (output_bfd, 0x26, contents + roff - 4);
+                 bfd_put_8 (output_bfd, 0x2e, contents + roff - 5);
+                 bfd_put_8 (output_bfd, 0x2e, contents + roff - 4);
                  bfd_put_8 (output_bfd, rex, contents + roff - 3);
                  bfd_put_8 (output_bfd, 0xc7, contents + roff - 2);
                  bfd_put_8 (output_bfd, 0xc0 | reg, contents + roff - 1);
@@ -4455,8 +4455,8 @@ elf_x86_64_relocate_section (bfd *output_bfd,
                        rex2 |= REX_W;
 
 
-                     bfd_put_8 (output_bfd, 0x26, contents + roff - 6);
-                     bfd_put_8 (output_bfd, 0x26, contents + roff - 5);
+                     bfd_put_8 (output_bfd, 0x2e, contents + roff - 6);
+                     bfd_put_8 (output_bfd, 0x2e, contents + roff - 5);
                      bfd_put_8 (output_bfd, 0xd5, contents + roff - 4);
                      bfd_put_8 (output_bfd, rex2, contents + roff - 3);
                      bfd_put_8 (output_bfd, 0xc7, contents + roff - 2);
index 0feee16785d1866b074d0873e5c5551aae2d5da5..e9323594388bded8007ea7f1e0b9919a7ab279bd 100644 (file)
@@ -10,12 +10,12 @@ Disassembly of section .text:
 
 #...
 [a-f0-9]+ <_start>:
-[      ]*[a-f0-9]+:    26 26 c7 c0 ([0-9a-f]{2} ){4} * (es ){2}mov \$0x[a-f0-9]+,%eax
-[      ]*[a-f0-9]+:    26 26 41 c7 c3 ([0-9a-f]{2} ){4} *      (es ){2}mov \$0x[a-f0-9]+,%r11d
-[      ]*[a-f0-9]+:    26 26 d5 10 c7 c5 ([0-9a-f]{2} ){4} *   (es ){2}mov \$0x[a-f0-9]+,%r21d
-[      ]*[a-f0-9]+:    26 26 48 c7 c0 ([0-9a-f]{2} ){4} *      (es ){2}mov \$0x[a-f0-9]+,%rax
-[      ]*[a-f0-9]+:    26 26 49 c7 c3 ([0-9a-f]{2} ){4} *      (es ){2}mov \$0x[a-f0-9]+,%r11
-[      ]*[a-f0-9]+:    26 26 d5 18 c7 c5 ([0-9a-f]{2} ){4} *   (es ){2}mov \$0x[a-f0-9]+,%r21
-[      ]*[a-f0-9]+:    26 26 48 c7 c0 ([0-9a-f]{2} ){4} *      (es ){2}mov \$0x[a-f0-9]+,%rax
-[      ]*[a-f0-9]+:    26 26 49 c7 c3 ([0-9a-f]{2} ){4} *      (es ){2}mov \$0x[a-f0-9]+,%r11
+[      ]*[a-f0-9]+:    2e 2e c7 c0 ([0-9a-f]{2} ){4} * (cs ){2}mov \$0x[a-f0-9]+,%eax
+[      ]*[a-f0-9]+:    2e 2e 41 c7 c3 ([0-9a-f]{2} ){4} *      (cs ){2}mov \$0x[a-f0-9]+,%r11d
+[      ]*[a-f0-9]+:    2e 2e d5 10 c7 c5 ([0-9a-f]{2} ){4} *   (cs ){2}mov \$0x[a-f0-9]+,%r21d
+[      ]*[a-f0-9]+:    2e 2e 48 c7 c0 ([0-9a-f]{2} ){4} *      (cs ){2}mov \$0x[a-f0-9]+,%rax
+[      ]*[a-f0-9]+:    2e 2e 49 c7 c3 ([0-9a-f]{2} ){4} *      (cs ){2}mov \$0x[a-f0-9]+,%r11
+[      ]*[a-f0-9]+:    2e 2e d5 18 c7 c5 ([0-9a-f]{2} ){4} *   (cs ){2}mov \$0x[a-f0-9]+,%r21
+[      ]*[a-f0-9]+:    2e 2e 48 c7 c0 ([0-9a-f]{2} ){4} *      (cs ){2}mov \$0x[a-f0-9]+,%rax
+[      ]*[a-f0-9]+:    2e 2e 49 c7 c3 ([0-9a-f]{2} ){4} *      (cs ){2}mov \$0x[a-f0-9]+,%r11
 #pass
index f555fcbc1d931421abad9396964c536126572adc..d38f9e227f8ede22022cdfdb262f911eaf64f685 100644 (file)
@@ -10,12 +10,12 @@ Disassembly of section .text:
 
 #...
 [a-f0-9]+ <_start>:
-[      ]*[a-f0-9]+:    26 26 8d 05 ([0-9a-f]{2} ){4} * (es ){2}lea -0x[a-f0-9]+\(%rip\),%eax        # [a-f0-9]+ <foo>
-[      ]*[a-f0-9]+:    26 26 44 8d 1d ([0-9a-f]{2} ){4} *      (es ){2}lea 0x[a-f0-9]+\(%rip\),%r11d        # [a-f0-9]+ <bar>
-[      ]*[a-f0-9]+:    26 26 d5 40 8d 2d ([0-9a-f]{2} ){4} *   (es ){2}lea 0x[a-f0-9]+\(%rip\),%r21d        # [a-f0-9]+ <bar>
-[      ]*[a-f0-9]+:    26 26 48 8d 05 ([0-9a-f]{2} ){4} *      (es ){2}lea -0x[a-f0-9]+\(%rip\),%rax        # [a-f0-9]+ <foo>
-[      ]*[a-f0-9]+:    26 26 4c 8d 1d ([0-9a-f]{2} ){4} *      (es ){2}lea 0x[a-f0-9]+\(%rip\),%r11        # [a-f0-9]+ <bar>
-[      ]*[a-f0-9]+:    26 26 d5 48 8d 2d ([0-9a-f]{2} ){4} *   (es ){2}lea 0x[a-f0-9]+\(%rip\),%r21        # [a-f0-9]+ <bar>
-[      ]*[a-f0-9]+:    26 26 48 8d 05 ([0-9a-f]{2} ){4} *      (es ){2}lea 0x[a-f0-9]+\(%rip\),%rax        # [a-f0-9]+ <__start_my_section>
-[      ]*[a-f0-9]+:    26 26 4c 8d 1d ([0-9a-f]{2} ){4} *      (es ){2}lea 0x[a-f0-9]+\(%rip\),%r11        # [a-f0-9]+ <(__stop_my_section|pad)>
+[      ]*[a-f0-9]+:    2e 2e 8d 05 ([0-9a-f]{2} ){4} * (cs ){2}lea -0x[a-f0-9]+\(%rip\),%eax        # [a-f0-9]+ <foo>
+[      ]*[a-f0-9]+:    2e 2e 44 8d 1d ([0-9a-f]{2} ){4} *      (cs ){2}lea 0x[a-f0-9]+\(%rip\),%r11d        # [a-f0-9]+ <bar>
+[      ]*[a-f0-9]+:    2e 2e d5 40 8d 2d ([0-9a-f]{2} ){4} *   (cs ){2}lea 0x[a-f0-9]+\(%rip\),%r21d        # [a-f0-9]+ <bar>
+[      ]*[a-f0-9]+:    2e 2e 48 8d 05 ([0-9a-f]{2} ){4} *      (cs ){2}lea -0x[a-f0-9]+\(%rip\),%rax        # [a-f0-9]+ <foo>
+[      ]*[a-f0-9]+:    2e 2e 4c 8d 1d ([0-9a-f]{2} ){4} *      (cs ){2}lea 0x[a-f0-9]+\(%rip\),%r11        # [a-f0-9]+ <bar>
+[      ]*[a-f0-9]+:    2e 2e d5 48 8d 2d ([0-9a-f]{2} ){4} *   (cs ){2}lea 0x[a-f0-9]+\(%rip\),%r21        # [a-f0-9]+ <bar>
+[      ]*[a-f0-9]+:    2e 2e 48 8d 05 ([0-9a-f]{2} ){4} *      (cs ){2}lea 0x[a-f0-9]+\(%rip\),%rax        # [a-f0-9]+ <__start_my_section>
+[      ]*[a-f0-9]+:    2e 2e 4c 8d 1d ([0-9a-f]{2} ){4} *      (cs ){2}lea 0x[a-f0-9]+\(%rip\),%r11        # [a-f0-9]+ <(__stop_my_section|pad)>
 #pass
index ae10e8f817083ab9d3e85050a4c97f48bbc4542f..72757bab143e06957b9d14524c5c651cd333e0cf 100644 (file)
@@ -256,18 +256,18 @@ Disassembly of section .text:
  +[0-9a-f]+:   d5 18 c7 c5 90 ff ff[   ]+mov    \$0xf+90,%r21
 #                                                      sl5
  +[0-9a-f]+:   ff *
- +[0-9a-f]+:   26 26 49 c7 c3 90 ff[   ]+(es ){2}mov \$0xf+90,%r11
+ +[0-9a-f]+:   2e 2e 49 c7 c3 90 ff[   ]+(cs ){2}mov \$0xf+90,%r11
 #                                                      sl5
  +[0-9a-f]+:   ff ff *
- +[0-9a-f]+:   26 26 d5 18 c7 c5 90[   ]+(es ){2}mov \$0xf+90,%r21
+ +[0-9a-f]+:   2e 2e d5 18 c7 c5 90[   ]+(cs ){2}mov \$0xf+90,%r21
 #                                                      sl5
  +[0-9a-f]+:   ff ff ff *
 #  IE->LE against hidden var
  +[0-9a-f]+:   d5 18 c7 c6 b0 ff ff[   ]+mov    \$0xf+b0,%r22
  +[0-9a-f]+:   ff *
- +[0-9a-f]+:   26 26 49 c7 c4 b0 ff[   ]+(es ){2}mov \$0xf+b0,%r12
+ +[0-9a-f]+:   2e 2e 49 c7 c4 b0 ff[   ]+(cs ){2}mov \$0xf+b0,%r12
  +[0-9a-f]+:   ff ff *
- +[0-9a-f]+:   26 26 d5 18 c7 c6 b0[   ]+(es ){2}mov \$0xf+b0,%r22
+ +[0-9a-f]+:   2e 2e d5 18 c7 c6 b0[   ]+(cs ){2}mov \$0xf+b0,%r22
  +[0-9a-f]+:   ff ff ff *
 #  GD -> IE because variable is not defined in executable
  +[0-9a-f]+:   d5 48 8b 05 ([0-9a-f]{2} ){3}[  ]+mov    0x[0-9a-f]+\(%rip\),%r16 +# [0-9a-f]+ <sG1>