diff options
author | Stan Shebs <shebs@codesourcery.com> | 1993-09-28 19:22:08 +0000 |
---|---|---|
committer | Stan Shebs <shebs@codesourcery.com> | 1993-09-28 19:22:08 +0000 |
commit | 8f3956b3284c9197d83d0032358b47f9cf4245a8 (patch) | |
tree | 851d2f73083d7f0a9fe6715ecd6c0f33dc3bf945 /gas | |
parent | 5573d7d4b1ed201ca3ac71dcdcf359d7eda8c3d3 (diff) | |
download | gdb-8f3956b3284c9197d83d0032358b47f9cf4245a8.zip gdb-8f3956b3284c9197d83d0032358b47f9cf4245a8.tar.gz gdb-8f3956b3284c9197d83d0032358b47f9cf4245a8.tar.bz2 |
More Lynx support, plus better stabs-in-coff generation.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 20 | ||||
-rw-r--r-- | gas/config/obj-coffbfd.c | 91 | ||||
-rw-r--r-- | gas/config/obj-coffbfd.h | 16 | ||||
-rw-r--r-- | gas/config/te-lynx.h | 3 |
4 files changed, 126 insertions, 4 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 10659f0..adbeaef 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,23 @@ +Tue Sep 28 12:02:04 1993 Stan Shebs (shebs@rtl.cygnus.com) + + * configure.in: Split i386 LynxOS out from other coff targets, + add a specific Lynx emulation. + Add m68k LynxOS target. + * config/tc-i386.c: Define specific Lynx target format. + * config/tc-m68k.c: Define specific Lynx target format. + * config/te-lynx.h: New file. + + * config/obj-coffbfd.h: Don't set TARGET_FORMAT to be + "coff-{i386,m68k}" if TARGET_FORMAT already defined. + (INIT_STAB_SECTION): Define. + * config/obj-coffbfd.c: Include <time.h>. + (write_object_file): Look for .stab sections and call + adjust_stab_section. + (adjust_stab_section): New function, fills in the first symbol + of a stab section with number of symbols and string table size. + (obj_coff_init_stab_section): New function, creates the initial + symbol for a stab section. + Mon Sep 27 15:21:55 1993 Ken Raeburn (raeburn@cambridge.cygnus.com) * config/atof-vax.c (md_atof): Return null on success instead of diff --git a/gas/config/obj-coffbfd.c b/gas/config/obj-coffbfd.c index dd5e1e7..b73dbff 100644 --- a/gas/config/obj-coffbfd.c +++ b/gas/config/obj-coffbfd.c @@ -40,6 +40,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "obstack.h" #include "subsegs.h" #include "frags.h" +/* This is needed because we include internal bfd things. */ +#include <time.h> #include "../bfd/libbfd.h" #include "../bfd/libcoff.h" @@ -76,7 +78,6 @@ const short seg_N_TYPE[] = C_REGISTER_SECTION, /* SEG_REGISTER */ }; - int function_lineoff = -1; /* Offset in line#s where the last function started (the odd entry for line #0) */ @@ -1811,6 +1812,7 @@ extern void DEFUN_VOID (write_object_file) { int i; + char *name; struct frchain *frchain_ptr; object_headers headers; @@ -1902,6 +1904,18 @@ DEFUN_VOID (write_object_file) } #endif + /* Look for ".stab" segments and fill in their initial symbols + correctly. */ + for (i = SEG_E0; i < SEG_UNKNOWN; i++) + { + name = segment_info[i].scnhdr.s_name; + + if (name != NULL + && strncmp (".stab", name, 5) == 0 + && strncmp (".stabstr", name, 8) != 0) + adjust_stab_section (abfd, i); + } + file_cursor = H_GET_TEXT_FILE_OFFSET (&headers); bfd_seek (abfd, (file_ptr) file_cursor, 0); @@ -1943,7 +1957,7 @@ DEFUN_VOID (write_object_file) } coff_header_append (abfd, &headers); - + if (bfd_close_all_done (abfd) == false) as_fatal ("Can't close %s: %s", out_file_name, bfd_errmsg (bfd_error)); @@ -2628,3 +2642,76 @@ DEFUN (fixup_segment, (segP, this_segment_type), } /* fixup_segment() */ #endif + +/* The first entry in a .stab section is special. */ + +void +obj_coff_init_stab_section (seg) + segT seg; +{ + extern char *logical_input_file, *physical_input_file; + char *p; + const char *file; + unsigned int stroff; + + /* Make space for this first symbol. */ + p = frag_more (12); + file = logical_input_file; + if (file == NULL) + file = physical_input_file; + if (file == NULL) + file = "UNKNOWN"; + stroff = get_stab_string_offset (file, segment_info[seg].scnhdr.s_name); + know (stroff == 1); + md_number_to_chars (p, stroff, 4); +} + +/* Fill in the counts in the first entry in a .stab section. */ + +adjust_stab_section(abfd, seg) + bfd *abfd; + segT seg; +{ + segT stabstrseg = -1; + char *secname, *name, *name2; + asection *stabsec, *stabstrsec; + char *p = NULL; + int i, strsz = 0, nsyms; + fragS *frag = segment_info[seg].frchainP->frch_root; + + /* Look for the associated string table section. */ + + secname = segment_info[seg].scnhdr.s_name; + name = (char *) alloca (strlen (secname) + 4); + strcpy (name, secname); + strcat (name, "str"); + + for (i = SEG_E0; i < SEG_UNKNOWN; i++) + { + name2 = segment_info[i].scnhdr.s_name; + if (name2 != NULL && strncmp(name2, name, 8) == 0) + { + stabstrseg = i; + break; + } + } + + /* If we found the section, get its size. */ + if (stabstrseg >= 0) + strsz = size_section (abfd, stabstrseg); + + nsyms = size_section (abfd, seg) / 12 - 1; + + /* Look for the first frag of sufficient size for the initial stab + symbol, and collect a pointer to it. */ + while (frag && frag->fr_fix < 12) + frag = frag->fr_next; + assert (frag != 0); + p = frag->fr_literal; + assert (p != 0); + + /* Write in the number of stab symbols and the size of the string + table. */ + bfd_h_put_16 (abfd, (bfd_vma) nsyms, (bfd_byte *) p + 6); + bfd_h_put_32 (abfd, (bfd_vma) strsz, (bfd_byte *) p + 8); +} diff --git a/gas/config/obj-coffbfd.h b/gas/config/obj-coffbfd.h index 659c709..59a28df 100644 --- a/gas/config/obj-coffbfd.h +++ b/gas/config/obj-coffbfd.h @@ -61,8 +61,10 @@ #ifdef TC_M68K #include "coff/m68k.h" +#ifndef TARGET_FORMAT #define TARGET_FORMAT "coff-m68k" #endif +#endif #ifdef TC_M88K #include "coff/m88k.h" @@ -71,8 +73,10 @@ #ifdef TC_I386 #include "coff/i386.h" +#ifndef TARGET_FORMAT #define TARGET_FORMAT "coff-i386" #endif +#endif #ifdef TC_A29K #include "coff/a29k.h" @@ -522,7 +526,6 @@ extern struct internal_scnhdr text_section_header; extern SCNHDR data_section_header; extern SCNHDR text_section_header; #endif -#endif /* Forward the segment of a forwarded symbol. */ #define obj_frob_forward_symbol(symp) \ @@ -530,6 +533,15 @@ extern SCNHDR text_section_header; ? (S_SET_SEGMENT (symp, S_GET_SEGMENT (symp->sy_value.X_add_symbol)), 0) \ : 0) +/* Stabs in a coff file go into their own section. */ + #define SEPARATE_STAB_SECTIONS -/* end of obj-coffbfd.h */ +/* We need 12 bytes at the start of the section to hold some initial + information. */ + +extern void obj_coff_init_stab_section PARAMS ((segT)); + +#define INIT_STAB_SECTION(seg) obj_coff_init_stab_section (seg) + +#endif /* OBJ_FORMAT_H */ diff --git a/gas/config/te-lynx.h b/gas/config/te-lynx.h new file mode 100644 index 0000000..eaca2e6 --- /dev/null +++ b/gas/config/te-lynx.h @@ -0,0 +1,3 @@ +#define TE_LYNX + +#include "obj-format.h" |