Support for long filenames non-bfd coff. bfd/7288
authorSteve Chamberlain <sac@cygnus>
Fri, 30 Jun 1995 00:53:37 +0000 (00:53 +0000)
committerSteve Chamberlain <sac@cygnus>
Fri, 30 Jun 1995 00:53:37 +0000 (00:53 +0000)
* config/obj-coff.c (filename_list_head, filename_list_tail): New.
(yank_symbols): Notice and record filenames which are too long.
(w_strings): Write out filename strings.
(c_dot_file_symbols): Put long filenames onto list.

gas/ChangeLog
gas/config/obj-coff.c
gas/config/obj-coff.h

index 01a7439a8f9395611ad20598da9ea2a95927c568..045448842e58b4ab7db2b48bbf2d3354b5f24dbc 100644 (file)
@@ -1,6 +1,14 @@
+Thu Jun 29 17:25:43 1995  Steve Chamberlain  <sac@slash.cygnus.com>
+
+       Support for long filenames non-bfd coff. bfd/7288
+       * config/obj-coff.c (filename_list_head, filename_list_tail): New.
+       (yank_symbols): Notice and record filenames which are too long.
+       (w_strings): Write out filename strings.
+       (c_dot_file_symbols): Put long filenames onto list.
+
 Wed Jun 28 17:33:13 1995  Steve Chamberlain  <sac@slash.cygnus.com>
 
-       * config/obj-coff.c (fixup_segment): PE doens't use
+       * config/obj-coff.c (fixup_segment): PE doesn't use
        the strange common symbol format that other 386s formats
        do.
        * config/tc-i386.c (md_begin): If LEX_AT defined then
index e80eeb9df3337193ab895695282cbdf866ed12b8..358e4da0cb137b2c0675d006eaba060a9a3534d7 100644 (file)
 #define KEEP_RELOC_INFO
 #endif
 
+
+/* structure used to keep the filenames which
+   are too long around so that we can stick them
+   into the string table */
+struct filename_list 
+{
+  char *filename;
+  struct filename_list *next;
+};
+
+static struct filename_list *filename_list_head;
+static struct filename_list *filename_list_tail;
+
 const char *s_get_name PARAMS ((symbolS * s));
 static symbolS *def_symbol_in_progress;
 
@@ -2443,6 +2456,8 @@ yank_symbols ()
   unsigned int symbol_number = 0;
   unsigned int last_file_symno = 0;
 
+  struct filename_list *filename_list_scan = filename_list_head;
+
   for (symbolP = symbol_rootP;
        symbolP;
        symbolP = symbolP ? symbol_next (symbolP) : symbol_rootP)
@@ -2568,6 +2583,14 @@ yank_symbols ()
        }
       else if (S_GET_STORAGE_CLASS (symbolP) == C_FILE)
        {
+         /* If the filename was too long to fit in the
+            auxent, put it in the string table */
+         if (SA_GET_FILE_FNAME_ZEROS (symbolP) == 0)
+           {
+             SA_SET_FILE_FNAME_OFFSET (symbolP, string_byte_count);
+             string_byte_count += strlen (filename_list_scan->filename) + 1;
+             filename_list_scan = filename_list_scan->next;
+           }
          if (S_GET_VALUE (symbolP))
            {
              S_SET_VALUE (symbolP, last_file_symno);
@@ -2751,6 +2774,7 @@ w_strings (where)
      char *where;
 {
   symbolS *symbolP;
+  struct filename_list *filename_list_scan = filename_list_head;
 
   /* Gotta do md_ byte-ordering stuff for string_byte_count first - KWK */
   md_number_to_chars (where, (valueT) string_byte_count, 4);
@@ -2764,10 +2788,16 @@ w_strings (where)
       if (SF_GET_STRING (symbolP))
        {
          size = strlen (S_GET_NAME (symbolP)) + 1;
-
          memcpy (where, S_GET_NAME (symbolP), size);
          where += size;
-
+       }
+      if (S_GET_STORAGE_CLASS (symbolP) == C_FILE
+         && SA_GET_FILE_FNAME_ZEROS (symbolP) == 0)
+       {
+         size = strlen (filename_list_scan->filename) + 1;
+         memcpy (where, filename_list_scan->filename, size);
+         filename_list_scan = filename_list_scan ->next;
+         where += size;
        }
     }
 }
@@ -3272,7 +3302,31 @@ c_dot_file_symbol (filename)
 
   S_SET_STORAGE_CLASS (symbolP, C_FILE);
   S_SET_NUMBER_AUXILIARY (symbolP, 1);
-  SA_SET_FILE_FNAME (symbolP, filename);
+
+  if (strlen (filename) > FILNMLEN)
+    {
+      /* Filename is too long to fit into an auxent,
+        we stick it into the string table instead.  We keep
+        a linked list of the filenames we find so we can emit
+        them later.*/
+      struct filename_list *f = xmalloc (sizeof (struct filename_list));
+
+      f->filename = filename;
+      f->next = 0;
+
+      SA_SET_FILE_FNAME_ZEROS (symbolP, 0);
+      SA_SET_FILE_FNAME_OFFSET (symbolP, 0);
+
+      if (filename_list_tail) 
+       filename_list_tail->next = f;
+      else
+       filename_list_head = f;
+      filename_list_tail = f;      
+    }
+  else 
+    {
+      SA_SET_FILE_FNAME (symbolP, filename);
+    }
 #ifndef NO_LISTING
   {
     extern int listing;
index 6574b35dbdd8a460cb84225a8eea08d0046c5fba..b99e5b91862efd30c8d9da6ef3a98b6e7b560b1b 100644 (file)
 #undef internal_lineno
 
 /* CPU-specific setup:  */
+
+#ifdef TC_ARM
+#include "coff/arm.h"
+
+#ifdef TE_PE
+#define TARGET_FORMAT "pe-arm"
+#endif
+#ifndef TARGET_FORMAT
+#define TARGET_FORMAT "coff-arm"
+#endif
+#endif
+
 #ifdef TC_PPC
 #include "coff/rs6000.h"
 #endif
 
 #ifdef TC_I386
 #include "coff/i386.h"
+
+#ifdef TE_PE
+#define TARGET_FORMAT "pe-i386"
+#endif
+
 #ifndef TARGET_FORMAT
 #define TARGET_FORMAT "coff-i386"
 #endif
@@ -481,6 +498,8 @@ typedef struct
 #define SA_GET_SYM_ENDNDX(s)   (SYM_AUXENT (s)->x_sym.x_fcnary.x_fcn.x_endndx.l)
 #define SA_GET_SYM_DIMEN(s,i)  (SYM_AUXENT (s)->x_sym.x_fcnary.x_ary.x_dimen[(i)])
 #define SA_GET_FILE_FNAME(s)   (SYM_AUXENT (s)->x_file.x_fname)
+#define SA_GET_FILE_FNAME_OFFSET(s)  (SYM_AUXENT (s)->x_file.x_n.x_offset)
+#define SA_GET_FILE_FNAME_ZEROS(s)   (SYM_AUXENT (s)->x_file.x_n.x_zeroes)
 #define SA_GET_SCN_SCNLEN(s)   (SYM_AUXENT (s)->x_scn.x_scnlen)
 #define SA_GET_SCN_NRELOC(s)   (SYM_AUXENT (s)->x_scn.x_nreloc)
 #define SA_GET_SCN_NLINNO(s)   (SYM_AUXENT (s)->x_scn.x_nlinno)
@@ -494,6 +513,8 @@ typedef struct
 #define SA_SET_SYM_ENDNDX(s,v) (SYM_AUXENT (s)->x_sym.x_fcnary.x_fcn.x_endndx.l=(v))
 #define SA_SET_SYM_DIMEN(s,i,v)        (SYM_AUXENT (s)->x_sym.x_fcnary.x_ary.x_dimen[(i)]=(v))
 #define SA_SET_FILE_FNAME(s,v) strncpy(SYM_AUXENT (s)->x_file.x_fname,(v),FILNMLEN)
+#define SA_SET_FILE_FNAME_OFFSET(s,v) (SYM_AUXENT (s)->x_file.x_n.x_offset=(v))
+#define SA_SET_FILE_FNAME_ZEROS(s,v)  (SYM_AUXENT (s)->x_file.x_n.x_zeroes=(v))
 #define SA_SET_SCN_SCNLEN(s,v) (SYM_AUXENT (s)->x_scn.x_scnlen=(v))
 #define SA_SET_SCN_NRELOC(s,v) (SYM_AUXENT (s)->x_scn.x_nreloc=(v))
 #define SA_SET_SCN_NLINNO(s,v) (SYM_AUXENT (s)->x_scn.x_nlinno=(v))
This page took 0.052017 seconds and 4 git commands to generate.