+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
#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"
C_REGISTER_SECTION, /* SEG_REGISTER */
};
-
int function_lineoff = -1; /* Offset in line#s where the last function
started (the odd entry for line #0) */
DEFUN_VOID (write_object_file)
{
int i;
+ char *name;
struct frchain *frchain_ptr;
object_headers headers;
}
#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);
}
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));
} /* 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);
+}
#ifdef TC_M68K
#include "coff/m68k.h"
+#ifndef TARGET_FORMAT
#define TARGET_FORMAT "coff-m68k"
#endif
+#endif
#ifdef TC_M88K
#include "coff/m88k.h"
#ifdef TC_I386
#include "coff/i386.h"
+#ifndef TARGET_FORMAT
#define TARGET_FORMAT "coff-i386"
#endif
+#endif
#ifdef TC_A29K
#include "coff/a29k.h"
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) \
? (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 */