* config/tc-ppc.c: Convert to ISO C.

* config/tc-ppc.c: Likewise.
This commit is contained in:
Alan Modra
2007-05-29 01:57:08 +00:00
parent a32b816ed5
commit 98027b1061
3 changed files with 167 additions and 267 deletions

View File

@ -1,3 +1,8 @@
2007-05-29 Alan Modra <amodra@bigpond.net.au>
* config/tc-ppc.c: Convert to ISO C.
* config/tc-ppc.c: Likewise.
2007-05-29 Alan Modra <amodra@bigpond.net.au> 2007-05-29 Alan Modra <amodra@bigpond.net.au>
* write.h (EXEC_MACHINE_TYPE): Delete. * write.h (EXEC_MACHINE_TYPE): Delete.

View File

@ -84,64 +84,57 @@ static int set_target_endian = 0;
static bfd_boolean reg_names_p = TARGET_REG_NAMES_P; static bfd_boolean reg_names_p = TARGET_REG_NAMES_P;
static bfd_boolean register_name PARAMS ((expressionS *)); static void ppc_macro (char *, const struct powerpc_macro *);
static void ppc_set_cpu PARAMS ((void)); static void ppc_byte (int);
static void ppc_macro PARAMS ((char *str, const struct powerpc_macro *macro));
static void ppc_byte PARAMS ((int));
#if defined (OBJ_XCOFF) || defined (OBJ_ELF) #if defined (OBJ_XCOFF) || defined (OBJ_ELF)
static int ppc_is_toc_sym PARAMS ((symbolS *sym)); static void ppc_tc (int);
static void ppc_tc PARAMS ((int)); static void ppc_machine (int);
static void ppc_machine PARAMS ((int));
#endif #endif
#ifdef OBJ_XCOFF #ifdef OBJ_XCOFF
static void ppc_comm PARAMS ((int)); static void ppc_comm (int);
static void ppc_bb PARAMS ((int)); static void ppc_bb (int);
static void ppc_bc PARAMS ((int)); static void ppc_bc (int);
static void ppc_bf PARAMS ((int)); static void ppc_bf (int);
static void ppc_biei PARAMS ((int)); static void ppc_biei (int);
static void ppc_bs PARAMS ((int)); static void ppc_bs (int);
static void ppc_eb PARAMS ((int)); static void ppc_eb (int);
static void ppc_ec PARAMS ((int)); static void ppc_ec (int);
static void ppc_ef PARAMS ((int)); static void ppc_ef (int);
static void ppc_es PARAMS ((int)); static void ppc_es (int);
static void ppc_csect PARAMS ((int)); static void ppc_csect (int);
static void ppc_change_csect PARAMS ((symbolS *, offsetT)); static void ppc_change_csect (symbolS *, offsetT);
static void ppc_function PARAMS ((int)); static void ppc_function (int);
static void ppc_extern PARAMS ((int)); static void ppc_extern (int);
static void ppc_lglobl PARAMS ((int)); static void ppc_lglobl (int);
static void ppc_section PARAMS ((int)); static void ppc_section (int);
static void ppc_named_section PARAMS ((int)); static void ppc_named_section (int);
static void ppc_stabx PARAMS ((int)); static void ppc_stabx (int);
static void ppc_rename PARAMS ((int)); static void ppc_rename (int);
static void ppc_toc PARAMS ((int)); static void ppc_toc (int);
static void ppc_xcoff_cons PARAMS ((int)); static void ppc_xcoff_cons (int);
static void ppc_vbyte PARAMS ((int)); static void ppc_vbyte (int);
#endif #endif
#ifdef OBJ_ELF #ifdef OBJ_ELF
static bfd_reloc_code_real_type ppc_elf_suffix PARAMS ((char **, expressionS *)); static void ppc_elf_cons (int);
static void ppc_elf_cons PARAMS ((int)); static void ppc_elf_rdata (int);
static void ppc_elf_rdata PARAMS ((int)); static void ppc_elf_lcomm (int);
static void ppc_elf_lcomm PARAMS ((int));
static void ppc_elf_validate_fix PARAMS ((fixS *, segT));
static void ppc_apuinfo_section_add PARAMS ((unsigned int apu, unsigned int version));
#endif #endif
#ifdef TE_PE #ifdef TE_PE
static void ppc_set_current_section PARAMS ((segT)); static void ppc_previous (int);
static void ppc_previous PARAMS ((int)); static void ppc_pdata (int);
static void ppc_pdata PARAMS ((int)); static void ppc_ydata (int);
static void ppc_ydata PARAMS ((int)); static void ppc_reldata (int);
static void ppc_reldata PARAMS ((int)); static void ppc_rdata (int);
static void ppc_rdata PARAMS ((int)); static void ppc_ualong (int);
static void ppc_ualong PARAMS ((int)); static void ppc_znop (int);
static void ppc_znop PARAMS ((int)); static void ppc_pe_comm (int);
static void ppc_pe_comm PARAMS ((int)); static void ppc_pe_section (int);
static void ppc_pe_section PARAMS ((int)); static void ppc_pe_function (int);
static void ppc_pe_function PARAMS ((int)); static void ppc_pe_tocd (int);
static void ppc_pe_tocd PARAMS ((int));
#endif #endif
/* Generic assembler global variables which must be defined by all /* Generic assembler global variables which must be defined by all
@ -561,14 +554,8 @@ static const struct pd_reg pre_defined_registers[] =
/* Given NAME, find the register number associated with that name, return /* Given NAME, find the register number associated with that name, return
the integer value associated with the given name or -1 on failure. */ the integer value associated with the given name or -1 on failure. */
static int reg_name_search
PARAMS ((const struct pd_reg *, int, const char * name));
static int static int
reg_name_search (regs, regcount, name) reg_name_search (const struct pd_reg *regs, int regcount, const char *name)
const struct pd_reg *regs;
int regcount;
const char *name;
{ {
int middle, low, high; int middle, low, high;
int cmp; int cmp;
@ -605,8 +592,7 @@ reg_name_search (regs, regcount, name)
*/ */
static bfd_boolean static bfd_boolean
register_name (expressionP) register_name (expressionS *expressionP)
expressionS *expressionP;
{ {
int reg_number; int reg_number;
char *name; char *name;
@ -673,9 +659,7 @@ static const struct pd_reg cr_names[] =
expression. */ expression. */
int int
ppc_parse_name (name, expr) ppc_parse_name (const char *name, expressionS *expr)
const char *name;
expressionS *expr;
{ {
int val; int val;
@ -938,9 +922,7 @@ parse_cpu (const char *arg)
} }
int int
md_parse_option (c, arg) md_parse_option (int c, char *arg)
int c;
char *arg;
{ {
switch (c) switch (c)
{ {
@ -1094,8 +1076,7 @@ md_parse_option (c, arg)
} }
void void
md_show_usage (stream) md_show_usage (FILE *stream)
FILE *stream;
{ {
fprintf (stream, _("\ fprintf (stream, _("\
PowerPC options:\n\ PowerPC options:\n\
@ -1148,7 +1129,7 @@ PowerPC options:\n\
/* Set ppc_cpu if it is not already set. */ /* Set ppc_cpu if it is not already set. */
static void static void
ppc_set_cpu () ppc_set_cpu (void)
{ {
const char *default_os = TARGET_OS; const char *default_os = TARGET_OS;
const char *default_cpu = TARGET_CPU; const char *default_cpu = TARGET_CPU;
@ -1176,7 +1157,7 @@ ppc_set_cpu ()
are called well before md_begin, when the output file is opened. */ are called well before md_begin, when the output file is opened. */
enum bfd_architecture enum bfd_architecture
ppc_arch () ppc_arch (void)
{ {
const char *default_cpu = TARGET_CPU; const char *default_cpu = TARGET_CPU;
ppc_set_cpu (); ppc_set_cpu ();
@ -1198,7 +1179,7 @@ ppc_arch ()
} }
unsigned long unsigned long
ppc_mach () ppc_mach (void)
{ {
if (ppc_obj64) if (ppc_obj64)
return bfd_mach_ppc64; return bfd_mach_ppc64;
@ -1209,7 +1190,7 @@ ppc_mach ()
} }
extern char* extern char*
ppc_target_format () ppc_target_format (void)
{ {
#ifdef OBJ_COFF #ifdef OBJ_COFF
#ifdef TE_PE #ifdef TE_PE
@ -1241,7 +1222,7 @@ ppc_target_format ()
static void static void
ppc_setup_opcodes (void) ppc_setup_opcodes (void)
{ {
register const struct powerpc_opcode *op; const struct powerpc_opcode *op;
const struct powerpc_opcode *op_end; const struct powerpc_opcode *op_end;
const struct powerpc_macro *macro; const struct powerpc_macro *macro;
const struct powerpc_macro *macro_end; const struct powerpc_macro *macro_end;
@ -1352,7 +1333,7 @@ ppc_setup_opcodes (void)
{ {
const char *retval; const char *retval;
retval = hash_insert (ppc_hash, op->name, (PTR) op); retval = hash_insert (ppc_hash, op->name, (void *) op);
if (retval != NULL) if (retval != NULL)
{ {
/* Ignore Power duplicates for -m601. */ /* Ignore Power duplicates for -m601. */
@ -1369,7 +1350,7 @@ ppc_setup_opcodes (void)
if ((ppc_cpu & PPC_OPCODE_ANY) != 0) if ((ppc_cpu & PPC_OPCODE_ANY) != 0)
for (op = powerpc_opcodes; op < op_end; op++) for (op = powerpc_opcodes; op < op_end; op++)
hash_insert (ppc_hash, op->name, (PTR) op); hash_insert (ppc_hash, op->name, (void *) op);
/* Insert the macros into a hash table. */ /* Insert the macros into a hash table. */
ppc_macro_hash = hash_new (); ppc_macro_hash = hash_new ();
@ -1381,7 +1362,7 @@ ppc_setup_opcodes (void)
{ {
const char *retval; const char *retval;
retval = hash_insert (ppc_macro_hash, macro->name, (PTR) macro); retval = hash_insert (ppc_macro_hash, macro->name, (void *) macro);
if (retval != (const char *) NULL) if (retval != (const char *) NULL)
{ {
as_bad (_("duplicate macro %s"), macro->name); as_bad (_("duplicate macro %s"), macro->name);
@ -1399,7 +1380,7 @@ ppc_setup_opcodes (void)
opened. */ opened. */
void void
md_begin () md_begin (void)
{ {
ppc_set_cpu (); ppc_set_cpu ();
@ -1442,7 +1423,7 @@ md_begin ()
} }
void void
ppc_cleanup () ppc_cleanup (void)
{ {
#ifdef OBJ_ELF #ifdef OBJ_ELF
if (ppc_apuinfo_list == NULL) if (ppc_apuinfo_list == NULL)
@ -1579,9 +1560,7 @@ ppc_insert_operand (unsigned long insn,
#ifdef OBJ_ELF #ifdef OBJ_ELF
/* Parse @got, etc. and return the desired relocation. */ /* Parse @got, etc. and return the desired relocation. */
static bfd_reloc_code_real_type static bfd_reloc_code_real_type
ppc_elf_suffix (str_p, exp_p) ppc_elf_suffix (char **str_p, expressionS *exp_p)
char **str_p;
expressionS *exp_p;
{ {
struct map_bfd { struct map_bfd {
char *string; char *string;
@ -1759,8 +1738,7 @@ ppc_elf_suffix (str_p, exp_p)
/* Like normal .long/.short/.word, except support @got, etc. /* Like normal .long/.short/.word, except support @got, etc.
Clobbers input_line_pointer, checks end-of-line. */ Clobbers input_line_pointer, checks end-of-line. */
static void static void
ppc_elf_cons (nbytes) ppc_elf_cons (int nbytes /* 1=.byte, 2=.word, 4=.long, 8=.llong */)
register int nbytes; /* 1=.byte, 2=.word, 4=.long, 8=.llong. */
{ {
expressionS exp; expressionS exp;
bfd_reloc_code_real_type reloc; bfd_reloc_code_real_type reloc;
@ -1815,8 +1793,7 @@ ppc_elf_cons (nbytes)
/* Solaris pseduo op to change to the .rodata section. */ /* Solaris pseduo op to change to the .rodata section. */
static void static void
ppc_elf_rdata (xxx) ppc_elf_rdata (int xxx)
int xxx;
{ {
char *save_line = input_line_pointer; char *save_line = input_line_pointer;
static char section[] = ".rodata\n"; static char section[] = ".rodata\n";
@ -1830,14 +1807,13 @@ ppc_elf_rdata (xxx)
/* Pseudo op to make file scope bss items. */ /* Pseudo op to make file scope bss items. */
static void static void
ppc_elf_lcomm (xxx) ppc_elf_lcomm (int xxx ATTRIBUTE_UNUSED)
int xxx ATTRIBUTE_UNUSED;
{ {
register char *name; char *name;
register char c; char c;
register char *p; char *p;
offsetT size; offsetT size;
register symbolS *symbolP; symbolS *symbolP;
offsetT align; offsetT align;
segT old_sec; segT old_sec;
int old_subsec; int old_subsec;
@ -1940,9 +1916,7 @@ ppc_elf_lcomm (xxx)
fixups for word relocations in writable segments, so we can adjust fixups for word relocations in writable segments, so we can adjust
them at runtime. */ them at runtime. */
static void static void
ppc_elf_validate_fix (fixp, seg) ppc_elf_validate_fix (fixS *fixp, segT seg)
fixS *fixp;
segT seg;
{ {
if (fixp->fx_done || fixp->fx_pcrel) if (fixp->fx_done || fixp->fx_pcrel)
return; return;
@ -1987,7 +1961,7 @@ ppc_elf_validate_fix (fixp, seg)
function descriptor sym if the corresponding code sym is used. */ function descriptor sym if the corresponding code sym is used. */
void void
ppc_frob_file_before_adjust () ppc_frob_file_before_adjust (void)
{ {
symbolS *symp; symbolS *symp;
asection *toc; asection *toc;
@ -2070,8 +2044,7 @@ enum toc_size_qualifier
}; };
static int static int
parse_toc_entry (toc_kind) parse_toc_entry (enum toc_size_qualifier *toc_kind)
enum toc_size_qualifier *toc_kind;
{ {
char *start; char *start;
char *toc_spec; char *toc_spec;
@ -2135,8 +2108,7 @@ parse_toc_entry (toc_kind)
#ifdef OBJ_ELF #ifdef OBJ_ELF
#define APUID(a,v) ((((a) & 0xffff) << 16) | ((v) & 0xffff)) #define APUID(a,v) ((((a) & 0xffff) << 16) | ((v) & 0xffff))
static void static void
ppc_apuinfo_section_add (apu, version) ppc_apuinfo_section_add (unsigned int apu, unsigned int version)
unsigned int apu, version;
{ {
unsigned int i; unsigned int i;
@ -2182,8 +2154,7 @@ struct ppc_fixup
/* This routine is called for each instruction to be assembled. */ /* This routine is called for each instruction to be assembled. */
void void
md_assemble (str) md_assemble (char *str)
char *str;
{ {
char *s; char *s;
const struct powerpc_opcode *opcode; const struct powerpc_opcode *opcode;
@ -2807,9 +2778,7 @@ md_assemble (str)
around operands here. */ around operands here. */
static void static void
ppc_macro (str, macro) ppc_macro (char *str, const struct powerpc_macro *macro)
char *str;
const struct powerpc_macro *macro;
{ {
char *operands[10]; char *operands[10];
unsigned int count; unsigned int count;
@ -2885,9 +2854,7 @@ ppc_macro (str, macro)
/* For ELF, add support for SHF_EXCLUDE and SHT_ORDERED. */ /* For ELF, add support for SHF_EXCLUDE and SHT_ORDERED. */
int int
ppc_section_letter (letter, ptr_msg) ppc_section_letter (int letter, char **ptr_msg)
int letter;
char **ptr_msg;
{ {
if (letter == 'e') if (letter == 'e')
return SHF_EXCLUDE; return SHF_EXCLUDE;
@ -2897,9 +2864,7 @@ ppc_section_letter (letter, ptr_msg)
} }
int int
ppc_section_word (str, len) ppc_section_word (char *str, size_t len)
char *str;
size_t len;
{ {
if (len == 7 && strncmp (str, "exclude", 7) == 0) if (len == 7 && strncmp (str, "exclude", 7) == 0)
return SHF_EXCLUDE; return SHF_EXCLUDE;
@ -2908,9 +2873,7 @@ ppc_section_word (str, len)
} }
int int
ppc_section_type (str, len) ppc_section_type (char *str, size_t len)
char *str;
size_t len;
{ {
if (len == 7 && strncmp (str, "ordered", 7) == 0) if (len == 7 && strncmp (str, "ordered", 7) == 0)
return SHT_ORDERED; return SHT_ORDERED;
@ -2919,10 +2882,7 @@ ppc_section_type (str, len)
} }
int int
ppc_section_flags (flags, attr, type) ppc_section_flags (int flags, int attr, int type)
int flags;
int attr;
int type;
{ {
if (type == SHT_ORDERED) if (type == SHT_ORDERED)
flags |= SEC_ALLOC | SEC_LOAD | SEC_SORT_ENTRIES; flags |= SEC_ALLOC | SEC_LOAD | SEC_SORT_ENTRIES;
@ -2941,8 +2901,7 @@ ppc_section_flags (flags, attr, type)
pseudo-op, but it can also take a single ASCII string. */ pseudo-op, but it can also take a single ASCII string. */
static void static void
ppc_byte (ignore) ppc_byte (int ignore ATTRIBUTE_UNUSED)
int ignore ATTRIBUTE_UNUSED;
{ {
if (*input_line_pointer != '\"') if (*input_line_pointer != '\"')
{ {
@ -2986,8 +2945,7 @@ static bfd_boolean ppc_stab_symbol;
aligns .comm and .lcomm to 4 bytes. */ aligns .comm and .lcomm to 4 bytes. */
static void static void
ppc_comm (lcomm) ppc_comm (int lcomm)
int lcomm;
{ {
asection *current_seg = now_seg; asection *current_seg = now_seg;
subsegT current_subseg = now_subseg; subsegT current_subseg = now_subseg;
@ -3141,8 +3099,7 @@ ppc_comm (lcomm)
optional second argument is the alignment (the default is 2). */ optional second argument is the alignment (the default is 2). */
static void static void
ppc_csect (ignore) ppc_csect (int ignore ATTRIBUTE_UNUSED)
int ignore ATTRIBUTE_UNUSED;
{ {
char *name; char *name;
char endc; char endc;
@ -3177,9 +3134,7 @@ ppc_csect (ignore)
/* Change to a different csect. */ /* Change to a different csect. */
static void static void
ppc_change_csect (sym, align) ppc_change_csect (symbolS *sym, offsetT align)
symbolS *sym;
offsetT align;
{ {
if (S_IS_DEFINED (sym)) if (S_IS_DEFINED (sym))
subseg_set (S_GET_SEGMENT (sym), symbol_get_tc (sym)->subseg); subseg_set (S_GET_SEGMENT (sym), symbol_get_tc (sym)->subseg);
@ -3279,8 +3234,7 @@ ppc_change_csect (sym, align)
convenience of people who aren't used to XCOFF. */ convenience of people who aren't used to XCOFF. */
static void static void
ppc_section (type) ppc_section (int type)
int type;
{ {
const char *name; const char *name;
symbolS *sym; symbolS *sym;
@ -3304,8 +3258,7 @@ ppc_section (type)
we do permit the user to name the text or data section. */ we do permit the user to name the text or data section. */
static void static void
ppc_named_section (ignore) ppc_named_section (int ignore ATTRIBUTE_UNUSED)
int ignore ATTRIBUTE_UNUSED;
{ {
char *user_name; char *user_name;
const char *real_name; const char *real_name;
@ -3339,8 +3292,7 @@ ppc_named_section (ignore)
/* The .extern pseudo-op. We create an undefined symbol. */ /* The .extern pseudo-op. We create an undefined symbol. */
static void static void
ppc_extern (ignore) ppc_extern (int ignore ATTRIBUTE_UNUSED)
int ignore ATTRIBUTE_UNUSED;
{ {
char *name; char *name;
char endc; char endc;
@ -3358,8 +3310,7 @@ ppc_extern (ignore)
/* The .lglobl pseudo-op. Keep the symbol in the symbol table. */ /* The .lglobl pseudo-op. Keep the symbol in the symbol table. */
static void static void
ppc_lglobl (ignore) ppc_lglobl (int ignore ATTRIBUTE_UNUSED)
int ignore ATTRIBUTE_UNUSED;
{ {
char *name; char *name;
char endc; char endc;
@ -3381,8 +3332,7 @@ ppc_lglobl (ignore)
although I don't know why it bothers. */ although I don't know why it bothers. */
static void static void
ppc_rename (ignore) ppc_rename (int ignore ATTRIBUTE_UNUSED)
int ignore ATTRIBUTE_UNUSED;
{ {
char *name; char *name;
char endc; char endc;
@ -3417,8 +3367,7 @@ ppc_rename (ignore)
always zero, and I am assuming it is the type. */ always zero, and I am assuming it is the type. */
static void static void
ppc_stabx (ignore) ppc_stabx (int ignore ATTRIBUTE_UNUSED)
int ignore ATTRIBUTE_UNUSED;
{ {
char *name; char *name;
int len; int len;
@ -3544,8 +3493,7 @@ ppc_stabx (ignore)
gets an aux entry like that used for a csect. */ gets an aux entry like that used for a csect. */
static void static void
ppc_function (ignore) ppc_function (int ignore ATTRIBUTE_UNUSED)
int ignore ATTRIBUTE_UNUSED;
{ {
char *name; char *name;
char endc; char endc;
@ -3638,8 +3586,7 @@ ppc_function (ignore)
static symbolS *saved_bi_sym = 0; static symbolS *saved_bi_sym = 0;
static void static void
ppc_bf (ignore) ppc_bf (int ignore ATTRIBUTE_UNUSED)
int ignore ATTRIBUTE_UNUSED;
{ {
symbolS *sym; symbolS *sym;
@ -3674,8 +3621,7 @@ ppc_bf (ignore)
most recent ".bf" symbol. */ most recent ".bf" symbol. */
static void static void
ppc_ef (ignore) ppc_ef (int ignore ATTRIBUTE_UNUSED)
int ignore ATTRIBUTE_UNUSED;
{ {
symbolS *sym; symbolS *sym;
@ -3699,8 +3645,7 @@ ppc_ef (ignore)
is encountered. */ is encountered. */
static void static void
ppc_biei (ei) ppc_biei (int ei)
int ei;
{ {
static symbolS *last_biei; static symbolS *last_biei;
@ -3754,8 +3699,7 @@ ppc_biei (ei)
.bs symbol is the index of this csect symbol. */ .bs symbol is the index of this csect symbol. */
static void static void
ppc_bs (ignore) ppc_bs (int ignore ATTRIBUTE_UNUSED)
int ignore ATTRIBUTE_UNUSED;
{ {
char *name; char *name;
char endc; char endc;
@ -3790,8 +3734,7 @@ ppc_bs (ignore)
/* The .es pseudo-op. Generate a C_ESTART symbol named .es. */ /* The .es pseudo-op. Generate a C_ESTART symbol named .es. */
static void static void
ppc_es (ignore) ppc_es (int ignore ATTRIBUTE_UNUSED)
int ignore ATTRIBUTE_UNUSED;
{ {
symbolS *sym; symbolS *sym;
@ -3815,8 +3758,7 @@ ppc_es (ignore)
line number. */ line number. */
static void static void
ppc_bb (ignore) ppc_bb (int ignore ATTRIBUTE_UNUSED)
int ignore ATTRIBUTE_UNUSED;
{ {
symbolS *sym; symbolS *sym;
@ -3842,8 +3784,7 @@ ppc_bb (ignore)
line number. */ line number. */
static void static void
ppc_eb (ignore) ppc_eb (int ignore ATTRIBUTE_UNUSED)
int ignore ATTRIBUTE_UNUSED;
{ {
symbolS *sym; symbolS *sym;
@ -3867,8 +3808,7 @@ ppc_eb (ignore)
specified name. */ specified name. */
static void static void
ppc_bc (ignore) ppc_bc (int ignore ATTRIBUTE_UNUSED)
int ignore ATTRIBUTE_UNUSED;
{ {
char *name; char *name;
int len; int len;
@ -3890,8 +3830,7 @@ ppc_bc (ignore)
/* The .ec pseudo-op. This just creates a C_ECOMM symbol. */ /* The .ec pseudo-op. This just creates a C_ECOMM symbol. */
static void static void
ppc_ec (ignore) ppc_ec (int ignore ATTRIBUTE_UNUSED)
int ignore ATTRIBUTE_UNUSED;
{ {
symbolS *sym; symbolS *sym;
@ -3910,8 +3849,7 @@ ppc_ec (ignore)
/* The .toc pseudo-op. Switch to the .toc subsegment. */ /* The .toc pseudo-op. Switch to the .toc subsegment. */
static void static void
ppc_toc (ignore) ppc_toc (int ignore ATTRIBUTE_UNUSED)
int ignore ATTRIBUTE_UNUSED;
{ {
if (ppc_toc_csect != (symbolS *) NULL) if (ppc_toc_csect != (symbolS *) NULL)
subseg_set (data_section, symbol_get_tc (ppc_toc_csect)->subseg); subseg_set (data_section, symbol_get_tc (ppc_toc_csect)->subseg);
@ -3957,8 +3895,7 @@ ppc_toc (ignore)
.short pseudo-op, and we want to be compatible. */ .short pseudo-op, and we want to be compatible. */
static void static void
ppc_xcoff_cons (log_size) ppc_xcoff_cons (int log_size)
int log_size;
{ {
frag_align (log_size, 0, 0); frag_align (log_size, 0, 0);
record_alignment (now_seg, log_size); record_alignment (now_seg, log_size);
@ -3966,8 +3903,7 @@ ppc_xcoff_cons (log_size)
} }
static void static void
ppc_vbyte (dummy) ppc_vbyte (int dummy ATTRIBUTE_UNUSED)
int dummy ATTRIBUTE_UNUSED;
{ {
expressionS exp; expressionS exp;
int byte_count; int byte_count;
@ -4010,8 +3946,7 @@ ppc_vbyte (dummy)
the first argument is simply ignored. */ the first argument is simply ignored. */
static void static void
ppc_tc (ignore) ppc_tc (int ignore ATTRIBUTE_UNUSED)
int ignore ATTRIBUTE_UNUSED;
{ {
#ifdef OBJ_XCOFF #ifdef OBJ_XCOFF
@ -4097,8 +4032,7 @@ ppc_tc (ignore)
/* Pseudo-op .machine. */ /* Pseudo-op .machine. */
static void static void
ppc_machine (ignore) ppc_machine (int ignore ATTRIBUTE_UNUSED)
int ignore ATTRIBUTE_UNUSED;
{ {
char *cpu_string; char *cpu_string;
#define MAX_HISTORY 100 #define MAX_HISTORY 100
@ -4161,8 +4095,7 @@ ppc_machine (ignore)
/* See whether a symbol is in the TOC section. */ /* See whether a symbol is in the TOC section. */
static int static int
ppc_is_toc_sym (sym) ppc_is_toc_sym (symbolS *sym)
symbolS *sym;
{ {
#ifdef OBJ_XCOFF #ifdef OBJ_XCOFF
return symbol_get_tc (sym)->class == XMC_TC; return symbol_get_tc (sym)->class == XMC_TC;
@ -4183,8 +4116,7 @@ ppc_is_toc_sym (sym)
/* Set the current section. */ /* Set the current section. */
static void static void
ppc_set_current_section (new) ppc_set_current_section (segT new)
segT new;
{ {
ppc_previous_section = ppc_current_section; ppc_previous_section = ppc_current_section;
ppc_current_section = new; ppc_current_section = new;
@ -4196,8 +4128,7 @@ ppc_set_current_section (new)
warnings: "No previous section" */ warnings: "No previous section" */
static void static void
ppc_previous (ignore) ppc_previous (int ignore ATTRIBUTE_UNUSED)
int ignore ATTRIBUTE_UNUSED;
{ {
symbolS *tmp; symbolS *tmp;
@ -4228,8 +4159,7 @@ ppc_previous (ignore)
handling, debugging, etc. */ handling, debugging, etc. */
static void static void
ppc_pdata (ignore) ppc_pdata (int ignore ATTRIBUTE_UNUSED)
int ignore ATTRIBUTE_UNUSED;
{ {
if (pdata_section == 0) if (pdata_section == 0)
{ {
@ -4263,8 +4193,7 @@ ppc_pdata (ignore)
debugging, etc. */ debugging, etc. */
static void static void
ppc_ydata (ignore) ppc_ydata (int ignore ATTRIBUTE_UNUSED)
int ignore ATTRIBUTE_UNUSED;
{ {
if (ydata_section == 0) if (ydata_section == 0)
{ {
@ -4300,8 +4229,7 @@ ppc_ydata (ignore)
function descriptors, etc. */ function descriptors, etc. */
static void static void
ppc_reldata (ignore) ppc_reldata (int ignore ATTRIBUTE_UNUSED)
int ignore ATTRIBUTE_UNUSED;
{ {
if (reldata_section == 0) if (reldata_section == 0)
{ {
@ -4331,8 +4259,7 @@ ppc_reldata (ignore)
3 - double word aligned (that would be 4 byte boundary) */ 3 - double word aligned (that would be 4 byte boundary) */
static void static void
ppc_rdata (ignore) ppc_rdata (int ignore ATTRIBUTE_UNUSED)
int ignore ATTRIBUTE_UNUSED;
{ {
if (rdata_section == 0) if (rdata_section == 0)
{ {
@ -4358,8 +4285,7 @@ ppc_rdata (ignore)
warnings: None */ warnings: None */
static void static void
ppc_ualong (ignore) ppc_ualong (int ignore ATTRIBUTE_UNUSED)
int ignore ATTRIBUTE_UNUSED;
{ {
/* Try for long. */ /* Try for long. */
cons (4); cons (4);
@ -4373,8 +4299,7 @@ ppc_ualong (ignore)
warnings: Missing symbol name */ warnings: Missing symbol name */
static void static void
ppc_znop (ignore) ppc_znop (int ignore ATTRIBUTE_UNUSED)
int ignore ATTRIBUTE_UNUSED;
{ {
unsigned long insn; unsigned long insn;
const struct powerpc_opcode *opcode; const struct powerpc_opcode *opcode;
@ -4426,14 +4351,13 @@ ppc_znop (ignore)
warnings: */ warnings: */
static void static void
ppc_pe_comm (lcomm) ppc_pe_comm (int lcomm)
int lcomm;
{ {
register char *name; char *name;
register char c; char c;
register char *p; char *p;
offsetT temp; offsetT temp;
register symbolS *symbolP; symbolS *symbolP;
offsetT align; offsetT align;
name = input_line_pointer; name = input_line_pointer;
@ -4556,8 +4480,7 @@ ppc_pe_comm (lcomm)
*/ */
void void
ppc_pe_section (ignore) ppc_pe_section (int ignore ATTRIBUTE_UNUSED)
int ignore ATTRIBUTE_UNUSED;
{ {
/* Strip out the section name. */ /* Strip out the section name. */
char *section_name; char *section_name;
@ -4719,8 +4642,7 @@ ppc_pe_section (ignore)
} }
static void static void
ppc_pe_function (ignore) ppc_pe_function (int ignore ATTRIBUTE_UNUSED)
int ignore ATTRIBUTE_UNUSED;
{ {
char *name; char *name;
char endc; char endc;
@ -4742,8 +4664,7 @@ ppc_pe_function (ignore)
} }
static void static void
ppc_pe_tocd (ignore) ppc_pe_tocd (int ignore ATTRIBUTE_UNUSED)
int ignore ATTRIBUTE_UNUSED;
{ {
if (tocdata_section == 0) if (tocdata_section == 0)
{ {
@ -4768,8 +4689,7 @@ ppc_pe_tocd (ignore)
/* Don't adjust TOC relocs to use the section symbol. */ /* Don't adjust TOC relocs to use the section symbol. */
int int
ppc_pe_fix_adjustable (fix) ppc_pe_fix_adjustable (fixS *fix)
fixS *fix;
{ {
return fix->fx_r_type != BFD_RELOC_PPC_TOC16; return fix->fx_r_type != BFD_RELOC_PPC_TOC16;
} }
@ -4784,8 +4704,7 @@ ppc_pe_fix_adjustable (fix)
any, to use square brackets, and to be in upper case. */ any, to use square brackets, and to be in upper case. */
char * char *
ppc_canonicalize_symbol_name (name) ppc_canonicalize_symbol_name (char *name)
char *name;
{ {
char *s; char *s;
@ -4822,8 +4741,7 @@ ppc_canonicalize_symbol_name (name)
called whenever a new symbol is created. */ called whenever a new symbol is created. */
void void
ppc_symbol_new_hook (sym) ppc_symbol_new_hook (symbolS *sym)
symbolS *sym;
{ {
struct ppc_tc_sy *tc; struct ppc_tc_sy *tc;
const char *s; const char *s;
@ -4911,8 +4829,7 @@ ppc_symbol_new_hook (sym)
follows the csect symbol. */ follows the csect symbol. */
void void
ppc_frob_label (sym) ppc_frob_label (symbolS *sym)
symbolS *sym;
{ {
if (ppc_current_csect != (symbolS *) NULL) if (ppc_current_csect != (symbolS *) NULL)
{ {
@ -4942,8 +4859,7 @@ static bfd_boolean ppc_saw_abs;
symbol table. */ symbol table. */
int int
ppc_frob_symbol (sym) ppc_frob_symbol (symbolS *sym)
symbolS *sym;
{ {
static symbolS *ppc_last_function; static symbolS *ppc_last_function;
static symbolS *set_end; static symbolS *set_end;
@ -5206,7 +5122,7 @@ ppc_frob_symbol (sym)
absolute symbols. */ absolute symbols. */
void void
ppc_adjust_symtab () ppc_adjust_symtab (void)
{ {
symbolS *sym; symbolS *sym;
@ -5252,8 +5168,7 @@ ppc_adjust_symtab ()
turn. */ turn. */
void void
ppc_frob_section (sec) ppc_frob_section (asection *sec)
asection *sec;
{ {
static bfd_vma vma = 0; static bfd_vma vma = 0;
@ -5270,10 +5185,7 @@ ppc_frob_section (sec)
returned, or NULL on OK. */ returned, or NULL on OK. */
char * char *
md_atof (type, litp, sizep) md_atof (int type, char *litp, int *sizep)
int type;
char *litp;
int *sizep;
{ {
int prec; int prec;
LITTLENUM_TYPE words[4]; LITTLENUM_TYPE words[4];
@ -5325,10 +5237,7 @@ md_atof (type, litp, sizep)
endianness. */ endianness. */
void void
md_number_to_chars (buf, val, n) md_number_to_chars (char *buf, valueT val, int n)
char *buf;
valueT val;
int n;
{ {
if (target_big_endian) if (target_big_endian)
number_to_chars_bigendian (buf, val, n); number_to_chars_bigendian (buf, val, n);
@ -5353,9 +5262,8 @@ md_section_align (asection *seg ATTRIBUTE_UNUSED, valueT addr)
/* We don't have any form of relaxing. */ /* We don't have any form of relaxing. */
int int
md_estimate_size_before_relax (fragp, seg) md_estimate_size_before_relax (fragS *fragp ATTRIBUTE_UNUSED,
fragS *fragp ATTRIBUTE_UNUSED; asection *seg ATTRIBUTE_UNUSED)
asection *seg ATTRIBUTE_UNUSED;
{ {
abort (); abort ();
return 0; return 0;
@ -5364,10 +5272,9 @@ md_estimate_size_before_relax (fragp, seg)
/* Convert a machine dependent frag. We never generate these. */ /* Convert a machine dependent frag. We never generate these. */
void void
md_convert_frag (abfd, sec, fragp) md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED,
bfd *abfd ATTRIBUTE_UNUSED; asection *sec ATTRIBUTE_UNUSED,
asection *sec ATTRIBUTE_UNUSED; fragS *fragp ATTRIBUTE_UNUSED)
fragS *fragp ATTRIBUTE_UNUSED;
{ {
abort (); abort ();
} }
@ -5375,8 +5282,7 @@ md_convert_frag (abfd, sec, fragp)
/* We have no need to default values of symbols. */ /* We have no need to default values of symbols. */
symbolS * symbolS *
md_undefined_symbol (name) md_undefined_symbol (char *name ATTRIBUTE_UNUSED)
char *name ATTRIBUTE_UNUSED;
{ {
return 0; return 0;
} }
@ -5387,9 +5293,7 @@ md_undefined_symbol (name)
given a PC relative reloc. */ given a PC relative reloc. */
long long
md_pcrel_from_section (fixp, sec) md_pcrel_from_section (fixS *fixp, segT sec ATTRIBUTE_UNUSED)
fixS *fixp;
segT sec ATTRIBUTE_UNUSED;
{ {
return fixp->fx_frag->fr_address + fixp->fx_where; return fixp->fx_frag->fr_address + fixp->fx_where;
} }
@ -5402,8 +5306,7 @@ md_pcrel_from_section (fixp, sec)
corresponding .tc symbol. */ corresponding .tc symbol. */
int int
ppc_fix_adjustable (fix) ppc_fix_adjustable (fixS *fix)
fixS *fix;
{ {
valueT val = resolve_symbol_value (fix->fx_addsy); valueT val = resolve_symbol_value (fix->fx_addsy);
segT symseg = S_GET_SEGMENT (fix->fx_addsy); segT symseg = S_GET_SEGMENT (fix->fx_addsy);
@ -5528,8 +5431,7 @@ ppc_fix_adjustable (fix)
between two csects in the same section. */ between two csects in the same section. */
int int
ppc_force_relocation (fix) ppc_force_relocation (fixS *fix)
fixS *fix;
{ {
/* At this point fix->fx_addsy should already have been converted to /* At this point fix->fx_addsy should already have been converted to
a csect symbol. If the csect does not include the fragment, then a csect symbol. If the csect does not include the fragment, then
@ -5554,8 +5456,7 @@ ppc_force_relocation (fix)
will be emitted for a fixup. */ will be emitted for a fixup. */
int int
ppc_force_relocation (fix) ppc_force_relocation (fixS *fix)
fixS *fix;
{ {
/* Branch prediction relocations must force a relocation, as must /* Branch prediction relocations must force a relocation, as must
the vtable description relocs. */ the vtable description relocs. */
@ -5580,8 +5481,7 @@ ppc_force_relocation (fix)
} }
int int
ppc_fix_adjustable (fix) ppc_fix_adjustable (fixS *fix)
fixS *fix;
{ {
return (fix->fx_r_type != BFD_RELOC_16_GOTOFF return (fix->fx_r_type != BFD_RELOC_16_GOTOFF
&& fix->fx_r_type != BFD_RELOC_LO16_GOTOFF && fix->fx_r_type != BFD_RELOC_LO16_GOTOFF
@ -5646,10 +5546,7 @@ ppc_handle_align (struct frag *fragP)
fixup. */ fixup. */
void void
md_apply_fix (fixP, valP, seg) md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
fixS *fixP;
valueT * valP;
segT seg ATTRIBUTE_UNUSED;
{ {
valueT value = * valP; valueT value = * valP;
@ -6173,9 +6070,7 @@ md_apply_fix (fixP, valP, seg)
/* Generate a reloc for a fixup. */ /* Generate a reloc for a fixup. */
arelent * arelent *
tc_gen_reloc (seg, fixp) tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp)
asection *seg ATTRIBUTE_UNUSED;
fixS *fixp;
{ {
arelent *reloc; arelent *reloc;
@ -6198,7 +6093,7 @@ tc_gen_reloc (seg, fixp)
} }
void void
ppc_cfi_frame_initial_instructions () ppc_cfi_frame_initial_instructions (void)
{ {
cfi_add_CFA_def_cfa (1, 0); cfi_add_CFA_def_cfa (1, 0);
} }

View File

@ -1,6 +1,6 @@
/* tc-ppc.h -- Header file for tc-ppc.c. /* tc-ppc.h -- Header file for tc-ppc.c.
Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
2004, 2005, 2006 Free Software Foundation, Inc. 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support. Written by Ian Lance Taylor, Cygnus Support.
This file is part of GAS, the GNU Assembler. This file is part of GAS, the GNU Assembler.
@ -42,15 +42,15 @@ struct fix;
/* The target BFD architecture. */ /* The target BFD architecture. */
#define TARGET_ARCH (ppc_arch ()) #define TARGET_ARCH (ppc_arch ())
#define TARGET_MACH (ppc_mach ()) #define TARGET_MACH (ppc_mach ())
extern enum bfd_architecture ppc_arch PARAMS ((void)); extern enum bfd_architecture ppc_arch (void);
extern unsigned long ppc_mach PARAMS ((void)); extern unsigned long ppc_mach (void);
/* Whether or not the target is big endian */ /* Whether or not the target is big endian */
extern int target_big_endian; extern int target_big_endian;
/* The target BFD format. */ /* The target BFD format. */
#define TARGET_FORMAT (ppc_target_format ()) #define TARGET_FORMAT (ppc_target_format ())
extern char *ppc_target_format PARAMS ((void)); extern char *ppc_target_format (void);
/* Permit temporary numeric labels. */ /* Permit temporary numeric labels. */
#define LOCAL_LABELS_FB 1 #define LOCAL_LABELS_FB 1
@ -98,7 +98,7 @@ extern void ppc_handle_align (struct frag *);
/* Don't adjust TOC relocs. */ /* Don't adjust TOC relocs. */
#define tc_fix_adjustable(FIX) ppc_pe_fix_adjustable (FIX) #define tc_fix_adjustable(FIX) ppc_pe_fix_adjustable (FIX)
extern int ppc_pe_fix_adjustable PARAMS ((struct fix *)); extern int ppc_pe_fix_adjustable (struct fix *);
#endif #endif
@ -146,31 +146,31 @@ struct ppc_tc_sy
/* Canonicalize the symbol name. */ /* Canonicalize the symbol name. */
#define tc_canonicalize_symbol_name(name) ppc_canonicalize_symbol_name (name) #define tc_canonicalize_symbol_name(name) ppc_canonicalize_symbol_name (name)
extern char *ppc_canonicalize_symbol_name PARAMS ((char *)); extern char *ppc_canonicalize_symbol_name (char *);
/* Get the symbol class from the name. */ /* Get the symbol class from the name. */
#define tc_symbol_new_hook(sym) ppc_symbol_new_hook (sym) #define tc_symbol_new_hook(sym) ppc_symbol_new_hook (sym)
extern void ppc_symbol_new_hook PARAMS ((symbolS *)); extern void ppc_symbol_new_hook (symbolS *);
/* Set the symbol class of a label based on the csect. */ /* Set the symbol class of a label based on the csect. */
#define tc_frob_label(sym) ppc_frob_label (sym) #define tc_frob_label(sym) ppc_frob_label (sym)
extern void ppc_frob_label PARAMS ((symbolS *)); extern void ppc_frob_label (symbolS *);
/* TOC relocs requires special handling. */ /* TOC relocs requires special handling. */
#define tc_fix_adjustable(FIX) ppc_fix_adjustable (FIX) #define tc_fix_adjustable(FIX) ppc_fix_adjustable (FIX)
extern int ppc_fix_adjustable PARAMS ((struct fix *)); extern int ppc_fix_adjustable (struct fix *);
/* We need to set the section VMA. */ /* We need to set the section VMA. */
#define tc_frob_section(sec) ppc_frob_section (sec) #define tc_frob_section(sec) ppc_frob_section (sec)
extern void ppc_frob_section PARAMS ((asection *)); extern void ppc_frob_section (asection *);
/* Finish up the symbol. */ /* Finish up the symbol. */
#define tc_frob_symbol(sym, punt) punt = ppc_frob_symbol (sym) #define tc_frob_symbol(sym, punt) punt = ppc_frob_symbol (sym)
extern int ppc_frob_symbol PARAMS ((symbolS *)); extern int ppc_frob_symbol (symbolS *);
/* Finish up the entire symtab. */ /* Finish up the entire symtab. */
#define tc_adjust_symtab() ppc_adjust_symtab () #define tc_adjust_symtab() ppc_adjust_symtab ()
extern void ppc_adjust_symtab PARAMS ((void)); extern void ppc_adjust_symtab (void);
/* We also need to copy, in particular, the class of the symbol, /* We also need to copy, in particular, the class of the symbol,
over what obj-coff would otherwise have copied. */ over what obj-coff would otherwise have copied. */
@ -192,10 +192,10 @@ extern const char ppc_symbol_chars[];
#ifdef OBJ_ELF #ifdef OBJ_ELF
/* Support for SHF_EXCLUDE and SHT_ORDERED */ /* Support for SHF_EXCLUDE and SHT_ORDERED */
extern int ppc_section_letter PARAMS ((int, char **)); extern int ppc_section_letter (int, char **);
extern int ppc_section_type PARAMS ((char *, size_t)); extern int ppc_section_type (char *, size_t);
extern int ppc_section_word PARAMS ((char *, size_t)); extern int ppc_section_word (char *, size_t);
extern int ppc_section_flags PARAMS ((int, int, int)); extern int ppc_section_flags (int, int, int);
#define md_elf_section_letter(LETTER, PTR_MSG) ppc_section_letter (LETTER, PTR_MSG) #define md_elf_section_letter(LETTER, PTR_MSG) ppc_section_letter (LETTER, PTR_MSG)
#define md_elf_section_type(STR, LEN) ppc_section_type (STR, LEN) #define md_elf_section_type(STR, LEN) ppc_section_type (STR, LEN)
@ -207,40 +207,40 @@ extern const char *ppc_comment_chars;
/* Keep relocations relative to the GOT, or non-PC relative. */ /* Keep relocations relative to the GOT, or non-PC relative. */
#define tc_fix_adjustable(FIX) ppc_fix_adjustable (FIX) #define tc_fix_adjustable(FIX) ppc_fix_adjustable (FIX)
extern int ppc_fix_adjustable PARAMS ((struct fix *)); extern int ppc_fix_adjustable (struct fix *);
/* Values passed to md_apply_fix don't include symbol values. */ /* Values passed to md_apply_fix don't include symbol values. */
#define MD_APPLY_SYM_VALUE(FIX) 0 #define MD_APPLY_SYM_VALUE(FIX) 0
#define tc_frob_file_before_adjust ppc_frob_file_before_adjust #define tc_frob_file_before_adjust ppc_frob_file_before_adjust
extern void ppc_frob_file_before_adjust PARAMS ((void)); extern void ppc_frob_file_before_adjust (void);
#endif /* OBJ_ELF */ #endif /* OBJ_ELF */
#if defined (OBJ_ELF) || defined (OBJ_XCOFF) #if defined (OBJ_ELF) || defined (OBJ_XCOFF)
#define TC_FORCE_RELOCATION(FIX) ppc_force_relocation (FIX) #define TC_FORCE_RELOCATION(FIX) ppc_force_relocation (FIX)
extern int ppc_force_relocation PARAMS ((struct fix *)); extern int ppc_force_relocation (struct fix *);
#endif #endif
/* call md_pcrel_from_section, not md_pcrel_from */ /* call md_pcrel_from_section, not md_pcrel_from */
#define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section(FIX, SEC) #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section(FIX, SEC)
extern long md_pcrel_from_section PARAMS ((struct fix *, segT)); extern long md_pcrel_from_section (struct fix *, segT);
#define md_parse_name(name, exp, mode, c) ppc_parse_name (name, exp) #define md_parse_name(name, exp, mode, c) ppc_parse_name (name, exp)
extern int ppc_parse_name PARAMS ((const char *, struct expressionS *)); extern int ppc_parse_name (const char *, struct expressionS *);
#define md_operand(x) #define md_operand(x)
#define md_cleanup() ppc_cleanup () #define md_cleanup() ppc_cleanup ()
extern void ppc_cleanup PARAMS ((void)); extern void ppc_cleanup (void);
#define TARGET_USE_CFIPOP 1 #define TARGET_USE_CFIPOP 1
#define tc_cfi_frame_initial_instructions ppc_cfi_frame_initial_instructions #define tc_cfi_frame_initial_instructions ppc_cfi_frame_initial_instructions
extern void ppc_cfi_frame_initial_instructions PARAMS ((void)); extern void ppc_cfi_frame_initial_instructions (void);
#define tc_regname_to_dw2regnum tc_ppc_regname_to_dw2regnum #define tc_regname_to_dw2regnum tc_ppc_regname_to_dw2regnum
extern int tc_ppc_regname_to_dw2regnum PARAMS ((char *regname)); extern int tc_ppc_regname_to_dw2regnum (char *);
extern int ppc_cie_data_alignment; extern int ppc_cie_data_alignment;