diff options
-rw-r--r-- | gas/ChangeLog | 10 | ||||
-rw-r--r-- | gas/config/obj-coff.c | 60 | ||||
-rw-r--r-- | gas/config/obj-coff.h | 21 |
3 files changed, 87 insertions, 4 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 01a7439..0454488 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -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 diff --git a/gas/config/obj-coff.c b/gas/config/obj-coff.c index e80eeb9..358e4da 100644 --- a/gas/config/obj-coff.c +++ b/gas/config/obj-coff.c @@ -27,6 +27,19 @@ #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; diff --git a/gas/config/obj-coff.h b/gas/config/obj-coff.h index 6574b35..b99e5b9 100644 --- a/gas/config/obj-coff.h +++ b/gas/config/obj-coff.h @@ -43,6 +43,18 @@ #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 @@ -58,6 +70,11 @@ #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)) |