/* tc-vax.c - vax-specific -
- Copyright 1987, 1991, 1992, 1993, 1994, 1995, 1998, 2000, 2001, 2002
+ Copyright 1987, 1991, 1992, 1993, 1994, 1995, 1998, 2000, 2001, 2002,
+ 2003, 2004, 2005
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
You should have received a copy of the GNU General Public License
along with GAS; see the file COPYING. If not, write to the Free
- Software Foundation, 59 Temple Place - Suite 330, Boston, MA
- 02111-1307, USA. */
+ Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
+ 02110-1301, USA. */
#include "as.h"
#include "elf/vax.h"
#endif
+#if defined (OBJ_AOUT) && !defined (BFD_ASSEMBLER) && defined (TE_NetBSD)
+#include <netinet/in.h>
+#endif
+
/* These chars start a comment anywhere in a source file (except inside
another comment */
const char comment_chars[] = "#";
{"ffloat", float_cons, 'f'},
{"gfloat", float_cons, 'g'},
{"hfloat", float_cons, 'h'},
+ {"d_floating", float_cons, 'd'},
+ {"f_floating", float_cons, 'f'},
+ {"g_floating", float_cons, 'g'},
+ {"h_floating", float_cons, 'h'},
{NULL, NULL, 0},
};
that they reference. */
void /* Knows about order of bytes in address. */
-md_apply_fix3 (fixP, valueP, seg)
+md_apply_fix (fixP, valueP, seg)
fixS *fixP;
valueT *valueP;
segT seg ATTRIBUTE_UNUSED;
}
return retval;
}
+
+/*
+ * Copy a bignum from in to out.
+ * If the output is shorter than the input, copy lower-order
+ * littlenums. Return 0 or the number of significant littlenums
+ * dropped. Assumes littlenum arrays are densely packed: no unused
+ * chars between the littlenums. Uses memcpy() to move littlenums, and
+ * wants to know length (in chars) of the input bignum.
+ */
+
+static int
+bignum_copy (register LITTLENUM_TYPE *in,
+ register int in_length, /* in sizeof(littlenum)s */
+ register LITTLENUM_TYPE *out,
+ register int out_length /* in sizeof(littlenum)s */)
+{
+ int significant_littlenums_dropped;
+
+ if (out_length < in_length)
+ {
+ LITTLENUM_TYPE *p; /* -> most significant (non-zero) input
+ littlenum. */
+
+ memcpy ((void *) out, (void *) in,
+ (unsigned int) out_length << LITTLENUM_SHIFT);
+ for (p = in + in_length - 1; p >= in; --p)
+ {
+ if (*p)
+ break;
+ }
+ significant_littlenums_dropped = p - in - in_length + 1;
+
+ if (significant_littlenums_dropped < 0)
+ {
+ significant_littlenums_dropped = 0;
+ }
+ }
+ else
+ {
+ memcpy ((char *) out, (char *) in,
+ (unsigned int) in_length << LITTLENUM_SHIFT);
+
+ if (out_length > in_length)
+ {
+ memset ((char *) (out + in_length),
+ '\0',
+ (unsigned int) (out_length - in_length) << LITTLENUM_SHIFT);
+ }
+
+ significant_littlenums_dropped = 0;
+ }
+
+ return (significant_littlenums_dropped);
+}
\f
/* vax:md_assemble() emit frags for 1 instruction */
/* Remember where it is, in case we want to modify the op-code later. */
opcode_low_byteP = frag_more (v.vit_opcode_nbytes);
memcpy (opcode_low_byteP, v.vit_opcode, v.vit_opcode_nbytes);
- opcode_as_number = md_chars_to_number (opcode_as_chars = v.vit_opcode, 4);
+ opcode_as_chars = v.vit_opcode;
+ opcode_as_number = md_chars_to_number ((unsigned char *) opcode_as_chars, 4);
for (operandP = v.vit_operand,
expP = exp_of_operand,
segP = seg_of_operand,
p[0] = (operandP->vop_mode << 4) | 0xF;
if ((is_absolute) && (expP->X_op != O_big))
{
- /*
- * If nbytes > 4, then we are scrod. We
- * don't know if the high order bytes
- * are to be 0xFF or 0x00. BSD4.2 & RMS
- * say use 0x00. OK --- but this
- * assembler needs ANOTHER rewrite to
- * cope properly with this bug. */
- md_number_to_chars (p + 1, this_add_number, min (4, nbytes));
- if (nbytes > 4)
- {
- memset (p + 5, '\0', nbytes - 4);
- }
+ /* If nbytes > 4, then we are scrod. We
+ don't know if the high order bytes
+ are to be 0xFF or 0x00. BSD4.2 & RMS
+ say use 0x00. OK --- but this
+ assembler needs ANOTHER rewrite to
+ cope properly with this bug. */
+ md_number_to_chars (p + 1, this_add_number,
+ min (sizeof (valueT),
+ (size_t) nbytes));
+ if ((size_t) nbytes > sizeof (valueT))
+ memset (p + 5, '\0', nbytes - sizeof (valueT));
}
else
{
old_fr_fix = fragP->fr_fix;
p = fragP->fr_literal + old_fr_fix;
#ifdef OBJ_ELF
- /*
- * If this is to undefined symbol, then if it's an indirect
- * reference indicate that is can mutated into a GLOB_DAT
- * by the loader. We restrict ourselves to no offset due to
- * a limitation in the NetBSD linker.
- */
+ /* If this is to an undefined symbol, then if it's an indirect
+ reference indicate that is can mutated into a GLOB_DAT or
+ JUMP_SLOT by the loader. We restrict ourselves to no offset
+ due to a limitation in the NetBSD linker. */
+
if (GOT_symbol == NULL)
GOT_symbol = symbol_find (GLOBAL_OFFSET_TABLE_NAME);
if (PLT_symbol == NULL)
if ((GOT_symbol == NULL || fragP->fr_symbol != GOT_symbol)
&& (PLT_symbol == NULL || fragP->fr_symbol != PLT_symbol)
&& fragP->fr_symbol != NULL
+ && flag_want_pic
&& (!S_IS_DEFINED (fragP->fr_symbol)
|| S_IS_WEAK (fragP->fr_symbol)
|| S_IS_EXTERNAL (fragP->fr_symbol)))
}
else
{
-
if (((unsigned char *) fragP->fr_opcode)[0] == VAX_CALLS
|| ((unsigned char *) fragP->fr_opcode)[0] == VAX_CALLG
|| ((unsigned char *) fragP->fr_opcode)[0] == VAX_JSB
/*
* We found a match! So let's pick up as many operands as the
* instruction wants, and even gripe if there are too many.
- * We expect comma to seperate each operand.
+ * We expect comma to separate each operand.
* We let instring track the text, while p tracks a part of the
* struct vot.
*/
* There were a number of 'mismatched argument type' bugs to vip_op.
* The most general solution is to typedef each (of many) arguments.
* We used instead a typedef'd argument block. This is less modular
- * than using seperate return pointers for each result, but runs faster
+ * than using separate return pointers for each result, but runs faster
* on most engines, and seems to keep programmers happy. It will have
* to be done properly if we ever want to use vip_op as a general-purpose
* module (it was designed to be).
* We don't limit your choice of width character.
*
* DEC operands are hard work to parse. For example, '@' as the first
- * character means indirect (deferred) mode but elswhere it is a shift
+ * character means indirect (deferred) mode but elsewhere it is a shift
* operator.
* The long-winded explanation of how this is supposed to work is
* cancelled. Read a DEC vax manual.
*/
if (reg < 0)
{
- /* JF allow parenthasized expressions. I hope this works */
+ /* JF allow parenthesized expressions. I hope this works */
paren = 0;
while (*q != ')')
q++;
*/
\f
/*
- * Case of Rn. We seperate this one because it has a few special
+ * Case of Rn. We separate this one because it has a few special
* errors the remaining modes lack.
*
* in: at optional
/* end: vip_op.c */
-const int md_short_jump_size = 3;
-const int md_long_jump_size = 6;
+int md_short_jump_size = 3;
+int md_long_jump_size = 6;
const int md_reloc_size = 8; /* Size of relocation record */
void
\f
#ifdef OBJ_VMS
const char *md_shortopts = "d:STt:V+1h:Hv::";
-#elif defined(OBJ_ELC)
-const char *md_shortopts = "d:STt:VkK";
+#elif defined(OBJ_ELF)
+const char *md_shortopts = "d:STt:VkKQ:";
#else
const char *md_shortopts = "d:STt:V";
#endif
struct option md_longopts[] = {
+#ifdef OBJ_ELF
+#define OPTION_PIC (OPTION_MD_BASE)
+ {"pic", no_argument, NULL, OPTION_PIC},
+#endif
{NULL, no_argument, NULL, 0}
};
size_t md_longopts_size = sizeof (md_longopts);
#endif
#ifdef OBJ_ELF
- case 'K':
+ case OPTION_PIC:
case 'k':
flag_want_pic = 1;
break; /* -pic, Position Independent Code */
+
+ /* -Qy, -Qn: SVR4 arguments controlling whether a .comment
+ section should be emitted or not. FIXME: Not implemented. */
+ case 'Q':
+ break;
#endif
default:
{
#ifdef TE_NetBSD
N_SET_INFO(headers->header, OMAGIC, M_VAX4K_NETBSD, 0);
- headers->header.a_info = htonl(headers->header.a_info);
+ headers->header.a_info = htonl (headers->header.a_info);
#endif
}
#endif /* !BFD_ASSEMBLER */