/* tc-ia64.c -- Assembler for the HP/Intel IA-64 architecture.
- Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
- Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+ 2008, 2009 Free Software Foundation, Inc.
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
This file is part of GAS, the GNU Assembler.
#include "opcode/ia64.h"
#include "elf/ia64.h"
+#include "bfdver.h"
+#include <time.h>
#ifdef HAVE_LIMITS_H
#include <limits.h>
#define CR_IFS 23
#define CR_IIM 24
#define CR_IHA 25
+#define CR_IIB0 26
+#define CR_IIB1 27
#define CR_LID 64
#define CR_IVR 65
#define CR_TPR 66
{"cr.ifs", CR_IFS},
{"cr.iim", CR_IIM},
{"cr.iha", CR_IHA},
+ {"cr.iib0", CR_IIB0},
+ {"cr.iib1", CR_IIB1},
{"cr.lid", CR_LID},
{"cr.ivr", CR_IVR},
{"cr.tpr", CR_TPR},
/* Map 's' to SHF_IA_64_SHORT. */
-int
+bfd_vma
ia64_elf_section_letter (int letter, char **ptr_msg)
{
if (letter == 's')
return SHF_IA_64_SHORT;
else if (letter == 'o')
return SHF_LINK_ORDER;
+#ifdef TE_VMS
+ else if (letter == 'O')
+ return SHF_IA_64_VMS_OVERLAID;
+ else if (letter == 'g')
+ return SHF_IA_64_VMS_GLOBAL;
+#endif
*ptr_msg = _("Bad .section directive: want a,o,s,w,x,M,S,G,T in string");
return -1;
flagword
ia64_elf_section_flags (flagword flags,
- int attr,
+ bfd_vma attr,
int type ATTRIBUTE_UNUSED)
{
if (attr & SHF_IA_64_SHORT)
ia64_init (int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
{
md.flags = MD_FLAGS_DEFAULT;
+#ifndef TE_VMS
+ /* Don't turn on dependency checking for VMS, doesn't work. */
md.detect_dv = 1;
+#endif
/* FIXME: We should change it to unwind_check_error someday. */
md.unwind_check = unwind_check_warning;
md.hint_b = hint_b_error;
else
{
if (md.flags & EF_IA_64_ABI64)
-#ifdef TE_AIX50
+#if defined (TE_AIX50)
return "elf64-ia64-aix-little";
+#elif defined (TE_VMS)
+ {
+ md.flags |= EF_IA_64_ARCHVER_1;
+ return "elf64-ia64-vms";
+ }
#else
return "elf64-ia64-little";
#endif
}
break;
+ case IA64_RS_CR_IIB:
+ if (note != 0)
+ {
+ UNHANDLED;
+ }
+ else
+ {
+ int regno = CURR_SLOT.opnd[!rsrc_write].X_add_number - REG_CR;
+ if (idesc->operands[!rsrc_write] == IA64_OPND_CR3
+ && (regno == CR_IIB0 || regno == CR_IIB1))
+ {
+ specs[count] = tmpl;
+ specs[count++].index = regno;
+ }
+ }
+ break;
+
case IA64_RS_CR_LRR:
if (note != 1)
{
case CR_ISR:
case CR_IFA:
case CR_IHA:
+ case CR_IIB0:
+ case CR_IIB1:
case CR_IIPA:
specs[count++] = tmpl;
break;
err = (*odesc->insert) (odesc, value, insn + slot);
if (err)
- as_bad_where (fix->fx_file, fix->fx_line, err);
+ as_bad_where (fix->fx_file, fix->fx_line, "%s", err);
t0 = control_bits | (insn[0] << 5) | (insn[1] << 46);
t1 = ((insn[1] >> 18) & 0x7fffff) | (insn[2] << 23);
symbolS *sym = symbol_find (h->name);
if (sym == NULL)
- as_warn_where (h->file, h->line,
- _("symbol `%s' aliased to `%s' is not used"),
- h->name, alias);
+ {
+#ifdef TE_VMS
+ /* Uses .alias extensively to alias CRTL functions to same with
+ decc$ prefix. Sometimes function gets optimized away and a
+ warning results, which should be suppressed. */
+ if (strncmp (alias, "decc$", 5) != 0)
+#endif
+ as_warn_where (h->file, h->line,
+ _("symbol `%s' aliased to `%s' is not used"),
+ h->name, alias);
+ }
else
S_SET_NAME (sym, (char *) alias);
}
{
hash_traverse (secalias_hash, do_secalias);
}
+
+#ifdef TE_VMS
+#define NT_VMS_MHD 1
+#define NT_VMS_LNM 2
+
+/* Integrity VMS 8.x identifies it's ELF modules with a standard ELF
+ .note section. */
+
+/* Manufacture a VMS-like time string. */
+static void
+get_vms_time (char *Now)
+{
+ char *pnt;
+ time_t timeb;
+
+ time (&timeb);
+ pnt = ctime (&timeb);
+ pnt[3] = 0;
+ pnt[7] = 0;
+ pnt[10] = 0;
+ pnt[16] = 0;
+ pnt[24] = 0;
+ sprintf (Now, "%2s-%3s-%s %s", pnt + 8, pnt + 4, pnt + 20, pnt + 11);
+}
+
+void
+ia64_vms_note (void)
+{
+ char *p;
+ asection *seg = now_seg;
+ subsegT subseg = now_subseg;
+ Elf_Internal_Note i_note;
+ asection *secp = NULL;
+ char *basec, *bname;
+ char buf [256];
+ symbolS *sym;
+
+ /* Create the .note section. */
+
+ secp = subseg_new (".note", 0);
+ bfd_set_section_flags (stdoutput,
+ secp,
+ SEC_HAS_CONTENTS | SEC_READONLY);
+
+ /* Module header note. */
+ basec = xstrdup (out_file_name);
+ bname = basename (basec);
+ if ((p = strrchr (bname, '.')))
+ *p = '\0';
+
+ i_note.namesz = 8;
+ i_note.descsz = 40 + strlen (bname);
+ i_note.type = NT_VMS_MHD;
+
+ p = frag_more (sizeof (i_note.namesz));
+ number_to_chars_littleendian (p, i_note.namesz, 8);
+
+ p = frag_more (sizeof (i_note.descsz));
+ number_to_chars_littleendian (p, i_note.descsz, 8);
+
+ p = frag_more (sizeof (i_note.type));
+ number_to_chars_littleendian (p, i_note.type, 8);
+
+ p = frag_more (8);
+ strcpy (p, "IPF/VMS");
+
+ get_vms_time (buf);
+ p = frag_more (17);
+ strcpy (p, buf);
+
+ p = frag_more (17);
+ strcpy (p, "24-FEB-2005 15:00");
+
+ p = frag_more (strlen (bname) + 1);
+ strcpy (p, bname);
+
+ p = frag_more (5);
+ strcpy (p, "V1.0");
+
+ frag_align (3, 0, 0);
+
+ /* Language processor name note. */
+ sprintf (buf, "GNU assembler version %s (%s) using BFD version %s",
+ VERSION, TARGET_ALIAS, BFD_VERSION_STRING);
+
+ i_note.namesz = 8;
+ i_note.descsz = 1 + strlen (buf);
+ i_note.type = NT_VMS_LNM;
+
+ p = frag_more (sizeof (i_note.namesz));
+ number_to_chars_littleendian (p, i_note.namesz, 8);
+
+ p = frag_more (sizeof (i_note.descsz));
+ number_to_chars_littleendian (p, i_note.descsz, 8);
+
+ p = frag_more (sizeof (i_note.type));
+ number_to_chars_littleendian (p, i_note.type, 8);
+
+ p = frag_more (8);
+ strcpy (p, "IPF/VMS");
+
+ p = frag_more (strlen (buf) + 1);
+ strcpy (p, buf);
+
+ frag_align (3, 0, 0);
+
+ secp = subseg_new (".vms_display_name_info", 0);
+ bfd_set_section_flags (stdoutput,
+ secp,
+ SEC_HAS_CONTENTS | SEC_READONLY);
+
+ /* This symbol should be passed on the command line and be variable
+ according to language. */
+ sym = symbol_new ("__gnat_vms_display_name@gnat_demangler_rtl",
+ absolute_section, 0, &zero_address_frag);
+ symbol_table_insert (sym);
+ symbol_get_bfdsym (sym)->flags |= BSF_DEBUGGING | BSF_DYNAMIC;
+
+ p = frag_more (4);
+ /* Format 3 of VMS demangler Spec. */
+ number_to_chars_littleendian (p, 3, 4);
+
+ p = frag_more (4);
+ /* Place holder for symbol table index of above symbol. */
+ number_to_chars_littleendian (p, -1, 4);
+
+ frag_align (3, 0, 0);
+
+ /* We probably can't restore the current segment, for there likely
+ isn't one yet... */
+ if (seg && subseg)
+ subseg_set (seg, subseg);
+}
+
+#endif /* TE_VMS */