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] Fix the relocs created to adjust notes created by the assembler.


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

commit 2e48456f0236d39b6de98feb7168f56cef155912
Author: Nick Clifton <nickc@redhat.com>
Date:   Fri Jul 6 11:46:14 2018 +0100

    Fix the relocs created to adjust notes created by the assembler.
    
    	* write.c (maybe_generate_build_notes): Bias reloc offsets by the
    	number of notes already generated.

Diff:
---
 gas/ChangeLog | 5 +++++
 gas/write.c   | 6 +++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index 1e6819f..aa4e948 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,8 @@
+2018-07-06  Nick Clifton  <nickc@redhat.com>
+
+	* write.c (maybe_generate_build_notes): Bias reloc offsets by the
+	number of notes already generated.
+
 2018-07-05  Nick Clifton  <nickc@redhat.com>
 
 	* po/ru.po: Updated Russian translation.
diff --git a/gas/write.c b/gas/write.c
index 39c894a..1c0ee38 100644
--- a/gas/write.c
+++ b/gas/write.c
@@ -2008,7 +2008,7 @@ maybe_generate_build_notes (void)
     if (sym->bsym != NULL
 	&& sym->bsym->flags & BSF_SECTION_SYM
 	&& sym->bsym->section != NULL
-	/* Skip linkonce sections - we cannot these section symbols as they may disappear.  */
+	/* Skip linkonce sections - we cannot use these section symbols as they may disappear.  */
 	&& (sym->bsym->section->flags & (SEC_CODE | SEC_LINK_ONCE)) == SEC_CODE
 	/* Not all linkonce sections are flagged...  */
 	&& strncmp (S_GET_NAME (sym), ".gnu.linkonce", sizeof ".gnu.linkonce" - 1) != 0)
@@ -2038,10 +2038,10 @@ maybe_generate_build_notes (void)
 	memcpy (note + 12, "GA$3a1", 8);
 
 	/* Create a relocation to install the start address of the note...  */
-	create_note_reloc (sec, sym, 20, desc_reloc, 0, note);
+	create_note_reloc (sec, sym, total_size + 20, desc_reloc, 0, note);
 
 	/* ...and another one to install the end address.  */
-	create_note_reloc (sec, sym, desc2_offset, desc_reloc,
+	create_note_reloc (sec, sym, total_size + desc2_offset, desc_reloc,
 			   bfd_get_section_size (sym->bsym->section),
 			   note);


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