This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb/binutils-2_31-branch] [ARC] Fixed issue with DTSOFF relocs.


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

commit 7b39c09faf95961ac141960a3449c0960a43e96b
Author: Cupertino Miranda <cmiranda@synopsys.com>
Date:   Thu Sep 6 00:50:35 2018 +0100

    [ARC] Fixed issue with DTSOFF relocs.
    
    Inserted offset in final section in the GOT entry of type DTSOFF soon to be
    relocated by the dynamic loader.
    
    bfd/
    2018-09-06  Cupertino Miranda <cmiranda@synopsys.com>
    
    	* arc-got.h (relocate_fix_got_relocs_for_got_info): Changed. Take TLS
    	    section alignment in consideration for this relocation.
    	* elf32-arc.c (FINAL_SECTSTART): Added this formula macro.
    	  (ARC_TLS_DTPOFF) Updated reloc to use new created macro instead.

Diff:
---
 bfd/ChangeLog             | 12 +++++++++---
 bfd/arc-got.h             | 10 +++++++---
 bfd/elf32-arc.c           |  2 ++
 include/elf/arc-reloc.def |  2 +-
 4 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index b26e531..896adc8 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,26 +1,32 @@
 2018-11-15  Claudiu Zissulescu  <claziss@synopsys.com>
 
 	Backport from mainline
+	2018-09-06  Cupertino Miranda <cmiranda@synopsys.com>
+	* arc-got.h (relocate_fix_got_relocs_for_got_info): Changed. Take
+	TLS section alignment in consideration for this relocation.
+	* elf32-arc.c (FINAL_SECTSTART): Added this formula macro.
+	(ARC_TLS_DTPOFF) Updated reloc to use new created macro instead.
+
+2018-11-15  Claudiu Zissulescu  <claziss@synopsys.com>
+
+	Backport from mainline
 	2018-08-01  Cupertino Miranda <cmiranda@synopsys.com>
 	* arc-got.h (relocate_fix_got_relocs_for_got_info): Changed, fixed
 	TCB_SIZE offsize to include section alignment.
 	* elf32-arc.c (arc_special_overflow_checks): Likewise.
 
-
 2018-11-15  Claudiu Zissulescu  <claziss@synopsys.com>
 
 	Backport from mainline
 	2018-03-02  Cupertino Miranda <cmiranda@synopsys.com>
 	* elf32-arc.c (elf_arc_check_relocs): Changed.
 
-
 2018-11-15  Claudiu Zissulescu  <claziss@synopsys.com>
 
 	Backport from mainline
 	2018-03-02  Cupertino Miranda <cmiranda@synopsys.com>
 	* elf32-arc.c (elf_arc_check_relocs): Changed.
 
-
 2018-11-15  Claudiu Zissulescu  <claziss@synopsys.com>
 
 	Backport from mainline
diff --git a/bfd/arc-got.h b/bfd/arc-got.h
index e32d9b3..07722fd 100644
--- a/bfd/arc-got.h
+++ b/bfd/arc-got.h
@@ -335,7 +335,11 @@ relocate_fix_got_relocs_for_got_info (struct got_entry **	   list_p,
 		bfd_vma sec_vma = tls_sec->output_section->vma;
 
 		bfd_put_32 (output_bfd,
-			    sym_value - sec_vma,
+			    sym_value - sec_vma
+			    + (elf_hash_table (info)->dynamic_sections_created
+			       ? 0
+			       : (align_power (TCB_SIZE,
+					       tls_sec->alignment_power))),
 			    htab->sgot->contents + entry->offset
 			    + (entry->existing_entries == TLS_GOT_MOD_AND_OFF
 			       ? 4 : 0));
@@ -346,7 +350,7 @@ relocate_fix_got_relocs_for_got_info (struct got_entry **	   list_p,
 			    "GOT_TLS_IE"),
 			   (long) (sym_value - sec_vma),
 			   (long) (htab->sgot->output_section->vma
-			      + htab->sgot->output_offset->vma
+			      + htab->sgot->output_offset
 			      + entry->offset
 			      + (entry->existing_entries == TLS_GOT_MOD_AND_OFF
 				 ? 4 : 0)),
@@ -376,7 +380,7 @@ relocate_fix_got_relocs_for_got_info (struct got_entry **	   list_p,
 			    "GOT_TLS_IE"),
 			   (long) (sym_value - sec_vma),
 			   (long) (htab->sgot->output_section->vma
-			      + htab->sgot->output_offset->vma
+			      + htab->sgot->output_offset
 			      + entry->offset
 			      + (entry->existing_entries == TLS_GOT_MOD_AND_OFF
 				 ? 4 : 0)),
diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
index d11b773..5ef62aa 100644
--- a/bfd/elf32-arc.c
+++ b/bfd/elf32-arc.c
@@ -1198,6 +1198,8 @@ arc_special_overflow_checks (const struct arc_relocation_data reloc_data,
 	     + (reloc_data.reloc_offset))))
 #define SECTSTART (bfd_signed_vma) (reloc_data.sym_section->output_section->vma \
 				    + reloc_data.sym_section->output_offset)
+#define FINAL_SECTSTART \
+  (bfd_signed_vma) (reloc_data.sym_section->output_section->vma)
 #define JLI (bfd_signed_vma) (reloc_data.sym_section->output_section->vma)
 #define _SDA_BASE_ (bfd_signed_vma) (reloc_data.sdata_begin_symbol_vma)
 #define TLS_REL (bfd_signed_vma) \
diff --git a/include/elf/arc-reloc.def b/include/elf/arc-reloc.def
index e1c69c9..61edd6e 100644
--- a/include/elf/arc-reloc.def
+++ b/include/elf/arc-reloc.def
@@ -468,7 +468,7 @@ ARC_RELOC_HOWTO(ARC_TLS_DTPOFF, 67, \
                 32, \
                 replace_word32, \
                 dont, \
-                ( ME ( S - SECTSTART ) + A ))
+		( ME ( S - FINAL_SECTSTART ) + A ))
 
 ARC_RELOC_HOWTO(ARC_TLS_DTPOFF_S9, 73, \
                 2, \


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]