From 412222d910b7776967c56d97482e863fcd6c7aa0 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 20 Oct 1997 19:23:09 +0000 Subject: [PATCH] various evax patches --- bfd/ChangeLog | 26 ++++++++++- bfd/configure.com | 135 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ bfd/evax-alpha.c | 2 - bfd/evax-egsd.c | 34 ++++++++------ bfd/evax-emh.c | 6 +-- bfd/evax-etir.c | 13 +++--- bfd/evax-misc.c | 31 +++++++++---- bfd/evax.h | 7 +-- 8 files changed, 215 insertions(+), 39 deletions(-) create mode 100644 bfd/configure.com diff --git a/bfd/ChangeLog b/bfd/ChangeLog index b240295..aca3517 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,6 +1,30 @@ Mon Oct 20 15:01:27 1997 Klaus K"ampf - * evax-egsd.c: make section flags dec c compatible + * evax-egsd.c: Weak symbols are global. + + * evax-emh.c: Use proper casts. + + * evax-egsd.c (_bfd_evax_write_egsd): Remove unneeded uname. + + * evax-egsd.c: Section names and symbols have different + length restrictions. Add length parameter to + _bfd_evax_length_hash_symbol. + * evax-etir.c: Likewise. + * evax-misc.c (_bfd_evax_length_hash_symbol): Add length + parameter. + * evax.h (EOBJ_S_C_SECSIZ): Define. + + * evax-alpha.c: Remove duplicate test. + + * evax-emh.c: SYS$ functions are upper-case. + + * evax-egsd.c: Create separate sections for common symbols. + * evax-etir.c: Don't output common section. + * evax.h: Bump up section count. + + * configure.com: Use 64bit integers with DEC C. + + * evax-egsd.c: Make section flags dec c compatible. Mon Oct 20 09:38:31 1997 Jeffrey A Law (law@cygnus.com) diff --git a/bfd/configure.com b/bfd/configure.com new file mode 100644 index 0000000..b4d6486 --- /dev/null +++ b/bfd/configure.com @@ -0,0 +1,135 @@ +$! +$! This file configures the bfd library for use with openVMS/Alpha +$! We do not use the configure script, since we do not have /bin/sh +$! to execute it. +$! +$! Written by Klaus K"ampf (kkaempf@progis.de) +$! +$arch_indx = 1 + ((f$getsyi("CPU").ge.128).and.1) ! vax==1, alpha==2 +$arch = f$element(arch_indx,"|","|VAX|Alpha|") +$if arch .eqs. "VAX" +$then +$ write sys$output "Target VAX not supported." +$ exit 2 +$endif +$! +$! copy bfd-in2.h to bfd.h, replacing @ macros +$! +$ edit/tpu/nojournal/nosection/nodisplay/command=sys$input - + []bfd-in2.h /output=[]bfd.h +$DECK +! +! Copy file, changing lines with macros (@@) +! +! + vfile := CREATE_BUFFER("vfile", "VERSION."); + POSITION(BEGINNING_OF(vfile)); + vers := CURRENT_LINE; + + file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name")); + rang := CREATE_RANGE(BEGINNING_OF(file), END_OF(file)); + + match_pos := SEARCH_QUIETLY('@VERSION@', FORWARD, EXACT, rang); + IF match_pos <> 0 THEN; + POSITION(BEGINNING_OF(match_pos)); + ERASE(match_pos); + COPY_TEXT(vers); + ENDIF; + match_pos := SEARCH_QUIETLY('@wordsize@', FORWARD, EXACT, rang); + IF match_pos <> 0 THEN; + POSITION(BEGINNING_OF(match_pos)); + ERASE(match_pos); + COPY_TEXT('64'); + ENDIF; + match_pos := SEARCH_QUIETLY('@BFD_HOST_64BIT_LONG@', FORWARD, EXACT, rang); + IF match_pos <> 0 THEN; + POSITION(BEGINNING_OF(match_pos)); + ERASE(match_pos); + COPY_TEXT('0'); + ENDIF; + match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT_DEFINED@', FORWARD, EXACT, rang); + IF match_pos <> 0 THEN; + POSITION(BEGINNING_OF(match_pos)); + ERASE(match_pos); + COPY_TEXT('__DECC'); + SPLIT_LINE; + COPY_TEXT('#include '); + ENDIF; + match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT@', FORWARD, EXACT, rang); + IF match_pos <> 0 THEN; + POSITION(BEGINNING_OF(match_pos)); + ERASE(match_pos); + COPY_TEXT('int64'); + ENDIF; + match_pos := SEARCH_QUIETLY('@BFD_HOST_U_64_BIT@', FORWARD, EXACT, rang); + IF match_pos <> 0 THEN; + POSITION(BEGINNING_OF(match_pos)); + ERASE(match_pos); + COPY_TEXT('uint64'); + ENDIF; + WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file")); + QUIT +$ EOD +$ write sys$output "Generated `bfd.h' from `bfd-in2.h'." +$! +$! +$! create targmatch.h +$! +$ open/write tfile []targmatch.h +$ write tfile "{ " + """alpha-*-*vms*""" + "," +$ write tfile "#if defined (SELECT_VECS)" +$ write tfile "SELECT_VECS" +$ write tfile "#else" +$ write tfile "UNSUPPORTED_TARGET" +$ write tfile "#endif" +$ write tfile "}," +$ close tfile +$ write sys$output "Generated `targmatch.h'" +$! +$! +$! create config.h +$! +$ create []config.h +/* config.h-vms. Generated by hand by Klaus Kämpf, kkaempf@didymus.rmi.de. */ +/* config.in. Generated automatically from configure.in by autoheader. */ +/* Whether malloc must be declared even if is included. */ +/* #undef NEED_DECLARATION_MALLOC */ +/* Whether free must be declared even if is included. */ +/* #undef NEED_DECLARATION_FREE */ +/* Define if you have a working `mmap' system call. */ +/* #define HAVE_MMAP 1 */ +/* Do we need to use the b modifier when opening binary files? */ +/* #undef USE_BINARY_FOPEN */ +/* Name of host specific header file to include in trad-core.c. */ +/* #undef TRAD_HEADER */ +/* Define only if is available *and* it defines prstatus_t. */ +/* #undef HAVE_SYS_PROCFS_H */ +/* Do we really want to use mmap if it's available? */ +/* #undef USE_MMAP */ +/* Define if you have the fcntl function. */ +#define HAVE_FCNTL 1 +/* Define if you have the getpagesize function. */ +#define HAVE_GETPAGESIZE 1 +/* Define if you have the madvise function. */ +#define HAVE_MADVISE 1 +/* Define if you have the mprotect function. */ +#define HAVE_MPROTECT 1 +/* Define if you have the header file. */ +#define HAVE_FCNTL_H 1 +/* Define if you have the header file. */ +#define HAVE_STDDEF_H 1 +/* Define if you have the header file. */ +#define HAVE_STDLIB_H 1 +/* Define if you have the header file. */ +#define HAVE_STRING_H 1 +/* Define if you have the header file. */ +#define HAVE_STRINGS_H 1 +/* Define if you have the header file. */ +#define HAVE_SYS_FILE_H 1 +/* Define if you have the header file. */ +#define HAVE_TIME_H 1 +/* Define if you have the header file. */ +#define HAVE_UNISTD_H 1 +$! +$ write sys$output "Generated `config.h'" + diff --git a/bfd/evax-alpha.c b/bfd/evax-alpha.c index a6f694f..8c8a045 100644 --- a/bfd/evax-alpha.c +++ b/bfd/evax-alpha.c @@ -1109,8 +1109,6 @@ evax_get_symbol_info (abfd, symbol, ret) ret->type = 'A'; else if (bfd_is_und_section (sec)) ret->type = 'U'; - else if (bfd_is_abs_section (sec)) - ret->type = 'A'; else if (bfd_is_ind_section (sec)) ret->type = 'I'; else if (bfd_get_section_flags (abfd, sec) & SEC_CODE) diff --git a/bfd/evax-egsd.c b/bfd/evax-egsd.c index cd12039..7109485 100644 --- a/bfd/evax-egsd.c +++ b/bfd/evax-egsd.c @@ -402,7 +402,6 @@ _bfd_evax_write_egsd (abfd) char dummy_name[10]; char *sname; flagword new_flags, old_flags; - char uname[200]; char *nptr, *uptr; #if EVAX_DEBUG @@ -481,12 +480,20 @@ _bfd_evax_write_egsd (abfd) else if ((*sname == 'l') && (strcmp (sname, "lcomm") == 0)) sname = EVAX_LOCAL_NAME; } + else + sname = _bfd_evax_length_hash_symbol (abfd, sname, EOBJ_S_C_SECSIZ); _bfd_evax_output_begin (abfd, EGSD_S_C_PSC, -1); _bfd_evax_output_short (abfd, section->alignment_power & 0xff); - _bfd_evax_output_short (abfd, - evax_esecflag_by_name (sname, - section->_raw_size)); + if (bfd_is_com_section (section)) + { + new_flags = (EGPS_S_V_OVR|EGPS_S_V_REL|EGPS_S_V_GBL|EGPS_S_V_RD|EGPS_S_V_WRT|EGPS_S_V_NOMOD|EGPS_S_V_COM); + } + else + { + new_flags = evax_esecflag_by_name (sname, section->_raw_size); + } + _bfd_evax_output_short (abfd, new_flags); _bfd_evax_output_long (abfd, section->_raw_size); _bfd_evax_output_counted (abfd, sname); _bfd_evax_output_flush (abfd); @@ -514,15 +521,10 @@ _bfd_evax_write_egsd (abfd) } old_flags = symbol->flags; - if ((*(symbol->section->name+1) == 'c') - && (strcmp (symbol->section->name+1, "comm") == 0) - && (strcmp (symbol->name, ".comm") != 0)) - old_flags |= BSF_GLOBAL; - if (old_flags & BSF_FILE) continue; - if (((old_flags & BSF_GLOBAL) == 0) /* not xdef */ + if (((old_flags & (BSF_GLOBAL|BSF_WEAK)) == 0) /* not xdef */ && (!bfd_is_und_section (symbol->section))) /* and not xref */ continue; /* dont output */ @@ -542,14 +544,18 @@ _bfd_evax_write_egsd (abfd) _bfd_evax_output_short (abfd, 0); /* data type, alignment */ new_flags = 0; + if (old_flags & BSF_WEAK) new_flags |= EGSY_S_V_WEAK; + if (bfd_is_com_section (symbol->section)) /* .comm */ + new_flags |= (EGSY_S_V_WEAK|EGSY_S_V_COMM); + if (old_flags & BSF_FUNCTION) { new_flags |= EGSY_S_V_NORM; new_flags |= EGSY_S_V_REL; } - if (old_flags & BSF_GLOBAL) + if (old_flags & (BSF_GLOBAL|BSF_WEAK)) { new_flags |= EGSY_S_V_DEF; if (!bfd_is_abs_section (symbol->section)) @@ -557,7 +563,7 @@ _bfd_evax_write_egsd (abfd) } _bfd_evax_output_short (abfd, new_flags); - if (old_flags & BSF_GLOBAL) /* symbol definition */ + if (old_flags & (BSF_GLOBAL|BSF_WEAK)) /* symbol definition */ { if (old_flags & BSF_FUNCTION) { @@ -574,10 +580,10 @@ _bfd_evax_write_egsd (abfd) _bfd_evax_output_quad (abfd, symbol->value); /* L_VALUE */ _bfd_evax_output_quad (abfd, 0); /* L_CODE_ADDRESS */ _bfd_evax_output_long (abfd, 0); /* L_CA_PSINDX */ - _bfd_evax_output_long (abfd, symbol->section->index);/* L_PSINDX, FIXME */ + _bfd_evax_output_long (abfd, symbol->section->index);/* L_PSINDX */ } } - _bfd_evax_output_counted (abfd, _bfd_evax_length_hash_symbol (abfd, symbol->name)); + _bfd_evax_output_counted (abfd, _bfd_evax_length_hash_symbol (abfd, symbol->name, EOBJ_S_C_SYMSIZ)); _bfd_evax_output_flush (abfd); diff --git a/bfd/evax-emh.c b/bfd/evax-emh.c index 288889c..2b50006 100644 --- a/bfd/evax-emh.c +++ b/bfd/evax-emh.c @@ -159,7 +159,7 @@ get_vms_time_string () } Descriptor; Descriptor.Size = 17; Descriptor.Ptr = tbuf; - sys$asctim (0, &Descriptor, 0, 0); + SYS$ASCTIM (0, &Descriptor, 0, 0); #endif /* not VMS */ #if EVAX_DEBUG @@ -273,7 +273,7 @@ _bfd_evax_write_emh (abfd) continue; } - _bfd_evax_output_dump (abfd, (char *)symbol->name, strlen (symbol->name)); + _bfd_evax_output_dump (abfd, (unsigned char *)symbol->name, strlen (symbol->name)); if (had_case) break; had_file = 1; @@ -281,7 +281,7 @@ _bfd_evax_write_emh (abfd) } if (symnum == abfd->symcount) - _bfd_evax_output_dump (abfd, "noname", 6); + _bfd_evax_output_dump (abfd, (unsigned char *)"noname", 6); _bfd_evax_output_flush (abfd); diff --git a/bfd/evax-etir.c b/bfd/evax-etir.c index 2e64c28..187353b 100644 --- a/bfd/evax-etir.c +++ b/bfd/evax-etir.c @@ -1172,7 +1172,8 @@ _bfd_evax_write_etir (abfd) #endif } - if (section->flags & SEC_HAS_CONTENTS) + if ((section->flags & SEC_HAS_CONTENTS) + && (! bfd_is_com_section (section))) { bfd_vma vaddr; /* virtual addr in section */ @@ -1246,7 +1247,7 @@ _bfd_evax_write_etir (abfd) ETIR_S_C_STO_GBL_LW, -1); _bfd_evax_output_counted (abfd, - _bfd_evax_length_hash_symbol (abfd, sym->name)); + _bfd_evax_length_hash_symbol (abfd, sym->name, EOBJ_S_C_SYMSIZ)); _bfd_evax_output_flush (abfd); } else if (bfd_is_abs_section (sym->section)) @@ -1312,7 +1313,7 @@ _bfd_evax_write_etir (abfd) ETIR_S_C_STO_GBL, -1); _bfd_evax_output_counted (abfd, - _bfd_evax_length_hash_symbol (abfd, sym->name)); + _bfd_evax_length_hash_symbol (abfd, sym->name, EOBJ_S_C_SYMSIZ)); _bfd_evax_output_flush (abfd); } else if (bfd_is_abs_section (sym->section)) @@ -1374,7 +1375,7 @@ _bfd_evax_write_etir (abfd) evax_output_long(abfd, (unsigned long)(sec->index)); evax_output_quad(abfd, (uquad)addr); - evax_output_counted(abfd, _bfd_evax_length_hash_symbol (abfd, sym->name)); + evax_output_counted(abfd, _bfd_evax_length_hash_symbol (abfd, sym->name, EOBJ_S_C_SYMSIZ)); evax_output_flush(abfd); #endif } @@ -1394,7 +1395,7 @@ _bfd_evax_write_etir (abfd) (unsigned long)PRIV(evax_linkage_index)); PRIV(evax_linkage_index) += 2; _bfd_evax_output_counted (abfd, - _bfd_evax_length_hash_symbol (abfd, sym->name)); + _bfd_evax_length_hash_symbol (abfd, sym->name, EOBJ_S_C_SYMSIZ)); _bfd_evax_output_byte (abfd, 0); _bfd_evax_output_flush (abfd); } @@ -1415,7 +1416,7 @@ _bfd_evax_write_etir (abfd) ETIR_S_C_STO_CA, -1); _bfd_evax_output_counted (abfd, - _bfd_evax_length_hash_symbol (abfd, sym->name)); + _bfd_evax_length_hash_symbol (abfd, sym->name, EOBJ_S_C_SYMSIZ)); _bfd_evax_output_flush (abfd); } break; diff --git a/bfd/evax-misc.c b/bfd/evax-misc.c index 4e2862d..33dd399 100644 --- a/bfd/evax-misc.c +++ b/bfd/evax-misc.c @@ -972,12 +972,13 @@ hash_string (ptr) return hash; } -/* Generate a length-hashed VMS symbol name (limited to 64 chars). */ +/* Generate a length-hashed VMS symbol name (limited to maxlen chars). */ char * -_bfd_evax_length_hash_symbol (abfd, in) +_bfd_evax_length_hash_symbol (abfd, in, maxlen) bfd *abfd; const char *in; + int maxlen; { long int init; long int result; @@ -986,45 +987,55 @@ _bfd_evax_length_hash_symbol (abfd, in) char *new_name; const char *old_name; int i; - static char outbuf[65]; + static char outbuf[EOBJ_S_C_SYMSIZ+1]; char *out = outbuf; #if EVAX_DEBUG evax_debug(4, "_bfd_evax_length_hash_symbol \"%s\"\n", in); #endif + if (maxlen > EOBJ_S_C_SYMSIZ) + maxlen = EOBJ_S_C_SYMSIZ; + new_name = out; /* save this for later. */ /* We may need to truncate the symbol, save the hash for later. */ in_len = strlen (in); - result = (in_len > 64) ? hash_string (in) : 0; + result = (in_len > maxlen) ? hash_string (in) : 0; old_name = in; /* Do the length checking. */ - if (in_len <= 64) - i = in_len; + if (in_len <= maxlen) + { + i = in_len; + } + else + { + if (PRIV(flag_hash_long_names)) + i = maxlen-9; else - i = 55; + i = maxlen; + } strncpy (out, in, i); in += i; out += i; - if ((in_len > 64) + if ((in_len > maxlen) && PRIV(flag_hash_long_names)) sprintf (out, "_%08x", result); else - *out = 0; + *out = 0; #if EVAX_DEBUG evax_debug(4, "--> [%d]\"%s\"\n", strlen (outbuf), outbuf); #endif - if (in_len > 64 + if (in_len > maxlen && PRIV(flag_hash_long_names) && PRIV(flag_show_after_trunc)) printf ("Symbol %s replaced by %s\n", old_name, new_name); diff --git a/bfd/evax.h b/bfd/evax.h index f59ce55..9459898 100644 --- a/bfd/evax.h +++ b/bfd/evax.h @@ -195,7 +195,8 @@ extern int _bfd_evax_write_edbg PARAMS ((bfd *abfd)); #define EOBJ_S_C_SUBTYP 4 #define EOBJ_S_C_MAXRECSIZ 8192 /*Maximum legal record size */ #define EOBJ_S_C_STRLVL 2 /*Structure level */ -#define EOBJ_S_C_SYMSIZ 64 /*Maxymum symbol length */ +#define EOBJ_S_C_SYMSIZ 64 /*Maximum symbol length */ +#define EOBJ_S_C_SECSIZ 31 /*Maximum section name length */ #define EOBJ_S_C_STOREPLIM -1 /*Maximum repeat count on store commands */ #define EOBJ_S_C_PSCALILIM 16 /*Maximum p-sect alignment */ @@ -278,7 +279,7 @@ struct location_struct { }; #define LOCATION_SAVE_SIZE 32 -#define EVAX_SECTION_COUNT 32 +#define EVAX_SECTION_COUNT 1024 struct evax_private_data_struct { boolean fixup_done; /* Flag to indicate if all @@ -377,6 +378,6 @@ extern void _bfd_evax_output_counted PARAMS ((bfd *abfd, char *value)); extern void _bfd_evax_output_dump PARAMS ((bfd *abfd, unsigned char *data, int length)); extern void _bfd_evax_output_fill PARAMS ((bfd *abfd, int value, int length)); -extern char *_bfd_evax_length_hash_symbol PARAMS ((bfd *abfd, const char *in)); +extern char *_bfd_evax_length_hash_symbol PARAMS ((bfd *abfd, const char *in, int maxlen)); #endif /* EVAX_H */ -- 2.7.4