* config/obj-som.c (obj_read_begin_hook): Delete unused function.
[deliverable/binutils-gdb.git] / gas / config / obj-som.c
1 /* SOM object file format.
2 Copyright (C) 1993 Free Software Foundation, Inc.
3
4 This file is part of GAS, the GNU Assembler.
5
6 GAS is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as
8 published by the Free Software Foundation; either version 2,
9 or (at your option) any later version.
10
11 GAS is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
14 the GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public
17 License along with GAS; see the file COPYING. If not, write
18 to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19
20 Written by the Center for Software Science at the University of Utah
21 and by Cygnus Support. */
22
23 #include "as.h"
24 #include "subsegs.h"
25 #include "aout/stab_gnu.h"
26 #include "obstack.h"
27
28 /* SOM does not need any pseudo-ops. */
29
30 const pseudo_typeS obj_pseudo_table[] =
31 {
32 {NULL}
33 };
34
35 /* Handle a .version directive. FIXME. We just parse the .version
36 directive and throw away the results!. */
37
38 void
39 obj_som_version (unused)
40 int unused;
41 {
42 SKIP_WHITESPACE ();
43 if (*input_line_pointer == '\"')
44 {
45 ++input_line_pointer;
46 while (is_a_char (next_char_of_string ()))
47 ;
48 }
49 else
50 {
51 as_bad ("Expected quoted string");
52 }
53 demand_empty_rest_of_line ();
54 }
55
56 /* Perform any initialization necessary for stabs support.
57
58 For SOM we need to create the space which will contain the
59 two stabs subspaces. Additionally we need to set up the
60 space/subspace relationships and set space/subspace attributes
61 which BFD does not understand. */
62
63 void
64 obj_som_init_stab_section (seg)
65 segT seg;
66 {
67 segT saved_seg = now_seg;
68 segT space;
69 subsegT saved_subseg = now_subseg;
70 char *p, *file;
71 unsigned int stroff;
72
73 /* Make the space which will contain the debug subspaces. */
74 space = bfd_make_section_old_way (stdoutput, "$GDB_DEBUG$");
75
76 /* Set SOM specific attributes for the space. In particular we set
77 the space "defined", "private", "sort_key", and "spnum" values.
78
79 Due to a bug in pxdb (called by hpux linker), the sort keys
80 of the various stabs spaces/subspaces need to be "small". We
81 reserve range 72/73 which appear to work well. */
82 obj_set_section_attributes (space, 1, 1, 72, 2);
83 bfd_set_section_alignment (stdoutput, space, 2);
84
85 /* Set the containing space for both stab sections to be $GDB_DEBUG$
86 (just created above). Also set some attributes which BFD does
87 not understand. In particular, access bits, sort keys, and load
88 quadrant. */
89 obj_set_subsection_attributes (seg, space, 0x1f, 73, 0);
90 bfd_set_section_alignment (stdoutput, seg, 2);
91
92 /* Make some space for the first stab entry which is special.
93 It contains information about the length of this file's
94 stab string and the like. Using it avoids the need to
95 relocate the stab strings.
96
97 The $GDB_STRINGS$ space will be created as a side effect of
98 the call to get_stab_string_offset. */
99 p = frag_more (12);
100 as_where (&file, (unsigned int *) NULL);
101 stroff = get_stab_string_offset (file, "$GDB_STRINGS$");
102 know (stroff == 1);
103 md_number_to_chars (p, stroff, 4);
104 seg_info (seg)->stabu.p = p;
105
106 /* Set the containing space for both stab sections to be $GDB_DEBUG$
107 (just created above). Also set some attributes which BFD does
108 not understand. In particular, access bits, sort keys, and load
109 quadrant. */
110 seg = bfd_get_section_by_name (stdoutput, "$GDB_STRINGS$");
111 obj_set_subsection_attributes (seg, space, 0x1f, 72, 0);
112 bfd_set_section_alignment (stdoutput, seg, 2);
113
114 subseg_set (saved_seg, saved_subseg);
115 }
116
117 /* Fill in the counts in the first entry in a .stabs section. */
118
119 static void
120 adjust_stab_sections (abfd, sec, xxx)
121 bfd *abfd;
122 asection *sec;
123 PTR xxx;
124 {
125 asection *strsec;
126 char *p;
127 int strsz, nsyms;
128
129 if (strcmp ("$GDB_SYMBOLS$", sec->name))
130 return;
131
132 strsec = bfd_get_section_by_name (abfd, "$GDB_STRINGS$");
133 if (strsec)
134 strsz = bfd_section_size (abfd, strsec);
135 else
136 strsz = 0;
137 nsyms = bfd_section_size (abfd, sec) / 12 - 1;
138
139 p = seg_info (sec)->stabu.p;
140 assert (p != 0);
141
142 bfd_h_put_16 (abfd, (bfd_vma) nsyms, (bfd_byte *) p + 6);
143 bfd_h_put_32 (abfd, (bfd_vma) strsz, (bfd_byte *) p + 8);
144 }
145
146 /* Called late in the asssembly phase to adjust the special
147 stab entry. This is where any other late object-file dependent
148 processing which should happen. */
149
150 void
151 som_frob_file ()
152 {
153 bfd_map_over_sections (stdoutput, adjust_stab_sections, (PTR) 0);
154 }
This page took 0.075316 seconds and 5 git commands to generate.