[PATCH 2/4] gold/aarch64: Add got_entry_count

H.J. Lu hjl.tools@gmail.com
Fri Aug 23 23:05:17 GMT 2024


Provide got_entry_count for aarch64 to support incremental linking.

	PR gold/32111
	* aarch64.cc (Target_aarch64::got_size): New.
	(Target_aarch64::got_entry_count): Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
 gold/aarch64.cc | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/gold/aarch64.cc b/gold/aarch64.cc
index 9419d503ea0..d96123539da 100644
--- a/gold/aarch64.cc
+++ b/gold/aarch64.cc
@@ -3056,6 +3056,23 @@ class Target_aarch64 : public Sized_target<size, big_endian>
   do_can_check_for_function_pointers() const
   { return true; }
 
+  // Return the size of the GOT section, for incremental linking.
+  section_size_type
+  got_size() const
+  {
+    gold_assert(this->got_ != NULL);
+    return this->got_->data_size();
+  }
+
+  // Return the number of entries in the GOT.
+  unsigned int
+  got_entry_count() const
+  {
+    if (this->got_ == NULL)
+      return 0;
+    return this->got_size() / 8;
+  }
+
   // Return the number of entries in the PLT.
   unsigned int
   plt_entry_count() const;
-- 
2.46.0



More information about the Binutils mailing list