Mon Oct 20 15:01:27 1997 Klaus K"ampf <kkaempf@progis.de>
- * 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)
--- /dev/null
+$!
+$! 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 <ints.h>');
+ 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 <stdlib.h> is included. */
+/* #undef NEED_DECLARATION_MALLOC */
+/* Whether free must be declared even if <stdlib.h> 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 <sys/procfs.h> 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 <fcntl.h> header file. */
+#define HAVE_FCNTL_H 1
+/* Define if you have the <stddef.h> header file. */
+#define HAVE_STDDEF_H 1
+/* Define if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+/* Define if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+/* Define if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+/* Define if you have the <sys/file.h> header file. */
+#define HAVE_SYS_FILE_H 1
+/* Define if you have the <time.h> header file. */
+#define HAVE_TIME_H 1
+/* Define if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+$!
+$ write sys$output "Generated `config.h'"
+
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)
char dummy_name[10];
char *sname;
flagword new_flags, old_flags;
- char uname[200];
char *nptr, *uptr;
#if EVAX_DEBUG
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);
}
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 */
_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))
}
_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)
{
_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);
} 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
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;
}
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);
#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 */
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))
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))
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
}
(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);
}
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;
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;
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);
#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 */
};
#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
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 */