[binutils-gdb] x86: Fix comment typos in TLS relocation check

H.J. Lu hjl@sourceware.org
Sat Aug 31 12:07:50 GMT 2024


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

commit 5a655b5291b3f56088409d34e9077e98af63de60
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sat Aug 31 04:56:48 2024 -0700

    x86: Fix comment typos in TLS relocation check
    
    R_386_TLS_IE is used only in
    
            movl foo@indntpoff, %eax
            movl foo@indntpoff, %reg
            addl foo@indntpoff, %reg
    
    R_386_TLS_DESC_CALL and R_X86_64_TLSDESC_CALL are used only in
    
            call *x@tlscall(%[er]ax)
    
            * elf32-i386.c (elf_i386_check_tls_transition): Use foo@indntpoff
            in comments for R_386_TLS_IE check.
            (elf_i386_tls_transition): Use @tlscall in comments for
            R_386_TLS_DESC_CALL check.
            * elf64-x86-64.c (elf_x86_64_tls_transition): Use @tlscall in
            comments for R_X86_64_TLSDESC_CALL check.
    
    Signed-off-by: H.J. Lu <hjl.tools@gmail.com>

Diff:
---
 bfd/elf32-i386.c   | 14 +++++++-------
 bfd/elf64-x86-64.c | 12 ++++++------
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index b1d997b86f0..f27c0621a93 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -975,15 +975,15 @@ elf_i386_check_tls_transition (asection *sec,
 
     case R_386_TLS_IE:
       /* Check transition from IE access model:
-		movl foo@indntpoff(%rip), %eax
-		movl foo@indntpoff(%rip), %reg
-		addl foo@indntpoff(%rip), %reg
+		movl foo@indntpoff, %eax
+		movl foo@indntpoff, %reg
+		addl foo@indntpoff, %reg
        */
 
       if (offset < 1 || (offset + 4) > sec->size)
 	return elf_x86_tls_error_yes;
 
-      /* Check "movl foo@tpoff(%rip), %eax" first.  */
+      /* Check "movl foo@indntpoff, %eax" first.  */
       val = bfd_get_8 (abfd, contents + offset - 1);
       if (val == 0xa1)
 	return elf_x86_tls_error_none;
@@ -991,7 +991,7 @@ elf_i386_check_tls_transition (asection *sec,
       if (offset < 2)
 	return elf_x86_tls_error_yes;
 
-      /* Check movl|addl foo@tpoff(%rip), %reg.   */
+      /* Check movl|addl foo@indntpoff, %reg.   */
       type = bfd_get_8 (abfd, contents + offset - 2);
       if (type != 0x8b && type != 0x03)
 	return elf_x86_tls_error_add_mov;
@@ -1091,13 +1091,13 @@ elf_i386_tls_transition (struct bfd_link_info *info, bfd *abfd,
     {
     case R_386_TLS_DESC_CALL:
       /* Check valid GDesc call:
-		call *x@tlsdesc(%eax)
+		call *x@tlscall(%eax)
        */
       offset = rel->r_offset;
       call = NULL;
       if (offset + 2 <= sec->size)
 	{
-	  /* Make sure that it's a call *x@tlsdesc(%eax).  */
+	  /* Make sure that it's a call *x@tlscall(%eax).  */
 	  call = contents + offset;
 	  if (call[0] != 0xff || call[1] != 0x10)
 	    call = NULL;
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index cef5cbb27fb..4330bbd1648 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -1448,8 +1448,8 @@ elf_x86_64_tls_transition (struct bfd_link_info *info, bfd *abfd,
     {
     case R_X86_64_TLSDESC_CALL:
       /* Check valid GDesc call:
-		call *x@tlsdesc(%rax) <--- LP64 mode.
-		call *x@tlsdesc(%eax) <--- X32 mode.
+		call *x@tlscall(%rax) <--- LP64 mode.
+		call *x@tlscall(%eax) <--- X32 mode.
        */
       offset = rel->r_offset;
       call = NULL;
@@ -1460,7 +1460,7 @@ elf_x86_64_tls_transition (struct bfd_link_info *info, bfd *abfd,
 	  prefix = 0;
 	  if (!ABI_64_P (abfd))
 	    {
-	      /* Check for call *x@tlsdesc(%eax).  */
+	      /* Check for call *x@tlscall(%eax).  */
 	      if (call[0] == 0x67)
 		{
 		  prefix = 1;
@@ -1469,7 +1469,7 @@ elf_x86_64_tls_transition (struct bfd_link_info *info, bfd *abfd,
 		}
 	    }
 
-	  /* Make sure that it's a call *x@tlsdesc(%rax).  */
+	  /* Make sure that it's a call *x@tlscall(%rax).  */
 	  if (call != NULL
 	      && (call[prefix] != 0xff || call[1 + prefix] != 0x10))
 	    call = NULL;
@@ -3842,7 +3842,7 @@ elf_x86_64_relocate_section (bfd *output_bfd,
 		  unsigned int prefix = 0;
 		  if (!ABI_64_P (input_bfd))
 		    {
-		      /* Check for call *x@tlsdesc(%eax).  */
+		      /* Check for call *x@tlscall(%eax).  */
 		      if (contents[roff] == 0x67)
 			prefix = 1;
 		    }
@@ -4302,7 +4302,7 @@ elf_x86_64_relocate_section (bfd *output_bfd,
 		  unsigned int prefix = 0;
 		  if (!ABI_64_P (input_bfd))
 		    {
-		      /* Check for call *x@tlsdesc(%eax).  */
+		      /* Check for call *x@tlscall(%eax).  */
 		      if (contents[roff] == 0x67)
 			prefix = 1;
 		    }


More information about the Binutils-cvs mailing list