aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-sh.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2002-10-16 08:39:38 +0000
committerAlan Modra <amodra@gmail.com>2002-10-16 08:39:38 +0000
commit2bc3c89ab374cc07ce4781d37a662030d6fb4a58 (patch)
tree966a7b1e22575ac5ff940c62a4268d72b62e58e9 /bfd/elf32-sh.c
parent366f2964afea873fe9e9e81c9d0ab2435e05ef7d (diff)
downloadfsf-binutils-gdb-2bc3c89ab374cc07ce4781d37a662030d6fb4a58.zip
fsf-binutils-gdb-2bc3c89ab374cc07ce4781d37a662030d6fb4a58.tar.gz
fsf-binutils-gdb-2bc3c89ab374cc07ce4781d37a662030d6fb4a58.tar.bz2
* Makefile.am (BFD32_BACKENDS): Remove elfarmqnx-nabi.lo,
elf32-i386-fbsd.lo, elf32-i386qnx.lo, elf32-ppcqnx.lo, elf32-sh-lin.lo, elf32-sh64-lin.lo, elf32-sh-nbsd.lo, elf32-sh64-nbsd.lo, elf32-shqnx.lo. Add elf32-qnx.lo. (BFD32_BACKENDS_CFILES): Likewise for corresponding C files. (BFD64_BACKENDS): Remove elf64-sh64-lin.lo, elf64-sh64-nbsd.lo. (BFD64_BACKENDS_CFILES): Likewise for corresponding C files. (SOURCE_HFILES): Add elf32-qnx.h. (BUILD_HFILES): Add bfdver.h. Run "make dep-am". * Makefile.in: Regenerate. * configure.in Update bfd vector dependencies. * configure: Regenerate. * elf32-i386-fbsd.c: Delete. Move code to elf32-i386.c. * elf32-i386qnx.c: Likewise. * elf32-ppcqnx.c: Delete. Move code to elf32-ppc.c. * elf32-sh-nbsd.c: Delete. Move code to elf32-sh.c. * elf32-sh-lin.c: Likewise. * elf32-shqnx.c: Likewise. * elf32-sh64-lin.c: Delete. Move code to elf32-sh64.c. * elf32-sh64-nbsd.c: Likewise. * elf64-sh64-lin.c: Delete. Move code to elf64-sh64.c. * elf64-sh64-nbsd.c: Likewise. * elfarmqnx-nabi.c: Delete. Move code to elfarm-nabi.c. * elf32-arm.h (ELF_MAXPAGESIZE): Always define. * elf32-i386.c: Remove ELF_ARCH and ELF32_I386_C_INCLUDED tests. * elf32-ppc.c: Remove ELF32_PPC_C_INCLUDED tests. * elf32-qnx.h (elf_backend_set_nonloadable_filepos): Always define. (elf_backend_is_contained_by_filepos): Likewise. (elf_backend_copy_private_bfd_data_p): Likewise. Globalize and move functions to.. * elf32-qnx.c: ..here. New file. * elf32-sh.c: Remove ELF_ARCH and ELF32_SH_C_INCLUDED tests. Don't emit target vectors when INCLUDE_SHMEDIA. * elf32-sh64.c: Remove ELF_ARCH test. Move TARGET_* etc. defines to end of file. * elf64-sh64.c: Remove ELF_ARCH test. * elfarm-nabi.c: Remove ELFARM_NABI_C_INCLUDED test. * po/BLD-POTFILES.in: Regenerate. * po/SRC-POTFILES.in: Regenerate.
Diffstat (limited to 'bfd/elf32-sh.c')
-rw-r--r--bfd/elf32-sh.c142
1 files changed, 138 insertions, 4 deletions
diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c
index 8da4d88..0f681a8 100644
--- a/bfd/elf32-sh.c
+++ b/bfd/elf32-sh.c
@@ -105,6 +105,10 @@ static enum elf_reloc_type_class sh_elf_reloc_type_class
#ifdef INCLUDE_SHMEDIA
inline static void movi_shori_putval PARAMS ((bfd *, unsigned long, char *));
#endif
+static boolean elf32_shlin_grok_prstatus
+ PARAMS ((bfd *abfd, Elf_Internal_Note *note));
+static boolean elf32_shlin_grok_psinfo
+ PARAMS ((bfd *abfd, Elf_Internal_Note *note));
/* The name of the dynamic interpreter. This is put in the .interp
section. */
@@ -7324,7 +7328,71 @@ sh_elf_reloc_type_class (rela)
}
}
-#ifndef ELF_ARCH
+/* Support for Linux core dump NOTE sections */
+static boolean
+elf32_shlin_grok_prstatus (abfd, note)
+ bfd *abfd;
+ Elf_Internal_Note *note;
+{
+ int offset;
+ unsigned int raw_size;
+
+ switch (note->descsz)
+ {
+ default:
+ return false;
+
+ case 168: /* Linux/SH */
+ /* pr_cursig */
+ elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+
+ /* pr_pid */
+ elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
+
+ /* pr_reg */
+ offset = 72;
+ raw_size = 92;
+
+ break;
+ }
+
+ /* Make a ".reg/999" section. */
+ return _bfd_elfcore_make_pseudosection (abfd, ".reg",
+ raw_size, note->descpos + offset);
+}
+
+static boolean
+elf32_shlin_grok_psinfo (abfd, note)
+ bfd *abfd;
+ Elf_Internal_Note *note;
+{
+ switch (note->descsz)
+ {
+ default:
+ return false;
+
+ case 124: /* Linux/SH elf_prpsinfo */
+ elf_tdata (abfd)->core_program
+ = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
+ elf_tdata (abfd)->core_command
+ = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
+ }
+
+ /* Note that for some reason, a spurious space is tacked
+ onto the end of the args in some (at least one anyway)
+ implementations, so strip it off if it exists. */
+
+ {
+ char *command = elf_tdata (abfd)->core_command;
+ int n = strlen (command);
+
+ if (0 < n && command[n - 1] == ' ')
+ command[n - 1] = '\0';
+ }
+
+ return true;
+}
+
#define TARGET_BIG_SYM bfd_elf32_sh_vec
#define TARGET_BIG_NAME "elf32-sh"
#define TARGET_LITTLE_SYM bfd_elf32_shl_vec
@@ -7334,7 +7402,6 @@ sh_elf_reloc_type_class (rela)
#define ELF_MAXPAGESIZE 128
#define elf_symbol_leading_char '_'
-#endif /* ELF_ARCH */
#define bfd_elf32_bfd_reloc_type_lookup sh_elf_reloc_type_lookup
#define elf_info_to_howto sh_elf_info_to_howto
@@ -7378,7 +7445,74 @@ sh_elf_reloc_type_class (rela)
#define elf_backend_got_header_size 12
#define elf_backend_plt_header_size PLT_ENTRY_SIZE
-#ifndef ELF32_SH_C_INCLUDED
+#ifndef INCLUDE_SHMEDIA
+
#include "elf32-target.h"
-#endif
+/* QNX support. */
+#include "elf32-qnx.h"
+
+#undef TARGET_LITTLE_SYM
+#define TARGET_LITTLE_SYM bfd_elf32_shlqnx_vec
+#undef TARGET_LITTLE_NAME
+#define TARGET_LITTLE_NAME "elf32-shl-nto"
+#undef TARGET_BIG_SYM
+#define TARGET_BIG_SYM bfd_elf32_shqnx_vec
+#undef TARGET_BIG_NAME
+#define TARGET_BIG_NAME "elf32-sh-nto"
+#undef ELF_MAXPAGESIZE
+#define ELF_MAXPAGESIZE 0x1000
+
+#define elf32_bed elf32_sh_qnx_bed
+
+#include "elf32-target.h"
+
+#undef elf_backend_set_nonloadable_filepos
+#undef elf_backend_is_contained_by_filepos
+#undef elf_backend_copy_private_bfd_data_p
+#undef elf32_bed
+
+/* NetBSD support. */
+#undef TARGET_BIG_SYM
+#define TARGET_BIG_SYM bfd_elf32_shnbsd_vec
+#undef TARGET_BIG_NAME
+#define TARGET_BIG_NAME "elf32-sh-nbsd"
+#undef TARGET_LITTLE_SYM
+#define TARGET_LITTLE_SYM bfd_elf32_shlnbsd_vec
+#undef TARGET_LITTLE_NAME
+#define TARGET_LITTLE_NAME "elf32-shl-nbsd"
+#undef ELF_MAXPAGESIZE
+#define ELF_MAXPAGESIZE 0x10000
+#undef elf_symbol_leading_char
+#define elf_symbol_leading_char 0
+
+#define elf32_bed elf32_sh_nbsd_bed
+
+#include "elf32-target.h"
+
+#undef elf32_bed
+
+/* Linux support. */
+#undef TARGET_BIG_SYM
+#define TARGET_BIG_SYM bfd_elf32_shblin_vec
+#undef TARGET_BIG_NAME
+#define TARGET_BIG_NAME "elf32-shbig-linux"
+#undef TARGET_LITTLE_SYM
+#define TARGET_LITTLE_SYM bfd_elf32_shlin_vec
+#undef TARGET_LITTLE_NAME
+#define TARGET_LITTLE_NAME "elf32-sh-linux"
+
+#undef elf_backend_grok_prstatus
+#define elf_backend_grok_prstatus elf32_shlin_grok_prstatus
+#undef elf_backend_grok_psinfo
+#define elf_backend_grok_psinfo elf32_shlin_grok_psinfo
+
+#define elf32_bed elf32_sh_lin_bed
+
+#include "elf32-target.h"
+
+#undef elf_backend_grok_prstatus
+#undef elf_backend_grok_psinfo
+#undef elf32_bed
+
+#endif /* INCLUDE_SHMEDIA */