* elf-bfd.h (struct core_elf_obj_tdata): New.
[deliverable/binutils-gdb.git] / bfd / elf32-am33lin.c
CommitLineData
73c3cd1c 1/* Matsushita AM33/2.0 support for 32-bit GNU/Linux ELF
3db64b00 2 Copyright 2003, 2005, 2007
73c3cd1c
AO
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
cd123cb7 9 the Free Software Foundation; either version 3 of the License, or
73c3cd1c
AO
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
cd123cb7
NC
19 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
20 MA 02110-1301, USA. */
73c3cd1c 21
6cfda947 22#include "sysdep.h"
3db64b00 23#include "bfd.h"
6cfda947
KB
24#include "elf-bfd.h"
25#include "elf/mn10300.h"
26
73c3cd1c
AO
27#define elf_symbol_leading_char 0
28
29#define TARGET_LITTLE_SYM bfd_elf32_am33lin_vec
30#define TARGET_LITTLE_NAME "elf32-am33lin"
31#define ELF_ARCH bfd_arch_mn10300
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
6cfda947
KB
41/* Support for core dump NOTE sections. */
42static bfd_boolean
43elf32_am33lin_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
44{
45 int offset;
46 unsigned int size;
47
48 switch (note->descsz)
49 {
50 default:
51 return FALSE;
52
083a5534 53 case 184:
6cfda947
KB
54 case 188: /* Linux/am33 */
55 /* pr_cursig */
228e534f 56 elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);
6cfda947
KB
57
58 /* pr_pid */
228e534f 59 elf_tdata (abfd)->core->lwpid = bfd_get_32 (abfd, note->descdata + 24);
6cfda947
KB
60
61 /* pr_reg */
62 offset = 72;
63 size = 112;
64
65 break;
66 }
67
68 /* Make a ".reg/999" section. */
69 return _bfd_elfcore_make_pseudosection (abfd, ".reg", size,
70 note->descpos + offset);
71}
72
73static bfd_boolean
74elf32_am33lin_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
75{
76 switch (note->descsz)
77 {
78 default:
79 return FALSE;
80
81 case 124: /* Linux/am33 elf_prpsinfo */
228e534f 82 elf_tdata (abfd)->core->program
6cfda947 83 = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
228e534f 84 elf_tdata (abfd)->core->command
6cfda947
KB
85 = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
86 }
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 {
228e534f 93 char *command = elf_tdata (abfd)->core->command;
6cfda947
KB
94 int n = strlen (command);
95
96 if (0 < n && command[n - 1] == ' ')
97 command[n - 1] = '\0';
98 }
99
100 return TRUE;
101}
102
103#define elf_backend_grok_prstatus elf32_am33lin_grok_prstatus
104#define elf_backend_grok_psinfo elf32_am33lin_grok_psinfo
105
73c3cd1c 106#include "elf-m10300.c"
This page took 0.468151 seconds and 4 git commands to generate.