1 /* Matsushita AM33/2.0 support for 32-bit GNU/Linux ELF 2 Copyright 2003, 2005 3 Free Software Foundation, Inc. 4 5 This file is part of BFD, the Binary File Descriptor library. 6 7 This program is free software; you can redistribute it and/or modify 8 it under the terms of the GNU General Public License as published by 9 the Free Software Foundation; either version 2 of the License, or 10 (at your option) any later version. 11 12 This program is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with this program; if not, write to the Free Software 19 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ 20 21 #include "bfd.h" 22 #include "sysdep.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 bfd_elf32_am33lin_vec 29 #define TARGET_LITTLE_NAME "elf32-am33lin" 30 #define ELF_ARCH bfd_arch_mn10300 31 #define ELF_MACHINE_CODE EM_MN10300 32 #define ELF_MACHINE_ALT1 EM_CYGNUS_MN10300 33 #define ELF_MAXPAGESIZE 0x1000 34 35 /* Rename global functions. */ 36 #define _bfd_mn10300_elf_merge_private_bfd_data _bfd_am33_elf_merge_private_bfd_data 37 #define _bfd_mn10300_elf_object_p _bfd_am33_elf_object_p 38 #define _bfd_mn10300_elf_final_write_processing _bfd_am33_elf_final_write_processing 39 40 /* Support for core dump NOTE sections. */ 41 static bfd_boolean 42 elf32_am33lin_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) 43 { 44 int offset; 45 unsigned int size; 46 47 switch (note->descsz) 48 { 49 default: 50 return FALSE; 51 52 case 188: /* Linux/am33 */ 53 /* pr_cursig */ 54 elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12); 55 56 /* pr_pid */ 57 elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24); 58 59 /* pr_reg */ 60 offset = 72; 61 size = 112; 62 63 break; 64 } 65 66 /* Make a ".reg/999" section. */ 67 return _bfd_elfcore_make_pseudosection (abfd, ".reg", size, 68 note->descpos + offset); 69 } 70 71 static bfd_boolean 72 elf32_am33lin_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) 73 { 74 switch (note->descsz) 75 { 76 default: 77 return FALSE; 78 79 case 124: /* Linux/am33 elf_prpsinfo */ 80 elf_tdata (abfd)->core_program 81 = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16); 82 elf_tdata (abfd)->core_command 83 = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80); 84 } 85 86 /* Note that for some reason, a spurious space is tacked 87 onto the end of the args in some (at least one anyway) 88 implementations, so strip it off if it exists. */ 89 90 { 91 char *command = elf_tdata (abfd)->core_command; 92 int n = strlen (command); 93 94 if (0 < n && command[n - 1] == ' ') 95 command[n - 1] = '\0'; 96 } 97 98 return TRUE; 99 } 100 101 #define elf_backend_grok_prstatus elf32_am33lin_grok_prstatus 102 #define elf_backend_grok_psinfo elf32_am33lin_grok_psinfo 103 104 #include "elf-m10300.c" 105