* libaout.h (WRITE_HEADERS): Set header's a_text field always.
[deliverable/binutils-gdb.git] / bfd / aoutx.h
index 90267c025959486c46ab06bfdaee80105563a3df..08c5c99967907be6b9335e40424cb9f977449eea 100644 (file)
@@ -37,7 +37,7 @@ machine, including @code{sunos.c} - for sun3 and sun4 and
 
 The base file @code{aoutx.h} defines general mechanisms for reading
 and writing records to and from disk, and various other methods which
-bfd requires. It is included by @code{aout32.c} and @code{aout64.c} to
+BFD requires. It is included by @code{aout32.c} and @code{aout64.c} to
 form the names aout_32_swap_exec_header_in,
 aout_64_swap_exec_header_in, etc.
 
@@ -72,6 +72,37 @@ requires all the names from aout32.c, and produces the jump vector
     sunos_big_vec
 @end example
 
+The file host-aout.c is a special case.  It is for a large set of hosts
+that use ``more or less standard'' a.out files, and for which cross-debugging
+is not interesting.  It uses the standard 32-bit a.out support routines,
+but determines the file offsets and addresses of the text, data,
+and BSS sections, the machine architecture and machine type,
+and the entry point address, in a host-dependent manner.  Once these
+values have been determined, generic code is used to handle the 
+object file.
+
+When porting it to run on a new system, you must supply:
+
+        HOST_PAGE_SIZE
+        HOST_SEGMENT_SIZE
+        HOST_MACHINE_ARCH       (optional)
+        HOST_MACHINE_MACHINE    (optional)
+        HOST_TEXT_START_ADDR
+        HOST_STACK_END_ADDR
+
+in the file ../include/sys/h-XXX.h (for your host).  These values, plus
+the structures and macros defined in <a.out.h> on your host system, will
+produce a BFD target that will access ordinary a.out files on your host.
+
+To configure a new machine to use host-aout.c, specify:
+
+TDEFINES = -DDEFAULT_VECTOR=host_aout_big_vec
+TDEPFILES= host-aout.o trad-core.o
+
+in the config/t-XXX file, and modify configure.in to use the
+t-XXX file (by setting "bfd_target=XXX") when your configuration is
+selected.
+
 */
 
 #define KEEPIT flags
@@ -199,7 +230,8 @@ DEFUN(hlo10,(abfd, reloc_entry, symbol_in, data, input_section),
   return bfd_reloc_ok;
 }
 
-static r64() 
+static bfd_reloc_status_enum_type
+r64() 
 {
   abort();
 }
@@ -507,7 +539,7 @@ DEFUN(NAME(aout,some_aout_object_p),(abfd, callback_to_real_object_p),
 /*doc*
 *i aout_<size>_mkobject
 
-This routine initializes a bfd for use with a.out files.
+This routine initializes a BFD for use with a.out files.
 
 *; PROTO(boolean, aout_<size>_mkobject, (bfd *));
 */
@@ -601,7 +633,7 @@ DEFUN(NAME(aout,machine_type),(arch, machine),
 /*doc*
 *i aout_<size>_set_arch_mach
 
-Sets the architecture and the machine of the bfd to those values
+Sets the architecture and the machine of the BFD to those values
 supplied. Verifies that the format can support the architecture
 required.
 
@@ -628,7 +660,7 @@ DEFUN(NAME(aout,set_arch_mach),(abfd, arch, machine),
 /*doc*
 *i aout_<size>new_section_hook
 
-Called by the bfd in response to a @code{bfd_make_section} request.
+Called by the BFD in response to a @code{bfd_make_section} request.
 *; PROTO(boolean, aout_<size>_new_section_hook,
          (bfd *abfd,
          asection *newsect));
@@ -671,26 +703,37 @@ DEFUN(NAME(aout,set_section_contents),(abfd, section, location, offset, count),
       bfd_size_type count)
 {
   if (abfd->output_has_begun == false)
-      {                                /* set by bfd.c handler */
-       if ((obj_textsec (abfd) == NULL) || (obj_datasec (abfd) == NULL)) 
-           {
-             bfd_error = invalid_operation;
-             return false;
+    {                          /* set by bfd.c handler */
+      switch (abfd->direction)
+       {
+         case read_direction:
+         case no_direction:
+           bfd_error = invalid_operation;
+           return false;
+
+         case both_direction:
+           break;
+
+         case write_direction:
+           if ((obj_textsec (abfd) == NULL) || (obj_datasec (abfd) == NULL)) 
+               {
+                 bfd_error = invalid_operation;
+                 return false;
+               }
+           /*if (abfd->flags & D_PAGED) {        
+             obj_textsec(abfd)->filepos = 0;
            }
-/*     if (abfd->flags & D_PAGED) {      
-         obj_textsec(abfd)->filepos = 0;
-       }
-       else*/ {
-         obj_textsec(abfd)->filepos = EXEC_BYTES_SIZE;
+           else*/ {
+             obj_textsec(abfd)->filepos = EXEC_BYTES_SIZE;
+           }
+           obj_textsec(abfd)->size = align_power(obj_textsec(abfd)->size,
+                                                 obj_textsec(abfd)->alignment_power);
+           obj_datasec(abfd)->filepos =  obj_textsec (abfd)->size + EXEC_BYTES_SIZE;
+           obj_datasec(abfd)->size = align_power(obj_datasec(abfd)->size,
+                                               obj_datasec(abfd)->alignment_power);
        }
-       obj_textsec(abfd)->size = align_power(obj_textsec(abfd)->size,
-                                             obj_textsec(abfd)->alignment_power);
-       obj_datasec(abfd)->filepos =  obj_textsec (abfd)->size + EXEC_BYTES_SIZE;
-       obj_datasec(abfd)->size = align_power(obj_datasec(abfd)->size,
-                                             obj_datasec(abfd)->alignment_power);
-         
-         
-      }
+    }
+
   /* regardless, once we know what we're doing, we might as well get going */
   if (section != obj_bsssec(abfd)) 
       {
@@ -1090,7 +1133,7 @@ DEFUN(NAME(aout,write_syms),(abfd),
       
       
       
-      translate_to_native_sym_flags (&nsp, (PTR)g, abfd);
+      translate_to_native_sym_flags (&nsp, g, abfd);
       
       bfd_write((PTR)&nsp,1,EXTERNAL_LIST_SIZE, abfd);
     }
@@ -1681,7 +1724,7 @@ DEFUN(NAME(aout,print_symbol),(ignore_abfd, afile, symbol, how),
 }
 
 /* 
- provided a bfd, a section and an offset into the section, calculate
+ provided a BFD, a section and an offset into the section, calculate
  and return the name of the source file and the line nearest to the
  wanted location.
 */
This page took 0.028 seconds and 4 git commands to generate.