* config.sub, config.guess: Import latest from subversions.
[binutils.git] / bfd / elf32-sh-lin.c
blobe0b434da08ba28107bc6ed95f8d793a5dadd2e1f
1 /* Hitachi SH specific support for 32-bit Linux
2 Copyright 2000, 2001 Free Software Foundation, Inc.
4 This file is part of BFD, the Binary File Descriptor library.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
20 #define TARGET_BIG_SYM bfd_elf32_shblin_vec
21 #define TARGET_BIG_NAME "elf32-shbig-linux"
22 #define TARGET_LITTLE_SYM bfd_elf32_shlin_vec
23 #define TARGET_LITTLE_NAME "elf32-sh-linux"
24 #define ELF_ARCH bfd_arch_sh
25 #define ELF_MACHINE_CODE EM_SH
26 #define ELF_MAXPAGESIZE 0x10000
27 #define elf_symbol_leading_char 0
29 #include "bfd.h"
30 #include "sysdep.h"
31 #include "elf/internal.h"
32 #include "elf-bfd.h"
34 static boolean elf32_shlin_grok_prstatus
35 PARAMS ((bfd *abfd, Elf_Internal_Note *note));
36 static boolean elf32_shlin_grok_psinfo
37 PARAMS ((bfd *abfd, Elf_Internal_Note *note));
39 /* Support for core dump NOTE sections */
40 static boolean
41 elf32_shlin_grok_prstatus (abfd, note)
42 bfd *abfd;
43 Elf_Internal_Note *note;
45 int offset;
46 unsigned int raw_size;
48 switch (note->descsz)
50 default:
51 return false;
53 case 168: /* Linux/SH */
54 /* pr_cursig */
55 elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
57 /* pr_pid */
58 elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
60 /* pr_reg */
61 offset = 72;
62 raw_size = 92;
64 break;
67 /* Make a ".reg/999" section. */
68 return _bfd_elfcore_make_pseudosection (abfd, ".reg",
69 raw_size, note->descpos + offset);
72 static boolean
73 elf32_shlin_grok_psinfo (abfd, note)
74 bfd *abfd;
75 Elf_Internal_Note *note;
77 switch (note->descsz)
79 default:
80 return false;
82 case 124: /* Linux/SH elf_prpsinfo */
83 elf_tdata (abfd)->core_program
84 = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
85 elf_tdata (abfd)->core_command
86 = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
89 /* Note that for some reason, a spurious space is tacked
90 onto the end of the args in some (at least one anyway)
91 implementations, so strip it off if it exists. */
94 char *command = elf_tdata (abfd)->core_command;
95 int n = strlen (command);
97 if (0 < n && command[n - 1] == ' ')
98 command[n - 1] = '\0';
101 return true;
105 #define elf_backend_grok_prstatus elf32_shlin_grok_prstatus
106 #define elf_backend_grok_psinfo elf32_shlin_grok_psinfo
110 #include "elf32-sh.c"