/src/binutils-gdb/bfd/elf32-am33lin.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* Matsushita AM33/2.0 support for 32-bit GNU/Linux ELF |
2 | | Copyright (C) 2003-2025 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 3 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., 51 Franklin Street - Fifth Floor, Boston, |
19 | | MA 02110-1301, USA. */ |
20 | | |
21 | | #include "sysdep.h" |
22 | | #include "bfd.h" |
23 | | #include "elf-bfd.h" |
24 | | #include "elf/mn10300.h" |
25 | | |
26 | | #define elf_symbol_leading_char 0 |
27 | | |
28 | | #define TARGET_LITTLE_SYM am33_elf32_linux_vec |
29 | | #define TARGET_LITTLE_NAME "elf32-am33lin" |
30 | | #define ELF_ARCH bfd_arch_mn10300 |
31 | | #define ELF_TARGET_ID MN10300_ELF_DATA |
32 | | #define ELF_MACHINE_CODE EM_MN10300 |
33 | | #define ELF_MACHINE_ALT1 EM_CYGNUS_MN10300 |
34 | | #define ELF_MAXPAGESIZE 0x1000 |
35 | | |
36 | | /* Rename global functions. */ |
37 | | #define _bfd_mn10300_elf_merge_private_bfd_data _bfd_am33_elf_merge_private_bfd_data |
38 | | #define _bfd_mn10300_elf_object_p _bfd_am33_elf_object_p |
39 | | #define _bfd_mn10300_elf_final_write_processing _bfd_am33_elf_final_write_processing |
40 | | |
41 | | /* Support for core dump NOTE sections. */ |
42 | | static bool |
43 | | elf32_am33lin_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) |
44 | 0 | { |
45 | 0 | int offset; |
46 | 0 | unsigned int size; |
47 | |
|
48 | 0 | switch (note->descsz) |
49 | 0 | { |
50 | 0 | default: |
51 | 0 | return false; |
52 | | |
53 | 0 | case 184: |
54 | 0 | case 188: /* Linux/am33 */ |
55 | | /* pr_cursig */ |
56 | 0 | elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12); |
57 | | |
58 | | /* pr_pid */ |
59 | 0 | elf_tdata (abfd)->core->lwpid = bfd_get_32 (abfd, note->descdata + 24); |
60 | | |
61 | | /* pr_reg */ |
62 | 0 | offset = 72; |
63 | 0 | size = 112; |
64 | |
|
65 | 0 | break; |
66 | 0 | } |
67 | | |
68 | | /* Make a ".reg/999" section. */ |
69 | 0 | return _bfd_elfcore_make_pseudosection (abfd, ".reg", size, |
70 | 0 | note->descpos + offset); |
71 | 0 | } |
72 | | |
73 | | static bool |
74 | | elf32_am33lin_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) |
75 | 0 | { |
76 | 0 | switch (note->descsz) |
77 | 0 | { |
78 | 0 | default: |
79 | 0 | return false; |
80 | | |
81 | 0 | case 124: /* Linux/am33 elf_prpsinfo */ |
82 | 0 | elf_tdata (abfd)->core->program |
83 | 0 | = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16); |
84 | 0 | elf_tdata (abfd)->core->command |
85 | 0 | = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80); |
86 | 0 | } |
87 | | |
88 | | /* Note that for some reason, a spurious space is tacked |
89 | | onto the end of the args in some (at least one anyway) |
90 | | implementations, so strip it off if it exists. */ |
91 | | |
92 | 0 | { |
93 | 0 | char *command = elf_tdata (abfd)->core->command; |
94 | 0 | int n = strlen (command); |
95 | |
|
96 | 0 | if (0 < n && command[n - 1] == ' ') |
97 | 0 | command[n - 1] = '\0'; |
98 | 0 | } |
99 | |
|
100 | 0 | return true; |
101 | 0 | } |
102 | | |
103 | | #define elf_backend_grok_prstatus elf32_am33lin_grok_prstatus |
104 | | #define elf_backend_grok_psinfo elf32_am33lin_grok_psinfo |
105 | | |
106 | | #define elf_backend_linux_prpsinfo32_ugid16 true |
107 | | |
108 | | #include "elf-m10300.c" |