+Tue Apr 16 10:25:42 1996 Michael Meissner <meissner@tiktok.cygnus.com>
+
+ * config/tc-ppc.c (register_name,reg_name_search): Move register
+ name lookup from PE specific code to all targets. Add support for
+ -mregnames/-mno-regnames to control whether register names are
+ expanded or not.
+ (md_assemble): Call register_name for all platforms.
+ (md_parse_option): Add support for -mregnames/-mno-regnames.
+
+ * configure.in (powerpcle*-*-solaris): Add support.
+ (powerpc*-*-linux): Ditto.
+ * configure: Regenerate.
+
+ * config/ppc-sol.mt: New config file for PowerPC Solaris.
+
Mon Apr 15 12:26:33 1996 Ian Lance Taylor <ian@cygnus.com>
* config/tc-mips.c (mips_frob_file): Permit multiple %hi relocs to
obj-vms.h
ppc-big.mt
ppc-lit.mt
+ppc-sol.mt
sco5.mt
tc-a29k.c
tc-a29k.h
--- /dev/null
+TDEFINES=-DTARGET_BYTES_LITTLE_ENDIAN=1 -DTARGET_REG_NAMES_P=true
/* Whether or not, we've set target_big_endian. */
static int set_target_endian = 0;
+/* Whether to use user friendly register names. */
+#ifndef TARGET_REG_NAMES_P
+#ifdef TE_PE
+#define TARGET_REG_NAMES_P true
+#else
+#define TARGET_REG_NAMES_P false
+#endif
+#endif
+
+static boolean reg_names_p = TARGET_REG_NAMES_P;
+
static void ppc_set_cpu PARAMS ((void));
static unsigned long ppc_insert_operand
PARAMS ((unsigned long insn, const struct powerpc_operand *operand,
};
\f
-#ifdef TE_PE
-/* The Windows NT PowerPC assembler uses predefined names. */
-
+/* Predefined register names if -mregnames (or default for Windows NT). */
/* In general, there are lots of them, in an attempt to be compatible */
/* with a number of other Windows NT assemblers. */
return -1;
}
-#endif
+/*
+ * Summary of register_name().
+ *
+ * in: Input_line_pointer points to 1st char of operand.
+ *
+ * out: A expressionS.
+ * The operand may have been a register: in this case, X_op == O_register,
+ * X_add_number is set to the register number, and truth is returned.
+ * Input_line_pointer->(next non-blank) char after operand, or is in its
+ * original state.
+ */
+
+static boolean
+register_name (expressionP)
+ expressionS *expressionP;
+{
+ int reg_number;
+ char *name;
+ char *start;
+ char c;
+
+ /* Find the spelling of the operand */
+ start = name = input_line_pointer;
+ if (name[0] == '%' && isalpha (name[1]))
+ name = ++input_line_pointer;
+
+ else if (!reg_names_p || !isalpha (name[0]))
+ return false;
+
+ c = get_symbol_end ();
+ reg_number = reg_name_search (name);
+
+ /* look to see if it's in the register table */
+ if (reg_number >= 0)
+ {
+ expressionP->X_op = O_register;
+ expressionP->X_add_number = reg_number;
+
+ /* make the rest nice */
+ expressionP->X_add_symbol = NULL;
+ expressionP->X_op_symbol = NULL;
+ *input_line_pointer = c; /* put back the delimiting char */
+ return true;
+ }
+ else
+ {
+ /* reset the line as if we had not done anything */
+ *input_line_pointer = c; /* put back the delimiting char */
+ input_line_pointer = start; /* reset input_line pointer */
+ return false;
+ }
+}
\f
/* Local variables. */
else if (strcmp (arg, "any") == 0)
ppc_cpu = PPC_OPCODE_ANY;
+ else if (strcmp (arg, "regnames") == 0)
+ reg_names_p = true;
+
+ else if (strcmp (arg, "no-regnames") == 0)
+ reg_names_p = false;
+
#ifdef OBJ_ELF
/* -mrelocatable/-mrelocatable-lib -- warn about initializations that require relocation */
else if (strcmp (arg, "relocatable") == 0)
generate code for Motorola PowerPC 603/604\n\
-mppc64, -m620 generate code for Motorola PowerPC 620\n\
-mcom generate code Power/PowerPC common instructions\n\
--many generate code for any architecture (PWR/PWRX/PPC)\n");
+-many generate code for any architecture (PWR/PWRX/PPC)\n\
+-mregnames Allow symbolic names for registers\n\
+-mno-regnames Do not allow symbolic names for registers\n");
#ifdef OBJ_ELF
fprintf(stream, "\
-mrelocatable support for GCC's -mrelocatble option\n\
#endif /* OBJ_ELF */
#ifdef TE_PE
-/*
- * Summary of register_name().
- *
- * in: Input_line_pointer points to 1st char of operand.
- *
- * out: A expressionS.
- * The operand may have been a register: in this case, X_op == O_register,
- * X_add_number is set to the register number, and truth is returned.
- * Input_line_pointer->(next non-blank) char after operand, or is in its
- * original state.
- */
-
-static int
-register_name (expressionP)
- expressionS *expressionP;
-{
- int reg_number;
- char *name;
- char c;
-
- /* Find the spelling of the operand */
- name = input_line_pointer;
- c = get_symbol_end ();
- reg_number = reg_name_search (name);
-
- /* look to see if it's in the register table */
- if (reg_number >= 0)
- {
- expressionP->X_op = O_register;
- expressionP->X_add_number = reg_number;
-
- /* make the rest nice */
- expressionP->X_add_symbol = NULL;
- expressionP->X_op_symbol = NULL;
- *input_line_pointer = c; /* put back the delimiting char */
- return 1;
- }
- else
- {
- /* reset the line as if we had not done anything */
- *input_line_pointer = c; /* put back the delimiting char */
- input_line_pointer = name; /* reset input_line pointer */
- return 0;
- }
-}
/*
* Summary of parse_toc_entry().
ex.X_add_symbol = NULL;
ex.X_op_symbol = NULL;
}
+
else
- {
- if (!register_name(&ex))
- {
- expression (&ex);
- }
- }
+#endif /* TE_PE */
+ if (!register_name(&ex))
+ expression (&ex);
str = input_line_pointer;
input_line_pointer = hold;
-#else
- expression (&ex);
- str = input_line_pointer;
- input_line_pointer = hold;
-#endif
if (ex.X_op == O_illegal)
as_bad ("illegal operand");
else if (ex.X_op == O_absent)
as_bad ("missing operand");
+ else if (ex.X_op == O_register)
+ {
+ insn = ppc_insert_operand (insn, operand, ex.X_add_number,
+ (char *) NULL, 0);
+ }
else if (ex.X_op == O_constant)
{
#ifdef OBJ_ELF
insn = ppc_insert_operand (insn, operand, ex.X_add_number,
(char *) NULL, 0);
}
-#ifdef TE_PE
- else if (ex.X_op == O_register)
- {
- insn = ppc_insert_operand (insn, operand, ex.X_add_number,
- (char *) NULL, 0);
- }
-#endif
#ifdef OBJ_ELF
else if ((reloc = ppc_elf_suffix (&str)) != BFD_RELOC_UNUSED)
{
foo+100000@ha. */
switch (fixups[i].reloc)
{
+ case BFD_RELOC_16_GOTOFF:
+ case BFD_RELOC_PPC_TOC16:
case BFD_RELOC_LO16:
case BFD_RELOC_HI16:
case BFD_RELOC_HI16_S:
case BFD_RELOC_PPC_EMB_NADDR16_HI:
case BFD_RELOC_PPC_EMB_NADDR16_HA:
case BFD_RELOC_PPC_EMB_SDAI16:
- case BFD_RELOC_PPC_EMB_SDA21:
case BFD_RELOC_PPC_EMB_SDA2REL:
case BFD_RELOC_PPC_EMB_SDA2I16:
case BFD_RELOC_PPC_EMB_RELSEC16:
value, 2);
break;
+ /* Because SDA21 modifies the register field, the size is set to 4
+ bytes, rather than 2, so offset it here appropriately */
+ case BFD_RELOC_PPC_EMB_SDA21:
+ if (fixp->fx_pcrel)
+ abort ();
+
+ md_number_to_chars (fixp->fx_frag->fr_literal + fixp->fx_where
+ + ((target_big_endian) ? 2 : 0),
+ value, 2);
+ break;
+
case BFD_RELOC_8:
if (fixp->fx_pcrel)
abort ();
if test "${enable_shared+set}" = set; then
enableval="$enable_shared"
case "${enableval}" in
- yes) shared=true ;;
+ yes) shared=true shared_bfd=true shared_opcodes=true ;;
no) shared=false ;;
- *) { echo "configure: error: bad value ${enableval} for BFD shared option" 1>&2; exit 1; } ;;
+ *bfd*opcodes*) shared=true shared_bfd=true shared_opcodes=true ;;
+ *opcodes*bfd*) shared=true shared_bfd=true shared_opcodes=true ;;
+ *bfd*) shared=true shared_bfd=true ;;
+ *opcodes*) shared=true shared_opcodes=true ;;
+ *) shared=false ;;
esac
fi
*) targ=ppc-lit ;;
esac
;;
+ ppc-*-linux*) fmt=elf
+ case "$endian" in
+ big) targ=ppc-big ;;
+ *) { echo "configure: error: Linux must be configured big endian" 1>&2; exit 1; } ;;
+ esac
+ ;;
+ ppc-*-solaris*) fmt=elf
+ case "$endian" in
+ big) { echo "configure: error: Solaris must be configured little endian" 1>&2; exit 1; } ;;
+ *) targ=ppc-sol ;;
+ esac
+ ;;
ppc-*-macos* | ppc-*-mpw*)
fmt=coff em=macos ;;
ppc-*-netware*) fmt=elf em=ppcnw ;;
;;
*)
need_opcodes=yes
- if test "${shared}" = "true"; then
+ if test "${shared_opcodes}" = "true"; then
# A shared libopcodes must be linked against libbfd.
need_bfd=yes
fi
OPCODES_LIB='-L../opcodes -lopcodes'
# We need to handle some special cases if opcodes was built shared.
- if test "${shared}" = "true"; then
+ if test "${shared_opcodes}" = "true"; then
case "${host}" in
*-*-sunos*)
# On SunOS, we must link against the name we are going to install,
ALL_OBJ_DEPS="$ALL_OBJ_DEPS ../bfd/bfd.h"
# We need to handle some special cases if BFD was built shared.
- if test "${shared}" = "true"; then
+ if test "${shared_bfd}" = "true"; then
case "${host}" in
*-*-sunos*)
# On SunOS, we must link against the name we are going to install,
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1404: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1420: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 1516 "configure"
+#line 1532 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1522: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1538: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
:
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 1531 "configure"
+#line 1547 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1537: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1553: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
:
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1565 "configure"
+#line 1581 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1570: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1586: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
ac_cv_c_cross=yes
else
cat > conftest.$ac_ext <<EOF
-#line 1618 "configure"
+#line 1634 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-{ (eval echo configure:1622: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
+{ (eval echo configure:1638: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
if test -s conftest && (./conftest; exit) 2>/dev/null; then
ac_cv_c_cross=no
else
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1642 "configure"
+#line 1658 "configure"
#include "confdefs.h"
#include <alloca.h>
int main() { return 0; }
char *p = alloca(2 * sizeof(int));
; return 0; }
EOF
-if { (eval echo configure:1650: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:1666: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
ac_cv_header_alloca_h=yes
else
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1674 "configure"
+#line 1690 "configure"
#include "confdefs.h"
#ifdef __GNUC__
char *p = (char *) alloca(1);
; return 0; }
EOF
-if { (eval echo configure:1698: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:1714: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
ac_cv_func_alloca=yes
else
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1733 "configure"
+#line 1749 "configure"
#include "confdefs.h"
#if defined(CRAY) && ! defined(CRAY2)
webecray
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1762 "configure"
+#line 1778 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:1784: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:1800: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
ac_cv_c_stack_direction=0
else
cat > conftest.$ac_ext <<EOF
-#line 1816 "configure"
+#line 1832 "configure"
#include "confdefs.h"
find_stack_direction ()
{
exit (find_stack_direction() < 0);
}
EOF
-{ (eval echo configure:1835: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
+{ (eval echo configure:1851: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
if test -s conftest && (./conftest; exit) 2>/dev/null; then
ac_cv_c_stack_direction=1
else
ac_cv_c_inline=no
for ac_kw in inline __inline__ __inline; do
cat > conftest.$ac_ext <<EOF
-#line 1859 "configure"
+#line 1875 "configure"
#include "confdefs.h"
int main() { return 0; }
} $ac_kw foo() {
; return 0; }
EOF
-if { (eval echo configure:1867: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1883: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_inline=$ac_kw; break
fi
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1899 "configure"
+#line 1915 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:1921: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:1937: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1952 "configure"
+#line 1968 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:1974: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:1990: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2005 "configure"
+#line 2021 "configure"
#include "confdefs.h"
#include <assert.h>
#include <stdio.h>
; return 0; }
EOF
-if { (eval echo configure:2022: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:2038: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
gas_cv_assert_ok=yes
else
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2062 "configure"
+#line 2078 "configure"
#include "confdefs.h"
$gas_test_headers
int main() { return 0; }
; return 0; }
EOF
-if { (eval echo configure:2074: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:2090: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
gas_cv_decl_needed_malloc=no
else
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2098 "configure"
+#line 2114 "configure"
#include "confdefs.h"
$gas_test_headers
int main() { return 0; }
; return 0; }
EOF
-if { (eval echo configure:2110: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:2126: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
gas_cv_decl_needed_free=no
else
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2137 "configure"
+#line 2153 "configure"
#include "confdefs.h"
#ifdef HAVE_ERRNO_H
; return 0; }
EOF
-if { (eval echo configure:2153: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:2169: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
gas_cv_decl_needed_errno=no
else
AC_ARG_ENABLE(shared,
[ --enable-shared build shared BFD library],
[case "${enableval}" in
- yes) shared=true ;;
+ yes) shared=true shared_bfd=true shared_opcodes=true ;;
no) shared=false ;;
- *) AC_MSG_ERROR([bad value ${enableval} for BFD shared option]) ;;
+ *bfd*opcodes*) shared=true shared_bfd=true shared_opcodes=true ;;
+ *opcodes*bfd*) shared=true shared_bfd=true shared_opcodes=true ;;
+ *bfd*) shared=true shared_bfd=true ;;
+ *opcodes*) shared=true shared_opcodes=true ;;
+ *) shared=false ;;
esac])dnl
# Generate a header file -- gets more post-processing by Makefile later.
*) targ=ppc-lit ;;
esac
;;
+ ppc-*-linux*) fmt=elf
+ case "$endian" in
+ big) targ=ppc-big ;;
+ *) AC_MSG_ERROR(Linux must be configured big endian) ;;
+ esac
+ ;;
+ ppc-*-solaris*) fmt=elf
+ case "$endian" in
+ big) AC_MSG_ERROR(Solaris must be configured little endian) ;;
+ *) targ=ppc-sol ;;
+ esac
+ ;;
ppc-*-macos* | ppc-*-mpw*)
fmt=coff em=macos ;;
ppc-*-netware*) fmt=elf em=ppcnw ;;
;;
*)
need_opcodes=yes
- if test "${shared}" = "true"; then
+ if test "${shared_opcodes}" = "true"; then
# A shared libopcodes must be linked against libbfd.
need_bfd=yes
fi
OPCODES_LIB='-L../opcodes -lopcodes'
# We need to handle some special cases if opcodes was built shared.
- if test "${shared}" = "true"; then
+ if test "${shared_opcodes}" = "true"; then
case "${host}" in
*-*-sunos*)
# On SunOS, we must link against the name we are going to install,
ALL_OBJ_DEPS="$ALL_OBJ_DEPS ../bfd/bfd.h"
# We need to handle some special cases if BFD was built shared.
- if test "${shared}" = "true"; then
+ if test "${shared_bfd}" = "true"; then
case "${host}" in
*-*-sunos*)
# On SunOS, we must link against the name we are going to install,