[PATCH] bfd: Externalize the bfd_set_gp_value function

will schmidt will_schmidt@vnet.ibm.com
Tue Jul 27 15:34:45 GMT 2021


Externalize the bfd_set_gp_value function.

Hi,
  This change adds an external-visible wrapper for
the bfd_set_gp_value function.
This is a prerequisite for some gdb patches that allow
better handing of the .TOC. relocations as necessary
for the rs6000/powerpc64le target.

This patch includes updates to bfd.c to add the 
externally visible
wrapper, and the updated bfd-in2.h
as seen after rebuilding bfd with
--enable-maintainer-mode.

Credit and Thanks to Alan Modra for guidance
on what
to do and how to approach this.  That said, errors in
implementation are my own. :-)

OK for trunk?

Thanks
-Will

	yyyy-mm-dd  Will Schmidt  <will_schmidt@vnet.ibm.com>

	* bfd/bfd.c (bfd_set_gp_value):  New external visible
	wrapper for the internal _bfd_set_gp_value function.

	* bfd/bfd-in2.h: New prototype for bfd_set_gp_value.


diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 43d4ff0b925..aea35a5516a 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -7104,10 +7104,12 @@ bool bfd_set_start_address (bfd *abfd, bfd_vma vma);
 
 unsigned int bfd_get_gp_size (bfd *abfd);
 
 void bfd_set_gp_size (bfd *abfd, unsigned int i);
 
+void bfd_set_gp_value (bfd * abfd, bfd_vma v);
+
 bfd_vma bfd_scan_vma (const char *string, const char **end, int base);
 
 bool bfd_copy_private_header_data (bfd *ibfd, bfd *obfd);
 
 #define bfd_copy_private_header_data(ibfd, obfd) \
diff --git a/bfd/bfd.c b/bfd/bfd.c
index eb555ad5df2..4b70deb40a1 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -1858,10 +1858,28 @@ _bfd_set_gp_value (bfd *abfd, bfd_vma v)
     ecoff_data (abfd)->gp = v;
   else if (abfd->xvec->flavour == bfd_target_elf_flavour)
     elf_gp (abfd) = v;
 }
 
+/*
+FUNCTION
+	bfd_set_gp_value
+
+SYNOPSIS
+	void bfd_set_gp_value (bfd * abfd, bfd_vma v);
+
+DESCRIPTION
+	Allow external access to the fucntion to set the GP value.
+	This is specifically added for gdb-compile support.
+*/
+
+void
+bfd_set_gp_value (bfd *abfd, bfd_vma v)
+{
+        return _bfd_set_gp_value (abfd, v);
+}
+
 /*
 FUNCTION
 	bfd_scan_vma
 
 SYNOPSIS



More information about the Binutils mailing list