02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "opcode/ppc.h"
/* Find the spelling of the operand. */
start = name = input_line_pointer;
- if (name[0] == '%' && isalpha (name[1]))
+ if (name[0] == '%' && ISALPHA (name[1]))
name = ++input_line_pointer;
- else if (!reg_names_p || !isalpha (name[0]))
+ else if (!reg_names_p || !ISALPHA (name[0]))
return false;
c = get_symbol_end ();
for (ch = *str, str2 = ident;
(str2 < ident + sizeof (ident) - 1
- && (isalnum (ch) || ch == '@'));
+ && (ISALNUM (ch) || ch == '@'));
ch = *++str)
{
- *str2++ = (islower (ch)) ? ch : tolower (ch);
+ *str2++ = TOLOWER (ch);
}
*str2 = '\0';
#endif
/* Get the opcode. */
- for (s = str; *s != '\0' && ! isspace (*s); s++)
+ for (s = str; *s != '\0' && ! ISSPACE (*s); s++)
;
if (*s != '\0')
*s++ = '\0';
insn = opcode->opcode;
str = s;
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
/* PowerPC operands are just expressions. The only real issue is
}
if (BFD_DEFAULT_TARGET_SIZE == 64
+ && ppc_size == PPC_OPCODE_64
&& (operand->flags & PPC_OPERAND_DS) != 0)
{
switch (reloc)
++str;
}
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
if (*str != '\0')
if (letter == 'e')
return SHF_EXCLUDE;
- *ptr_msg = _("Bad .section directive: want a,w,x,e in string");
+ *ptr_msg = _("Bad .section directive: want a,e,w,x,M,S in string");
return 0;
}
}
/* The .bf pseudo-op. This is just like a COFF C_FCN symbol named
- ".bf". */
+ ".bf". If the pseudo op .bi was seen before .bf, patch the .bi sym
+ with the correct line number */
+
+static symbolS *saved_bi_sym = 0;
static void
ppc_bf (ignore)
S_SET_NUMBER_AUXILIARY (sym, 1);
SA_SET_SYM_LNNO (sym, coff_line_base);
+ /* Line number for bi. */
+ if (saved_bi_sym)
+ {
+ S_SET_VALUE (saved_bi_sym, coff_n_line_nos);
+ saved_bi_sym = 0;
+ }
+
+
symbol_get_tc (sym)->output = 1;
ppc_frob_label (sym);
/* The .bi and .ei pseudo-ops. These take a string argument and
generates a C_BINCL or C_EINCL symbol, which goes at the start of
- the symbol list. */
+ the symbol list. The value of .bi will be know when the next .bf
+ is encountered. */
static void
ppc_biei (ei)
S_SET_STORAGE_CLASS (sym, ei ? C_EINCL : C_BINCL);
symbol_get_tc (sym)->output = 1;
+ /* Save bi. */
+ if (ei)
+ saved_bi_sym = 0;
+ else
+ saved_bi_sym = sym;
+
for (look = last_biei ? last_biei : symbol_rootP;
(look != (symbolS *) NULL
&& (S_GET_STORAGE_CLASS (look) == C_FILE
#endif /* OBJ_XCOFF */
#ifdef OBJ_ELF
+ int align;
/* Skip the TOC symbol name. */
while (is_part_of_name (*input_line_pointer)
++input_line_pointer;
/* Align to a four/eight byte boundary. */
- frag_align (BFD_DEFAULT_TARGET_SIZE == 64 ? 3 : 2, 0, 0);
- record_alignment (now_seg, BFD_DEFAULT_TARGET_SIZE == 64 ? 3 : 2);
+ align = BFD_DEFAULT_TARGET_SIZE == 64 && ppc_size == PPC_OPCODE_64 ? 3 : 2;
+ frag_align (align, 0, 0);
+ record_alignment (now_seg, align);
#endif /* OBJ_ELF */
if (*input_line_pointer != ',')
#endif
#ifdef OBJ_ELF
const char *sname = segment_name (S_GET_SEGMENT (sym));
- if (BFD_DEFAULT_TARGET_SIZE == 64)
+ if (BFD_DEFAULT_TARGET_SIZE == 64 && ppc_size == PPC_OPCODE_64)
return strcmp (sname, ".toc") == 0;
else
return strcmp (sname, ".got") == 0;
}
for (s++; *s != '\0' && *s != brac; s++)
- if (islower (*s))
- *s = toupper (*s);
+ *s = TOUPPER (*s);
if (*s == '\0' || s[1] != '\0')
as_bad (_("bad symbol suffix"));
fixp->fx_r_type = BFD_RELOC_PPC_TOC16;
#ifdef OBJ_ELF
if (BFD_DEFAULT_TARGET_SIZE == 64
+ && ppc_size == PPC_OPCODE_64
&& (operand->flags & PPC_OPERAND_DS) != 0)
fixp->fx_r_type = BFD_RELOC_PPC64_TOC16_DS;
#endif
switch (fixp->fx_r_type)
{
case BFD_RELOC_CTOR:
- /* FIXME: 32 bits even for 64-bit targets? */
+ if (BFD_DEFAULT_TARGET_SIZE == 64 && ppc_size == PPC_OPCODE_64)
+ goto ctor64;
+ /* fall through */
+
case BFD_RELOC_32:
if (fixp->fx_pcrel)
fixp->fx_r_type = BFD_RELOC_32_PCREL;
break;
case BFD_RELOC_64:
+ ctor64:
if (fixp->fx_pcrel)
fixp->fx_r_type = BFD_RELOC_64_PCREL;
/* fall through */