[binutils-gdb] Replace unworkable code in HPPA relocs handelr with an assertion.

Nick Clifton nickc@sourceware.org
Thu Aug 23 12:34:00 GMT 2018


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

commit 38cf70ca4d7adaad7ef085ce34e24e1e0bbee945
Author: Nick Clifton <nickc@redhat.com>
Date:   Thu Aug 23 13:34:14 2018 +0100

    Replace unworkable code in HPPA relocs handelr with an assertion.
    
    	* elf64-hppa.c (elf_hppa_final_link_relocate): Replace unworkable
    	code with an assertion.

Diff:
---
 bfd/ChangeLog    |  5 +++++
 bfd/elf64-hppa.c | 33 ++++++---------------------------
 2 files changed, 11 insertions(+), 27 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index ae37424..66eb071 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,10 @@
 2018-08-23  Nick Clifton  <nickc@redhat.com>
 
+	* elf64-hppa.c (elf_hppa_final_link_relocate): Replace unworkable
+	code with an assertion.
+
+2018-08-23  Nick Clifton  <nickc@redhat.com>
+
 	PR 23061
 	* coffgen.c (coff_pointerize_aux): Add table_end parameter.  Use
 	it to prevent walking off the end of the table.
diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c
index 2e66c92..b4f047f 100644
--- a/bfd/elf64-hppa.c
+++ b/bfd/elf64-hppa.c
@@ -3556,33 +3556,12 @@ elf_hppa_final_link_relocate (Elf_Internal_Rela *rel,
 
     case R_PARISC_LTOFF_FPTR32:
       {
-	/* We may still need to create the FPTR itself if it was for
-	   a local symbol.  */
-	if (hh == NULL)
-	  {
-	    /* The first two words of an .opd entry are zero.  */
-	    memset (hppa_info->opd_sec->contents + hh->opd_offset, 0, 16);
-
-	    /* The next word is the address of the function.  */
-	    bfd_put_64 (hppa_info->opd_sec->owner, value + addend,
-			(hppa_info->opd_sec->contents
-			 + hh->opd_offset + 16));
-
-	    /* The last word is our local __gp value.  */
-	    value = _bfd_get_gp_value
-		      (hppa_info->opd_sec->output_section->owner);
-	    bfd_put_64 (hppa_info->opd_sec->owner, value,
-			hppa_info->opd_sec->contents + hh->opd_offset + 24);
-
-	    /* The DLT value is the address of the .opd entry.  */
-	    value = (hh->opd_offset
-		     + hppa_info->opd_sec->output_offset
-		     + hppa_info->opd_sec->output_section->vma);
-
-	    bfd_put_64 (hppa_info->dlt_sec->owner,
-			value,
-			hppa_info->dlt_sec->contents + hh->dlt_offset);
-	  }
+	/* FIXME: There used to be code here to create the FPTR itself if
+	   the relocation was against a local symbol.  But the code could
+	   never have worked.  If the assert below is ever triggered then
+	   the code will need to be reinstated and fixed so that it does
+	   what is needed.  */
+	BFD_ASSERT (hh != NULL);
 
 	/* We want the value of the DLT offset for this symbol, not
 	   the symbol's actual address.  Note that __gp may not point



More information about the Binutils-cvs mailing list