Commit | Line | Data |
---|---|---|
b129bfef AO |
1 | /* Hitachi SH specific support for 32-bit Linux |
2 | Copyright 2000 Free Software Foundation, Inc. | |
3 | ||
4 | This file is part of BFD, the Binary File Descriptor library. | |
5 | ||
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. | |
10 | ||
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. | |
15 | ||
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. */ | |
19 | ||
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 | |
28 | ||
c5fccbec DJ |
29 | #include "bfd.h" |
30 | #include "sysdep.h" | |
31 | #include "elf/internal.h" | |
32 | #include "elf-bfd.h" | |
33 | ||
34 | /* Support for core dump NOTE sections */ | |
35 | static boolean | |
36 | elf32_shlin_grok_prstatus (abfd, note) | |
37 | bfd *abfd; | |
38 | Elf_Internal_Note *note; | |
39 | { | |
40 | int offset; | |
41 | int raw_size; | |
42 | ||
43 | switch (note->descsz) | |
44 | { | |
45 | default: | |
46 | return false; | |
47 | ||
48 | case 168: /* Linux/SH */ | |
49 | /* pr_cursig */ | |
50 | elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12); | |
51 | ||
52 | /* pr_pid */ | |
53 | elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24); | |
54 | ||
55 | /* pr_reg */ | |
56 | offset = 72; | |
57 | raw_size = 92; | |
58 | ||
59 | break; | |
60 | } | |
61 | ||
62 | /* Make a ".reg/999" section. */ | |
63 | return _bfd_elfcore_make_pseudosection (abfd, ".reg", | |
64 | raw_size, note->descpos + offset); | |
65 | } | |
66 | ||
67 | static boolean | |
68 | elf32_shlin_grok_psinfo (abfd, note) | |
69 | bfd *abfd; | |
70 | Elf_Internal_Note *note; | |
71 | { | |
72 | switch (note->descsz) | |
73 | { | |
74 | default: | |
75 | return false; | |
76 | ||
77 | case 124: /* Linux/SH elf_prpsinfo */ | |
78 | elf_tdata (abfd)->core_program | |
79 | = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16); | |
80 | elf_tdata (abfd)->core_command | |
81 | = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80); | |
82 | } | |
83 | ||
84 | /* Note that for some reason, a spurious space is tacked | |
85 | onto the end of the args in some (at least one anyway) | |
86 | implementations, so strip it off if it exists. */ | |
87 | ||
88 | { | |
89 | char *command = elf_tdata (abfd)->core_command; | |
90 | int n = strlen (command); | |
91 | ||
92 | if (0 < n && command[n - 1] == ' ') | |
93 | command[n - 1] = '\0'; | |
94 | } | |
95 | ||
96 | return true; | |
97 | } | |
98 | \f | |
99 | ||
100 | #define elf_backend_grok_prstatus elf32_shlin_grok_prstatus | |
101 | #define elf_backend_grok_psinfo elf32_shlin_grok_psinfo | |
102 | ||
103 | ||
104 | ||
b129bfef | 105 | #include "elf32-sh.c" |