name = segment_info[i].scnhdr.s_name;
name = segment_info[i].name;
write_object_file (){  int i;  char *name;  struct frchain *frchain_ptr;  object_headers headers;  unsigned long file_cursor;  bfd *abfd;  unsigned int addr;  abfd = bfd_openw (out_file_name, TARGET_FORMAT);  if (abfd == 0)    {      as_perror ("FATAL: Can't create %s", out_file_name);      exit (EXIT_FAILURE);    }  bfd_set_format (abfd, bfd_object);  bfd_set_arch_mach (abfd, BFD_ARCH, machine);  string_byte_count = 4;  for (frchain_ptr = frchain_root;       frchain_ptr != (struct frchain *) NULL;       frchain_ptr = frchain_ptr->frch_next)    {      /* Run through all the sub-segments and align them up.  Also	 close any open frags.  We tack a .fill onto the end of the	 frag chain so that any .align's size can be worked by looking	 at the next frag.  */      subseg_set (frchain_ptr->frch_seg, frchain_ptr->frch_subseg);#ifndef SUB_SEGMENT_ALIGN#define SUB_SEGMENT_ALIGN(SEG) 1#endif#ifdef md_do_align      {	static char nop = NOP_OPCODE;	md_do_align (SUB_SEGMENT_ALIGN (now_seg), &nop, alignment_done);      }#endif      frag_align (SUB_SEGMENT_ALIGN (now_seg), NOP_OPCODE);#ifdef md_do_align    alignment_done:#endif      frag_wane (frag_now);      frag_now->fr_fix = 0;      know (frag_now->fr_next == NULL);    }  remove_subsegs ();  for (i = SEG_E0; i < SEG_UNKNOWN; i++)    {      relax_segment (segment_info[i].frchainP->frch_root, i);    }  H_SET_NUMBER_OF_SECTIONS (&headers, 0);  /* Find out how big the sections are, and set the addresses.  */  addr = 0;  for (i = SEG_E0; i < SEG_UNKNOWN; i++)    {      long size;      segment_info[i].scnhdr.s_paddr = addr;      segment_info[i].scnhdr.s_vaddr = addr;      if (segment_info[i].scnhdr.s_name[0])	{	  H_SET_NUMBER_OF_SECTIONS (&headers,				    H_GET_NUMBER_OF_SECTIONS (&headers) + 1);	}      size = size_section (abfd, (unsigned int) i);      addr += size;      /* I think the section alignment is only used on the i960; the	 i960 needs it, and it should do no harm on other targets.  */      segment_info[i].scnhdr.s_align = section_alignment[i];      if (i == SEG_E0)	H_SET_TEXT_SIZE (&headers, size);      else if (i == SEG_E1)	H_SET_DATA_SIZE (&headers, size);      else if (i == SEG_E2)	H_SET_BSS_SIZE (&headers, size);    }  /* Turn the gas native symbol table shape into a coff symbol table */  crawl_symbols (&headers, abfd);  if (string_byte_count == 4)    string_byte_count = 0;  H_SET_STRING_SIZE (&headers, string_byte_count);#ifdef tc_frob_file  tc_frob_file ();#endif  for (i = SEG_E0; i < SEG_UNKNOWN; i++)    {      fixup_mdeps (segment_info[i].frchainP->frch_root, &headers, i);      fixup_segment (&segment_info[i], i);    }  /* 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);  /* Plant the data */  fill_section (abfd, &headers, &file_cursor);  do_relocs_for (abfd, &headers, &file_cursor);  do_linenos_for (abfd, &headers, &file_cursor);  H_SET_FILE_MAGIC_NUMBER (&headers, COFF_MAGIC);#ifndef OBJ_COFF_OMIT_TIMESTAMP  H_SET_TIME_STAMP (&headers, (long)time((time_t *)0));#else  H_SET_TIME_STAMP (&headers, 0);#endif#ifdef TC_COFF_SET_MACHINE  TC_COFF_SET_MACHINE (&headers);#endif#ifndef COFF_FLAGS#define COFF_FLAGS 0#endif#ifdef KEEP_RELOC_INFO  H_SET_FLAGS (&headers, ((H_GET_LINENO_SIZE(&headers) ? 0 : F_LNNO) |			  COFF_FLAGS | coff_flags));#else  H_SET_FLAGS (&headers, ((H_GET_LINENO_SIZE(&headers)     ? 0 : F_LNNO)   |			  (H_GET_RELOCATION_SIZE(&headers) ? 0 : F_RELFLG) |			  COFF_FLAGS | coff_flags));#endif  {    unsigned int symtable_size = H_GET_SYMBOL_TABLE_SIZE (&headers);    char *buffer1 = xmalloc (symtable_size + string_byte_count + 1);    H_SET_SYMBOL_TABLE_POINTER (&headers, bfd_tell (abfd));    w_symbols (abfd, buffer1, symbol_rootP);    if (string_byte_count > 0)      w_strings (buffer1 + symtable_size);    bfd_write (buffer1, 1, symtable_size + string_byte_count, abfd);    free (buffer1);  }  coff_header_append (abfd, &headers);#if 0  /* Recent changes to write need this, but where it should     go is up to Ken.. */  if (bfd_close_all_done (abfd) == false)    as_fatal ("Can't close %s: %s", out_file_name,	      bfd_errmsg (bfd_get_error ()));#else  {    extern bfd *stdoutput;    stdoutput = abfd;  }#endif}