Index: Makefile.inc1 =================================================================== --- Makefile.inc1 (revision 260701) +++ Makefile.inc1 (working copy) @@ -1931,10 +1931,12 @@ _xb-cross-tools: .for _tool in \ gnu/usr.bin/binutils \ gnu/usr.bin/cc \ + gnu/usr.bin/gdb \ usr.bin/ar \ ${_clang_libs} \ ${_clang} ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \ + echo CDMAKE: ${CDMAKE} && \ cd ${.CURDIR}/${_tool} && \ ${CDMAKE} DIRPRFX=${_tool}/ obj && \ ${CDMAKE} DIRPRFX=${_tool}/ depend && \ @@ -1959,6 +1961,7 @@ _xi-cross-tools: .for _tool in \ gnu/usr.bin/binutils \ gnu/usr.bin/cc \ + gnu/usr.bin/gdb \ usr.bin/ar \ ${_clang} ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \ Index: contrib/gdb/gdb/osabi.c =================================================================== --- contrib/gdb/gdb/osabi.c (revision 260701) +++ contrib/gdb/gdb/osabi.c (working copy) @@ -365,12 +365,12 @@ check_note (bfd *abfd, asection *sect, const char 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 = 4 * 3; /* namelen, optlen, type */ + notesz += strlen (name) + 1; notesz = ((notesz + 3) & ~3); - notesz += descsz; - notesz = ((notesz + 3) & ~3); /* If this assertion triggers, increase MAX_NOTESZ. */ gdb_assert (notesz <= MAX_NOTESZ); @@ -385,9 +385,17 @@ check_note (bfd *abfd, asection *sect, const char 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. */ if (bfd_h_get_32 (abfd, note + 8) != type) return 0; @@ -480,6 +488,12 @@ generic_elf_osabi_sniff_abi_tag_sections: unknown *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; } Index: gnu/usr.bin/gdb/kgdb/trgt_arm.c =================================================================== --- gnu/usr.bin/gdb/kgdb/trgt_arm.c (revision 260701) +++ gnu/usr.bin/gdb/kgdb/trgt_arm.c (working copy) @@ -50,7 +50,11 @@ __FBSDID("$FreeBSD$"); CORE_ADDR kgdb_trgt_core_pcb(u_int cpuid) { +#ifndef CROSS_DEBUGGER return (kgdb_trgt_stop_pcb(cpuid, sizeof(struct pcb))); +#else + return -1; +#endif } void Index: lib/libkvm/kvm_arm.c =================================================================== --- lib/libkvm/kvm_arm.c (revision 260701) +++ lib/libkvm/kvm_arm.c (working copy) @@ -42,11 +42,15 @@ __FBSDID("$FreeBSD$"); #include #include +#ifndef CROSS_LIBKVM #include #include #include - #include +#else +#include "../../sys/arm/include/pte.h" +#include "../../sys/arm/include/vmparam.h" +#endif #include #include Index: lib/libkvm/kvm_minidump_arm.c =================================================================== --- lib/libkvm/kvm_minidump_arm.c (revision 260701) +++ lib/libkvm/kvm_minidump_arm.c (working copy) @@ -34,7 +34,9 @@ __FBSDID("$FreeBSD$"); */ #include +#ifndef CROSS_LIBKVM #include +#endif #include #include #include @@ -45,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include +#ifndef CROSS_LIBKVM #include #include @@ -51,6 +54,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#else +#include "../../sys/arm/include/pte.h" +#include "../../sys/arm/include/vmparam.h" +#include "../../sys/arm/include/minidump.h" +#endif #include