Back to index

cell-binutils  2.17cvs20070401
elf32-am33lin.c
Go to the documentation of this file.
00001 /* Matsushita AM33/2.0 support for 32-bit GNU/Linux ELF
00002    Copyright 2003, 2005
00003    Free Software Foundation, Inc.
00004 
00005    This file is part of BFD, the Binary File Descriptor library.
00006 
00007    This program is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 2 of the License, or
00010    (at your option) any later version.
00011 
00012    This program is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016 
00017    You should have received a copy of the GNU General Public License
00018    along with this program; if not, write to the Free Software
00019    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00020 
00021 #include "bfd.h"
00022 #include "sysdep.h"
00023 #include "elf-bfd.h"
00024 #include "elf/mn10300.h"
00025 
00026 #define elf_symbol_leading_char 0
00027 
00028 #define TARGET_LITTLE_SYM   bfd_elf32_am33lin_vec
00029 #define TARGET_LITTLE_NAME  "elf32-am33lin"
00030 #define ELF_ARCH            bfd_arch_mn10300
00031 #define ELF_MACHINE_CODE    EM_MN10300
00032 #define ELF_MACHINE_ALT1    EM_CYGNUS_MN10300
00033 #define ELF_MAXPAGESIZE            0x1000
00034 
00035 /* Rename global functions.  */
00036 #define _bfd_mn10300_elf_merge_private_bfd_data  _bfd_am33_elf_merge_private_bfd_data
00037 #define _bfd_mn10300_elf_object_p                _bfd_am33_elf_object_p
00038 #define _bfd_mn10300_elf_final_write_processing  _bfd_am33_elf_final_write_processing
00039 
00040 /* Support for core dump NOTE sections.  */
00041 static bfd_boolean
00042 elf32_am33lin_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
00043 {
00044   int offset;
00045   unsigned int size;
00046 
00047   switch (note->descsz)
00048     {
00049       default:
00050        return FALSE;
00051 
00052       case 188:             /* Linux/am33 */
00053        /* pr_cursig */
00054        elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
00055 
00056        /* pr_pid */
00057        elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
00058 
00059        /* pr_reg */
00060        offset = 72;
00061        size = 112;
00062 
00063        break;
00064     }
00065 
00066   /* Make a ".reg/999" section.  */
00067   return _bfd_elfcore_make_pseudosection (abfd, ".reg", size,
00068                                      note->descpos + offset);
00069 }
00070 
00071 static bfd_boolean
00072 elf32_am33lin_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
00073 {
00074   switch (note->descsz)
00075     {
00076       default:
00077        return FALSE;
00078 
00079       case 124:             /* Linux/am33 elf_prpsinfo */
00080        elf_tdata (abfd)->core_program
00081         = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
00082        elf_tdata (abfd)->core_command
00083         = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
00084     }
00085 
00086   /* Note that for some reason, a spurious space is tacked
00087      onto the end of the args in some (at least one anyway)
00088      implementations, so strip it off if it exists.  */
00089 
00090   {
00091     char *command = elf_tdata (abfd)->core_command;
00092     int n = strlen (command);
00093 
00094     if (0 < n && command[n - 1] == ' ')
00095       command[n - 1] = '\0';
00096   }
00097 
00098   return TRUE;
00099 }
00100 
00101 #define elf_backend_grok_prstatus  elf32_am33lin_grok_prstatus
00102 #define elf_backend_grok_psinfo           elf32_am33lin_grok_psinfo
00103 
00104 #include "elf-m10300.c"