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]

[PATCH] Always pass a valid section header offset to elf_parse_notes


_bfd_elf_make_section_from_shdr calls elf_parse_notes with an offset
of -1.  This argument is used to calculate Elf_Internal_Note.descpos,
which ends up set to a positive but meaningless value.  This commit
updates _bfd_elf_make_section_from_shdr to pass the correct offset to
elf_parse_notes, making Elf_Internal_Note.descpos correct in all cases.

bfd/ChangeLog:

	* elf.c (_bfd_elf_make_section_from_shdr): Pass offset to
	elf_parse_notes.
---
 bfd/ChangeLog | 5 +++++
 bfd/elf.c     | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/bfd/elf.c b/bfd/elf.c
index 5cc938d..d5b46b6 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -1062,7 +1062,7 @@ _bfd_elf_make_section_from_shdr (bfd *abfd,
       if (!bfd_malloc_and_get_section (abfd, newsect, &contents))
 	return FALSE;
 
-      elf_parse_notes (abfd, (char *) contents, hdr->sh_size, -1);
+      elf_parse_notes (abfd, (char *) contents, hdr->sh_size, hdr->sh_offset);
       free (contents);
     }
 
-- 
1.8.3.1


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