diff mbox

bfd/elfnn-aarch64.c: Fix calculation of DT_RELASZ

Message ID 1394812220-15667-1-git-send-email-will.newton@linaro.org
State Superseded
Headers show

Commit Message

Will Newton March 14, 2014, 3:50 p.m. UTC
The current code subtracts the size of the output section containing
relplt from RELASZ. In some cases this will be the same output
section as the dynamic relocs causing a value of zero to be output.
Calculating the size from input sections seems to make more sense.

bfd/ChangeLog:

2014-03-14  Will Newton  <will.newton@linaro.org>

	 * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_sections):
	 Set value of DT_PLTRELSZ and DT_RELASZ based on the size
	 of input sections rather than output sections.
---
 bfd/elfnn-aarch64.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Marcus Shawcroft March 19, 2014, 4:03 p.m. UTC | #1
On 14 March 2014 15:50, Will Newton <will.newton@linaro.org> wrote:
> The current code subtracts the size of the output section containing
> relplt from RELASZ. In some cases this will be the same output
> section as the dynamic relocs causing a value of zero to be output.
> Calculating the size from input sections seems to make more sense.

Will, Have you got a test case for this?
Cheers
/Marcus
diff mbox

Patch

diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index c2adcc9..638938d 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -6993,7 +6993,7 @@  elfNN_aarch64_finish_dynamic_sections (bfd *output_bfd,
 	      break;
 
 	    case DT_PLTRELSZ:
-	      s = htab->root.srelplt->output_section;
+	      s = htab->root.srelplt;
 	      dyn.d_un.d_val = s->size;
 	      break;
 
@@ -7007,7 +7007,7 @@  elfNN_aarch64_finish_dynamic_sections (bfd *output_bfd,
 		 about changing the DT_RELA entry.  */
 	      if (htab->root.srelplt != NULL)
 		{
-		  s = htab->root.srelplt->output_section;
+		  s = htab->root.srelplt;
 		  dyn.d_un.d_val -= s->size;
 		}
 	      break;