diff options
author | jmg <jmg@FreeBSD.org> | 2014-02-12 02:03:37 +0000 |
---|---|---|
committer | jmg <jmg@FreeBSD.org> | 2014-02-12 02:03:37 +0000 |
commit | 7a66b3978d8c1fb6a34d104a74042f34e4516833 (patch) | |
tree | 3d8442ef9325c3ddbbd159886a1947ac7173d3a6 /contrib/gdb | |
parent | 4ca4e5e36919a8b45fe0de86bf7f016d9b250caa (diff) | |
download | FreeBSD-src-7a66b3978d8c1fb6a34d104a74042f34e4516833.zip FreeBSD-src-7a66b3978d8c1fb6a34d104a74042f34e4516833.tar.gz |
recognize the FreeBSD ARCH tag that is put on binaries like on armeb
EABI binaries...
MFC after: 1 week
Diffstat (limited to 'contrib/gdb')
-rw-r--r-- | contrib/gdb/gdb/osabi.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/contrib/gdb/gdb/osabi.c b/contrib/gdb/gdb/osabi.c index 2b31a6e..4fa844e 100644 --- a/contrib/gdb/gdb/osabi.c +++ b/contrib/gdb/gdb/osabi.c @@ -365,11 +365,11 @@ check_note (bfd *abfd, asection *sect, const char *note, const char *name, unsigned long descsz, unsigned long type) { unsigned long notesz; + unsigned long rdescsz; /* Calculate the size of this note. */ - notesz = strlen (name) + 1; - notesz = ((notesz + 3) & ~3); - notesz += descsz; + notesz = 4 * 3; /* namelen, optlen, type */ + notesz += strlen (name) + 1; notesz = ((notesz + 3) & ~3); /* If this assertion triggers, increase MAX_NOTESZ. */ @@ -385,7 +385,15 @@ check_note (bfd *abfd, asection *sect, const char *note, return 0; /* Check the descriptor size. */ - if (bfd_h_get_32 (abfd, note + 4) != descsz) + rdescsz = bfd_h_get_32 (abfd, note + 4); + if (descsz != (unsigned long)-1 && rdescsz != descsz) + return 0; + + notesz += rdescsz; + notesz = ((notesz + 3) & ~3); + + /* Check whether SECT is big enough to comtain the complete note. */ + if (notesz > bfd_section_size (abfd, sect)) return 0; /* Check the note type. */ @@ -480,6 +488,12 @@ generic_elf_osabi_sniff_abi_tag_sections: unknown OS number %d", *osabi = GDB_OSABI_FREEBSD_ELF; return; } + if (check_note (abfd, sect, note, "FreeBSD", -1, NT_FREEBSD_ARCH_TAG)) + { + /* There is no need to check the version yet. */ + *osabi = GDB_OSABI_FREEBSD_ELF; + return; + } return; } |