From 4c2935f4c0c865a4ab347bd0b5c131923ec41534 Mon Sep 17 00:00:00 2001 From: Michael Meissner Date: Mon, 16 Oct 1995 02:09:01 +0000 Subject: [PATCH] Add -mcom support. --- gas/ChangeLog | 15 +++++++++++++++ gas/config/tc-ppc.c | 41 ++++++++++++++++++++++++++++++----------- 2 files changed, 45 insertions(+), 11 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 70271f2179e..5aedb42bbb5 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,18 @@ +Sun Oct 15 22:06:14 1995 Michael Meissner + + * config/tc-ppc.c (md_parse_option): Support for -mcom to turn on + common mode operation. + (md_show_usage): Add -mcom to usage message. + (md_begin): If the target CPU is common mode, only allow + instructions in both architectures. + +Fri Oct 13 13:32:45 1995 steve chamberlain + + * expr.c (op_rank): Add O_symbol_rva. + * expr.h (operatorT): Add O_symbol_rva. + * read.c (cons_worker): Set O_symbol_rva when necessary. + * write.c (fix_new_exp): Understand O_symbol_rva. + Tue Oct 10 11:34:14 1995 Ian Lance Taylor * config/tc-mips.c: Correct s_cons arguments. From Michael diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c index 0e98abcd872..cdc0675cd69 100644 --- a/gas/config/tc-ppc.c +++ b/gas/config/tc-ppc.c @@ -582,6 +582,10 @@ md_parse_option (c, arg) ppc_cpu = PPC_OPCODE_PPC; ppc_size = PPC_OPCODE_64; } + /* -mcom means assemble for the common intersection between Power + and PowerPC. */ + else if (strcmp (arg, "com") == 0) + ppc_cpu = PPC_OPCODE_POWER | PPC_OPCODE_PPC; /* -many means to assemble for any architecture (PWR/PWRX/PPC). */ else if (strcmp (arg, "any") == 0) ppc_cpu = PPC_OPCODE_POWER | PPC_OPCODE_POWER2 | PPC_OPCODE_PPC; @@ -656,6 +660,7 @@ PowerPC options:\n\ -mppc, -mppc32, -m403, -m603, -m604\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"); #ifdef OBJ_ELF fprintf(stream, "\ @@ -737,7 +742,10 @@ md_begin () if ((op->flags & ppc_cpu) != 0 && ((op->flags & (PPC_OPCODE_32 | PPC_OPCODE_64)) == 0 - || (op->flags & (PPC_OPCODE_32 | PPC_OPCODE_64)) == ppc_size)) + || (op->flags & (PPC_OPCODE_32 | PPC_OPCODE_64)) == ppc_size) + /* If -mcom, check for instructions not in both Power/PowerPC */ + && (ppc_cpu != (PPC_OPCODE_POWER | PPC_OPCODE_PPC) + || (op->flags & (PPC_OPCODE_POWER | PPC_OPCODE_PPC)) == ppc_cpu)) { const char *retval; @@ -1648,7 +1656,7 @@ ppc_macro (str, macro) const struct powerpc_macro *macro; { char *operands[10]; - int count; + unsigned int count; char *s; unsigned int len; const char *format; @@ -2342,18 +2350,19 @@ ppc_biei (ei) name = demand_copy_C_string (&len); + /* The value of these symbols is actually file offset. Here we set + the value to the index into the line number entries. In + ppc_frob_symbols we set the fix_line field, which will cause BFD + to do the right thing. */ + sym = symbol_make (name); - S_SET_SEGMENT (sym, ppc_coff_debug_section); + S_SET_SEGMENT (sym, now_seg); + S_SET_VALUE (sym, coff_n_line_nos); sym->bsym->flags |= BSF_DEBUGGING; - /* FIXME: The value of the .bi or .ei symbol is supposed to be the - offset in the file to the line number entry to use. That is - quite difficult to implement using BFD, so I'm just not doing it. - Sorry. Please add it if you can figure out how. Note that this - approach is the only way to support multiple files in COFF, since - line numbers are associated with function symbols. Note further - that it still doesn't work, since the line numbers are stored as - offsets from a base line number. */ + /* obj-coff.c currently only handles line numbers correctly in the + .text section. */ + assert (now_seg == text_section); S_SET_STORAGE_CLASS (sym, ei ? C_EINCL : C_BINCL); sym->sy_tc.output = 1; @@ -3431,6 +3440,8 @@ ppc_frob_symbol (sym) && S_GET_STORAGE_CLASS (sym) != C_FCN && S_GET_STORAGE_CLASS (sym) != C_BSTAT && S_GET_STORAGE_CLASS (sym) != C_ESTAT + && S_GET_STORAGE_CLASS (sym) != C_BINCL + && S_GET_STORAGE_CLASS (sym) != C_EINCL && S_GET_SEGMENT (sym) != ppc_coff_debug_section) S_SET_STORAGE_CLASS (sym, C_HIDEXT); @@ -3575,6 +3586,14 @@ ppc_frob_symbol (sym) resolve_symbol_value (csect); S_SET_VALUE (sym, S_GET_VALUE (sym) - S_GET_VALUE (csect)); } + else if (S_GET_STORAGE_CLASS (sym) == C_BINCL + || S_GET_STORAGE_CLASS (sym) == C_EINCL) + { + /* We want the value to be a file offset into the line numbers. + BFD will do that for us if we set the right flags. We have + already set the value correctly. */ + coffsymbol (sym->bsym)->native->fix_line = 1; + } return 0; } -- 2.30.2