This is the mail archive of the binutils@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]

[GOLD] Add reloc_count param to Relocate::relocate


This is to support peeking at the next reloc.  OK?

Following patches will make use of this on PowerPC64, to check whether
an R_PPC64_TOCSAVE reloc follows a relocation on a call.

	* target-reloc.h (relocate_section): Pass reloc_count to relocate().
	(apply_relocation): Similarly, but pass 0.
	* aarch64.cc (Target_aarch64::Relocate::relocate): Add ignored
	reloc_count param.
	* arm.cc (Target_arm::Relocate::relocate): Likewise.
	* i386.cc (Target_i386::Relocate::relocate): Likewise.
	* mips.cc (Target_mips::Relocate::relocate): Likewise.
	* powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
	* s390.cc (Target_s390::Relocate::relocate): Likewise.
	* sparc.cc (Target_sparc::Relocate::relocate): Likewise.
	* tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
	* x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.

diff --git a/gold/aarch64.cc b/gold/aarch64.cc
index 11bb48e..bf8b2d7 100644
--- a/gold/aarch64.cc
+++ b/gold/aarch64.cc
@@ -3208,7 +3208,8 @@ class Target_aarch64 : public Sized_target<size, big_endian>
     // any warnings about this relocation.
     inline bool
     relocate(const Relocate_info<size, big_endian>*, unsigned int,
-	     Target_aarch64*, Output_section*, size_t, const unsigned char*,
+	     Target_aarch64*, Output_section*,
+	     size_t, size_t, const unsigned char*,
 	     const Sized_symbol<size>*, const Symbol_value<size>*,
 	     unsigned char*, typename elfcpp::Elf_types<size>::Elf_Addr,
 	     section_size_type);
@@ -6921,6 +6922,7 @@ Target_aarch64<size, big_endian>::Relocate::relocate(
     Target_aarch64<size, big_endian>* target,
     Output_section* ,
     size_t relnum,
+    size_t,
     const unsigned char* preloc,
     const Sized_symbol<size>* gsym,
     const Symbol_value<size>* psymval,
diff --git a/gold/arm.cc b/gold/arm.cc
index ff472ea..60bad35 100644
--- a/gold/arm.cc
+++ b/gold/arm.cc
@@ -2718,7 +2718,8 @@ class Target_arm : public Sized_target<32, big_endian>
     // any warnings about this relocation.
     inline bool
     relocate(const Relocate_info<32, big_endian>*, unsigned int,
-	     Target_arm*, Output_section*, size_t, const unsigned char*,
+	     Target_arm*, Output_section*,
+	     size_t, size_t, const unsigned char*,
 	     const Sized_symbol<32>*, const Symbol_value<32>*,
 	     unsigned char*, Arm_address, section_size_type);
 
@@ -9570,6 +9571,7 @@ Target_arm<big_endian>::Relocate::relocate(
     Target_arm* target,
     Output_section* output_section,
     size_t relnum,
+    size_t,
     const unsigned char* preloc,
     const Sized_symbol<32>* gsym,
     const Symbol_value<32>* psymval,
@@ -12573,7 +12575,7 @@ Target_arm<big_endian>::relocate_stub(
       reloc_write.put_r_info(elfcpp::elf_r_info<32>(0, r_type));
 
       relocate.relocate(relinfo, elfcpp::SHT_REL, this, output_section,
-			this->fake_relnum_for_stubs, reloc_buffer,
+			this->fake_relnum_for_stubs, 0, reloc_buffer,
 			NULL, &symval, view + reloc_offset,
 			address + reloc_offset, reloc_size);
     }
diff --git a/gold/i386.cc b/gold/i386.cc
index 0b447ef..5cede4b 100644
--- a/gold/i386.cc
+++ b/gold/i386.cc
@@ -651,7 +651,8 @@ class Target_i386 : public Sized_target<32, false>
     // any warnings about this relocation.
     inline bool
     relocate(const Relocate_info<32, false>*, unsigned int,
-	     Target_i386*, Output_section*, size_t, const unsigned char*,
+	     Target_i386*, Output_section*,
+	     size_t, size_t, const unsigned char*,
 	     const Sized_symbol<32>*, const Symbol_value<32>*,
 	     unsigned char*, elfcpp::Elf_types<32>::Elf_Addr,
 	     section_size_type);
@@ -2777,6 +2778,7 @@ Target_i386::Relocate::relocate(const Relocate_info<32, false>* relinfo,
 				Target_i386* target,
 				Output_section* output_section,
 				size_t relnum,
+				size_t,
 				const unsigned char* preloc,
 				const Sized_symbol<32>* gsym,
 				const Symbol_value<32>* psymval,
diff --git a/gold/mips.cc b/gold/mips.cc
index 4fc160b..b18b796 100644
--- a/gold/mips.cc
+++ b/gold/mips.cc
@@ -3884,7 +3884,8 @@ class Target_mips : public Sized_target<size, big_endian>
     // any warnings about this relocation.
     inline bool
     relocate(const Relocate_info<size, big_endian>*, unsigned int,
-	     Target_mips*, Output_section*, size_t, const unsigned char*,
+	     Target_mips*, Output_section*,
+	     size_t, size_t, const unsigned char*,
 	     const Sized_symbol<size>*, const Symbol_value<size>*,
 	     unsigned char*, Mips_address, section_size_type);
 
@@ -11440,6 +11441,7 @@ Target_mips<size, big_endian>::Relocate::relocate(
                         Target_mips* target,
                         Output_section* output_section,
                         size_t relnum,
+			size_t,
                         const unsigned char* preloc,
                         const Sized_symbol<size>* gsym,
                         const Symbol_value<size>* psymval,
diff --git a/gold/powerpc.cc b/gold/powerpc.cc
index 3bd6467..95b8cc0 100644
--- a/gold/powerpc.cc
+++ b/gold/powerpc.cc
@@ -1197,7 +1197,8 @@ class Target_powerpc : public Sized_target<size, big_endian>
     // any warnings about this relocation.
     inline bool
     relocate(const Relocate_info<size, big_endian>*, unsigned int,
-	     Target_powerpc*, Output_section*, size_t, const unsigned char*,
+	     Target_powerpc*, Output_section*,
+	     size_t, size_t, const unsigned char*,
 	     const Sized_symbol<size>*, const Symbol_value<size>*,
 	     unsigned char*, typename elfcpp::Elf_types<size>::Elf_Addr,
 	     section_size_type);
@@ -7737,6 +7738,7 @@ Target_powerpc<size, big_endian>::Relocate::relocate(
     Target_powerpc* target,
     Output_section* os,
     size_t relnum,
+    size_t,
     const unsigned char* preloc,
     const Sized_symbol<size>* gsym,
     const Symbol_value<size>* psymval,
diff --git a/gold/s390.cc b/gold/s390.cc
index a188268..7bb1608 100644
--- a/gold/s390.cc
+++ b/gold/s390.cc
@@ -582,7 +582,8 @@ class Target_s390 : public Sized_target<size, true>
     // any warnings about this relocation.
     inline bool
     relocate(const Relocate_info<size, true>*, unsigned int,
-	     Target_s390*, Output_section*, size_t, const unsigned char*,
+	     Target_s390*, Output_section*,
+	     size_t, size_t, const unsigned char*,
 	     const Sized_symbol<size>*, const Symbol_value<size>*,
 	     unsigned char*, typename elfcpp::Elf_types<size>::Elf_Addr,
 	     section_size_type);
@@ -3191,6 +3192,7 @@ Target_s390<size>::Relocate::relocate(
     Target_s390<size>* target,
     Output_section*,
     size_t relnum,
+    size_t,
     const unsigned char* preloc,
     const Sized_symbol<size>* gsym,
     const Symbol_value<size>* psymval,
diff --git a/gold/sparc.cc b/gold/sparc.cc
index 54c7c33..2d832b7 100644
--- a/gold/sparc.cc
+++ b/gold/sparc.cc
@@ -329,7 +329,8 @@ class Target_sparc : public Sized_target<size, big_endian>
     // any warnings about this relocation.
     inline bool
     relocate(const Relocate_info<size, big_endian>*, unsigned int,
-	     Target_sparc*, Output_section*, size_t, const unsigned char*,
+	     Target_sparc*, Output_section*,
+	     size_t, size_t, const unsigned char*,
 	     const Sized_symbol<size>*, const Symbol_value<size>*,
 	     unsigned char*, typename elfcpp::Elf_types<size>::Elf_Addr,
 	     section_size_type);
@@ -3275,6 +3276,7 @@ Target_sparc<size, big_endian>::Relocate::relocate(
 			Target_sparc* target,
 			Output_section*,
 			size_t relnum,
+			size_t,
 			const unsigned char* preloc,
 			const Sized_symbol<size>* gsym,
 			const Symbol_value<size>* psymval,
diff --git a/gold/target-reloc.h b/gold/target-reloc.h
index c8b86c6..25c5955 100644
--- a/gold/target-reloc.h
+++ b/gold/target-reloc.h
@@ -401,8 +401,8 @@ relocate_section(
 	v = NULL;
 
       if (!relocate.relocate(relinfo, Classify_reloc::sh_type, target,
-			     output_section, i, prelocs, sym, psymval,
-			     v, view_address + offset, view_size))
+			     output_section, i, reloc_count, prelocs,
+			     sym, psymval, v, view_address + offset, view_size))
 	continue;
 
       if (v == NULL)
@@ -461,7 +461,7 @@ apply_relocation(const Relocate_info<size, big_endian>* relinfo,
 
   Relocate relocate;
   relocate.relocate(relinfo, elfcpp::SHT_RELA, target, NULL,
-		    -1U, relbuf, sym, &symval,
+		    -1U, 0, relbuf, sym, &symval,
 		    view + r_offset, address + r_offset, view_size);
 }
 
diff --git a/gold/tilegx.cc b/gold/tilegx.cc
index 07c03fc..4843833 100644
--- a/gold/tilegx.cc
+++ b/gold/tilegx.cc
@@ -532,7 +532,8 @@ class Target_tilegx : public Sized_target<size, big_endian>
     // any warnings about this relocation.
     inline bool
     relocate(const Relocate_info<size, big_endian>*, unsigned int,
-	     Target_tilegx*, Output_section*, size_t, const unsigned char*,
+	     Target_tilegx*, Output_section*,
+	     size_t, size_t, const unsigned char*,
 	     const Sized_symbol<size>*, const Symbol_value<size>*,
 	     unsigned char*, typename elfcpp::Elf_types<size>::Elf_Addr,
 	     section_size_type);
@@ -4336,6 +4337,7 @@ Target_tilegx<size, big_endian>::Relocate::relocate(
     Target_tilegx<size, big_endian>* target,
     Output_section*,
     size_t relnum,
+    size_t,
     const unsigned char* preloc,
     const Sized_symbol<size>* gsym,
     const Symbol_value<size>* psymval,
diff --git a/gold/x86_64.cc b/gold/x86_64.cc
index 7f1742d..a8729a0 100644
--- a/gold/x86_64.cc
+++ b/gold/x86_64.cc
@@ -961,7 +961,8 @@ class Target_x86_64 : public Sized_target<size, false>
     // any warnings about this relocation.
     inline bool
     relocate(const Relocate_info<size, false>*, unsigned int,
-	     Target_x86_64*, Output_section*, size_t, const unsigned char*,
+	     Target_x86_64*, Output_section*,
+	     size_t, size_t, const unsigned char*,
 	     const Sized_symbol<size>*, const Symbol_value<size>*,
 	     unsigned char*, typename elfcpp::Elf_types<size>::Elf_Addr,
 	     section_size_type);
@@ -4027,6 +4028,7 @@ Target_x86_64<size>::Relocate::relocate(
     Target_x86_64<size>* target,
     Output_section*,
     size_t relnum,
+    size_t,
     const unsigned char* preloc,
     const Sized_symbol<size>* gsym,
     const Symbol_value<size>* psymval,

-- 
Alan Modra
Australia Development Lab, IBM


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