* coffcode.h (bfd_coff_backend_data): Add _bfd_filnmlen field.
authorIan Lance Taylor <ian@airs.com>
Tue, 7 Sep 1999 04:28:27 +0000 (04:28 +0000)
committerIan Lance Taylor <ian@airs.com>
Tue, 7 Sep 1999 04:28:27 +0000 (04:28 +0000)
(bfd_coff_filnmlen): Define.
(bfd_coff_std_swap_table): Initialize new field.
* coffgen.c (coff_fix_symbol_name): Use bfd_coff_filnmlen rather
than FILNMLEN.
(coff_write_symbols): Likewise.
(coff_get_normalized_symtab): Likewise.
* coff-sh.c (bfd_coff_small_swap_table): Initialize new field.
* libcoff.h: Rebuild.

bfd/ChangeLog
bfd/coff-sh.c
bfd/coffcode.h
bfd/coffgen.c
bfd/libcoff.h

index b8746f7f1fd4c98ec35a77588a996a3cbe8c2c2a..c525397c070c3eff6a5290c97d8709664baf80c8 100644 (file)
@@ -1,3 +1,15 @@
+1999-09-07  Ian Lance Taylor  <ian@zembu.com>
+
+       * coffcode.h (bfd_coff_backend_data): Add _bfd_filnmlen field.
+       (bfd_coff_filnmlen): Define.
+       (bfd_coff_std_swap_table): Initialize new field.
+       * coffgen.c (coff_fix_symbol_name): Use bfd_coff_filnmlen rather
+       than FILNMLEN.
+       (coff_write_symbols): Likewise.
+       (coff_get_normalized_symtab): Likewise.
+       * coff-sh.c (bfd_coff_small_swap_table): Initialize new field.
+       * libcoff.h: Rebuild.
+
 1999-09-06  Donn Terry  <donn@interix.com>
 
        * coffcode.h (sort_by_secaddr): New static function if
index a6eebf8ea2ae06f4e9f9443b974472fbabf32164..1763f831328a9a9287209299bd9d15a4d3442860 100644 (file)
@@ -2748,7 +2748,7 @@ static const bfd_coff_backend_data bfd_coff_small_swap_table =
   coff_swap_lineno_out, coff_swap_reloc_out,
   coff_swap_filehdr_out, coff_swap_aouthdr_out,
   coff_swap_scnhdr_out,
-  FILHSZ, AOUTSZ, SCNHSZ, SYMESZ, AUXESZ, RELSZ, LINESZ,
+  FILHSZ, AOUTSZ, SCNHSZ, SYMESZ, AUXESZ, RELSZ, LINESZ, FILNMLEN,
 #ifdef COFF_LONG_FILENAMES
   true,
 #else
index f98d9b013c4e83f023308a09a76f93971b640e62..36bf3e759772b91e89891af358c57d758898bce3 100644 (file)
@@ -1014,6 +1014,7 @@ dependent COFF routines:
 . unsigned int _bfd_auxesz;
 . unsigned int _bfd_relsz;
 . unsigned int _bfd_linesz;
+. unsigned int _bfd_filnmlen;
 . boolean _bfd_coff_long_filenames;
 . boolean _bfd_coff_long_section_names;
 . unsigned int _bfd_coff_default_section_alignment_power;
@@ -1175,6 +1176,7 @@ dependent COFF routines:
 .#define bfd_coff_auxesz(abfd) (coff_backend_info (abfd)->_bfd_auxesz)
 .#define bfd_coff_relsz(abfd)  (coff_backend_info (abfd)->_bfd_relsz)
 .#define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz)
+.#define bfd_coff_filnmlen(abfd) (coff_backend_info (abfd)->_bfd_filnmlen)
 .#define bfd_coff_long_filenames(abfd) (coff_backend_info (abfd)->_bfd_coff_long_filenames)
 .#define bfd_coff_long_section_names(abfd) \
 .        (coff_backend_info (abfd)->_bfd_coff_long_section_names)
@@ -4713,16 +4715,14 @@ coff_final_link_postscript (abfd, pfinfo)
 #define coff_SWAP_scnhdr_in coff_swap_scnhdr_in
 #endif
 
-
-
-static CONST bfd_coff_backend_data bfd_coff_std_swap_table =
+static const bfd_coff_backend_data bfd_coff_std_swap_table =
 {
   coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in,
   coff_SWAP_aux_out, coff_SWAP_sym_out,
   coff_SWAP_lineno_out, coff_SWAP_reloc_out,
   coff_SWAP_filehdr_out, coff_SWAP_aouthdr_out,
   coff_SWAP_scnhdr_out,
-  FILHSZ, AOUTSZ, SCNHSZ, SYMESZ, AUXESZ, RELSZ, LINESZ,
+  FILHSZ, AOUTSZ, SCNHSZ, SYMESZ, AUXESZ, RELSZ, LINESZ, FILNMLEN,
 #ifdef COFF_LONG_FILENAMES
   true,
 #else
index a1048874e9de3cae09fc03c31819a97d0c610b1a..feb57a35fc0d6313fe4d408d99641a3a16d0378f 100644 (file)
@@ -811,14 +811,18 @@ coff_fix_symbol_name (abfd, symbol, native, string_size_p,
   if (native->u.syment.n_sclass == C_FILE
       && native->u.syment.n_numaux > 0)
     {
+      unsigned int filnmlen;
+
       strncpy (native->u.syment._n._n_name, ".file", SYMNMLEN);
       auxent = &(native + 1)->u.auxent;
 
+      filnmlen = bfd_coff_filnmlen (abfd);
+
       if (bfd_coff_long_filenames (abfd))
        {
-         if (name_length <= FILNMLEN)
+         if (name_length <= filnmlen)
            {
-             strncpy (auxent->x_file.x_fname, name, FILNMLEN);
+             strncpy (auxent->x_file.x_fname, name, filnmlen);
            }
          else
            {
@@ -829,11 +833,9 @@ coff_fix_symbol_name (abfd, symbol, native, string_size_p,
        }
       else
        {
-         strncpy (auxent->x_file.x_fname, name, FILNMLEN);
-         if (name_length > FILNMLEN)
-           {
-             name[FILNMLEN] = '\0';
-           }
+         strncpy (auxent->x_file.x_fname, name, filnmlen);
+         if (name_length > filnmlen)
+           name[filnmlen] = '\0';
        }
     }
   else
@@ -1247,7 +1249,7 @@ coff_write_symbols (abfd)
            }
          else if (c_symbol->native->u.syment.n_sclass == C_FILE
                   && c_symbol->native->u.syment.n_numaux > 0)
-           maxlen = FILNMLEN;
+           maxlen = bfd_coff_filnmlen (abfd);
          else
            maxlen = SYMNMLEN;
 
@@ -1765,7 +1767,7 @@ coff_get_normalized_symtab (abfd)
                    ((long)
                     copy_name (abfd,
                                (internal_ptr + 1)->u.auxent.x_file.x_fname,
-                               FILNMLEN));
+                               bfd_coff_filnmlen (abfd)));
                }
            }
        }
index 0bad48b372ed8d0e8a6eb5e76479e22baab7214b..bee4ce9e85876e02f86aee3908fb4901c79bc479 100644 (file)
@@ -709,6 +709,7 @@ typedef struct
  unsigned int _bfd_auxesz;
  unsigned int _bfd_relsz;
  unsigned int _bfd_linesz;
+ unsigned int _bfd_filnmlen;
  boolean _bfd_coff_long_filenames;
  boolean _bfd_coff_long_section_names;
  unsigned int _bfd_coff_default_section_alignment_power;
@@ -870,6 +871,7 @@ typedef struct
 #define bfd_coff_auxesz(abfd) (coff_backend_info (abfd)->_bfd_auxesz)
 #define bfd_coff_relsz(abfd)  (coff_backend_info (abfd)->_bfd_relsz)
 #define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz)
+#define bfd_coff_filnmlen(abfd) (coff_backend_info (abfd)->_bfd_filnmlen)
 #define bfd_coff_long_filenames(abfd) (coff_backend_info (abfd)->_bfd_coff_long_filenames)
 #define bfd_coff_long_section_names(abfd) \
         (coff_backend_info (abfd)->_bfd_coff_long_section_names)