+#if 0
+ /* Some tools want this to be 0, some tools want this to be one.
+ Today, it seems that 0 is the most important setting (PR1927) */
+ N_SET_FLAGS (*execp, 0x0);
+#else
+
+ /* Fri Jun 11 14:23:31 PDT 1993
+ FIXME
+ Today's optimal setting is 1. This is a pain, since it
+ reopens 1927. This should be readdressed by creating a new
+ target for each each supported, giving perhaps sun3/m68k
+ and sun4/sparc a.out formats.
+ */
+ N_SET_FLAGS (*execp, 1);
+#endif
+
+ N_SET_DYNAMIC(*execp, bfd_get_file_flags(abfd) & DYNAMIC);
+
+ /* At least for SunOS, the dynamic symbols and relocs are embedded
+ in the .text section, and we do not want to write them out with
+ the symbol table. FIXME: This may be right if there is any other
+ form of a.out shared libraries. */
+ if ((bfd_get_file_flags (abfd) & DYNAMIC) != 0
+ && bfd_get_outsymbols (abfd) != (asymbol **) NULL)
+ {
+ bfd_size_type i;
+ asymbol **sym_ptr_ptr;
+ bfd_size_type count;
+ arelent **rel_ptr_ptr;
+
+ sym_ptr_ptr = bfd_get_outsymbols (abfd);
+ count = bfd_get_symcount (abfd);
+ for (i = 0; i < count; i++, sym_ptr_ptr++)
+ {
+ if (((*sym_ptr_ptr)->flags & BSF_DYNAMIC) != 0)
+ {
+ /* This assumes that all dynamic symbols follow all
+ non-dynamic symbols, which is what slurp_symbol_table
+ does. */
+ *sym_ptr_ptr = NULL;
+ bfd_get_symcount (abfd) = i;
+ break;
+ }
+ }
+
+ if (obj_textsec (abfd)->reloc_count > 0)
+ {
+ rel_ptr_ptr = obj_textsec (abfd)->orelocation;
+ count = obj_textsec (abfd)->reloc_count;
+ for (i = 0; i < count; i++, rel_ptr_ptr++)
+ {
+ if (((*(*rel_ptr_ptr)->sym_ptr_ptr)->flags & BSF_DYNAMIC) != 0)
+ {
+ /* This assumes that all relocs against dynamic
+ symbols follow all relocs against other symbols,
+ which is what slurp_reloc_table does. */
+ *rel_ptr_ptr = NULL;
+ obj_textsec (abfd)->reloc_count = i;
+ break;
+ }
+ }
+ }
+
+ if (obj_datasec (abfd)->reloc_count > 0)
+ {
+ rel_ptr_ptr = obj_datasec (abfd)->orelocation;
+ count = obj_datasec (abfd)->reloc_count;
+ for (i = 0; i < count; i++, rel_ptr_ptr++)
+ {
+ if (((*(*rel_ptr_ptr)->sym_ptr_ptr)->flags & BSF_DYNAMIC) != 0)
+ {
+ *rel_ptr_ptr = NULL;
+ obj_datasec (abfd)->reloc_count = i;
+ break;
+ }
+ }
+ }
+ }
+
+ WRITE_HEADERS(abfd, execp);