From: Michael Meissner Date: Tue, 16 Apr 1996 14:41:45 +0000 (+0000) Subject: Add -m{,no-}regnames support; Add Solaris/linux support X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=159e6ef88fe32c13a6a9d7485efa83ab6e47be9a;p=binutils-gdb.git Add -m{,no-}regnames support; Add Solaris/linux support --- diff --git a/gas/ChangeLog b/gas/ChangeLog index 0864813cb26..99247ade21d 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,18 @@ +Tue Apr 16 10:25:42 1996 Michael Meissner + + * 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 * config/tc-mips.c (mips_frob_file): Permit multiple %hi relocs to diff --git a/gas/config/.Sanitize b/gas/config/.Sanitize index 9f251b28df5..c89ad49bc1a 100644 --- a/gas/config/.Sanitize +++ b/gas/config/.Sanitize @@ -81,6 +81,7 @@ obj-vms.c obj-vms.h ppc-big.mt ppc-lit.mt +ppc-sol.mt sco5.mt tc-a29k.c tc-a29k.h diff --git a/gas/config/ppc-sol.mt b/gas/config/ppc-sol.mt new file mode 100644 index 00000000000..7033de3b85b --- /dev/null +++ b/gas/config/ppc-sol.mt @@ -0,0 +1 @@ +TDEFINES=-DTARGET_BYTES_LITTLE_ENDIAN=1 -DTARGET_REG_NAMES_P=true diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c index 40b7bd6a0b5..56724d42e99 100644 --- a/gas/config/tc-ppc.c +++ b/gas/config/tc-ppc.c @@ -41,6 +41,17 @@ extern int target_big_endian; /* 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, @@ -178,9 +189,7 @@ const pseudo_typeS md_pseudo_table[] = }; -#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. */ @@ -437,7 +446,58 @@ reg_name_search (name) 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; + } +} /* Local variables. */ @@ -594,6 +654,12 @@ md_parse_option (c, arg) 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) @@ -665,7 +731,9 @@ PowerPC options:\n\ 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\ @@ -1054,51 +1122,6 @@ ppc_elf_validate_fix (fixp, seg) #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(). @@ -1463,26 +1486,24 @@ md_assemble (str) 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 @@ -1513,13 +1534,6 @@ md_assemble (str) 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) { @@ -1626,6 +1640,8 @@ md_assemble (str) 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: @@ -4316,7 +4332,6 @@ md_apply_fix3 (fixp, valuep, seg) 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: @@ -4332,6 +4347,17 @@ md_apply_fix3 (fixp, valuep, seg) 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 (); diff --git a/gas/configure b/gas/configure index 67b78fc3de0..dc09f0b4365 100755 --- a/gas/configure +++ b/gas/configure @@ -541,9 +541,13 @@ fi 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 @@ -876,6 +880,18 @@ for this_target in $target $canon_targets ; do *) 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 ;; @@ -946,7 +962,7 @@ for this_target in $target $canon_targets ; do ;; *) 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 @@ -1257,7 +1273,7 @@ case "${need_opcodes}" in 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, @@ -1278,7 +1294,7 @@ case "${need_bfd}" in 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, @@ -1400,7 +1416,7 @@ else 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 @@ -1512,13 +1528,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < 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 : @@ -1527,13 +1543,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < 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 : @@ -1561,12 +1577,12 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < 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* @@ -1614,11 +1630,11 @@ else ac_cv_c_cross=yes else cat > conftest.$ac_ext <&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 @@ -1638,7 +1654,7 @@ if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { return 0; } @@ -1646,7 +1662,7 @@ int t() { 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 @@ -1670,7 +1686,7 @@ if eval "test \"`echo '$''{'ac_cv_func_alloca'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&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 @@ -1729,7 +1745,7 @@ if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 else cat > conftest.$ac_ext <&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 @@ -1812,7 +1828,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <&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 @@ -1855,7 +1871,7 @@ else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <&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 @@ -1895,7 +1911,7 @@ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&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 @@ -1948,7 +1964,7 @@ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&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 @@ -2001,7 +2017,7 @@ if eval "test \"`echo '$''{'gas_cv_assert_ok'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2018,7 +2034,7 @@ assert (a == b ; 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 @@ -2058,7 +2074,7 @@ if eval "test \"`echo '$''{'gas_cv_decl_needed_malloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&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 @@ -2094,7 +2110,7 @@ if eval "test \"`echo '$''{'gas_cv_decl_needed_free'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&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 @@ -2133,7 +2149,7 @@ if eval "test \"`echo '$''{'gas_cv_decl_needed_errno'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&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 diff --git a/gas/configure.in b/gas/configure.in index 3275b8ef768..17893fe3c9b 100644 --- a/gas/configure.in +++ b/gas/configure.in @@ -26,9 +26,13 @@ esac])dnl 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. @@ -230,6 +234,18 @@ changequote([,])dnl *) 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 ;; @@ -300,7 +316,7 @@ changequote([,])dnl ;; *) 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 @@ -519,7 +535,7 @@ case "${need_opcodes}" in 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, @@ -540,7 +556,7 @@ case "${need_bfd}" in 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,