From 20ee54e8179d55eb972076578d9642dabd8abff8 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Thu, 1 Feb 2007 14:12:20 +0000 Subject: [PATCH] * write.h (struct fix ): Move. (struct fix ): Rename to tcbit2. * write.c (fix_new_internal): Adjust. (TC_FORCE_RELOCATION_LOCAL): Don't test fx_plt. * config/tc-arm.h (TC_FORCE_RELOCATION_LOCAL): Likewise. * config/tc-cris.h (TC_FORCE_RELOCATION_LOCAL): Likewise. * config/tc-i386.h (TC_FORCE_RELOCATION_LOCAL): Likewise. * config/tc-i960.h (TC_FORCE_RELOCATION_LOCAL): Likewise. * config/tc-sh.h (TC_FORCE_RELOCATION_LOCAL): Likewise. * config/tc-sh64.h (TC_FORCE_RELOCATION_LOCAL): Likewise. * config/tc-sparc.h (TC_FORCE_RELOCATION_LOCAL): Likewise. * config/tc-msp430.c (msp430_force_relocation_local): Likewise. * config/tc-ia64.c (emit_one_bundle): Don't set fx_plt. * config/tc-ia64.h (TC_FORCE_RELOCATION_LOCAL): Don't test fx_plt. Instead, compare fx_r_type. * config/tc-xtensa.c (xg_add_opcode_fix, md_apply_fix): Use fx_tcbit in place of fx_plt. * config/tc-xtensa.h (TC_FORCE_RELOCATION_LOCAL): Define. * doc/internals.texi (TC_FORCE_RELOCATION_LOCAL): Remove reference to fx_plt. --- gas/ChangeLog | 23 +++++++++++++++++++++++ gas/config/tc-arm.h | 3 +-- gas/config/tc-cris.h | 5 ++--- gas/config/tc-i386.h | 1 - gas/config/tc-i960.h | 3 +-- gas/config/tc-ia64.c | 3 +-- gas/config/tc-ia64.h | 4 ++-- gas/config/tc-msp430.c | 4 ++-- gas/config/tc-sh.h | 3 +-- gas/config/tc-sh64.h | 4 ++-- gas/config/tc-sparc.h | 4 ++-- gas/config/tc-xtensa.c | 5 +++-- gas/config/tc-xtensa.h | 4 ++++ gas/doc/internals.texi | 2 +- gas/write.c | 5 ++--- gas/write.h | 28 +++++++++++----------------- 16 files changed, 58 insertions(+), 43 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index d23030c..98b873d 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,26 @@ +2007-02-02 Alan Modra + + * write.h (struct fix ): Move. + (struct fix ): Rename to tcbit2. + * write.c (fix_new_internal): Adjust. + (TC_FORCE_RELOCATION_LOCAL): Don't test fx_plt. + * config/tc-arm.h (TC_FORCE_RELOCATION_LOCAL): Likewise. + * config/tc-cris.h (TC_FORCE_RELOCATION_LOCAL): Likewise. + * config/tc-i386.h (TC_FORCE_RELOCATION_LOCAL): Likewise. + * config/tc-i960.h (TC_FORCE_RELOCATION_LOCAL): Likewise. + * config/tc-sh.h (TC_FORCE_RELOCATION_LOCAL): Likewise. + * config/tc-sh64.h (TC_FORCE_RELOCATION_LOCAL): Likewise. + * config/tc-sparc.h (TC_FORCE_RELOCATION_LOCAL): Likewise. + * config/tc-msp430.c (msp430_force_relocation_local): Likewise. + * config/tc-ia64.c (emit_one_bundle): Don't set fx_plt. + * config/tc-ia64.h (TC_FORCE_RELOCATION_LOCAL): Don't test fx_plt. + Instead, compare fx_r_type. + * config/tc-xtensa.c (xg_add_opcode_fix, md_apply_fix): Use + fx_tcbit in place of fx_plt. + * config/tc-xtensa.h (TC_FORCE_RELOCATION_LOCAL): Define. + * doc/internals.texi (TC_FORCE_RELOCATION_LOCAL): Remove reference + to fx_plt. + 2007-01-30 Nick Clifton * as.c (main): Mark symbols created via the --defsym command line diff --git a/gas/config/tc-arm.h b/gas/config/tc-arm.h index 591d496..d7df213 100644 --- a/gas/config/tc-arm.h +++ b/gas/config/tc-arm.h @@ -1,6 +1,6 @@ /* This file is tc-arm.h 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. Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org) Modified by David Taylor (dtaylor@armltd.co.uk) @@ -161,7 +161,6 @@ bfd_boolean arm_is_eabi (void); #define TC_FORCE_RELOCATION_LOCAL(FIX) \ (!(FIX)->fx_pcrel \ - || (FIX)->fx_plt \ || (FIX)->fx_r_type == BFD_RELOC_ARM_GOT32 \ || (FIX)->fx_r_type == BFD_RELOC_32 \ || TC_FORCE_RELOCATION (FIX)) diff --git a/gas/config/tc-cris.h b/gas/config/tc-cris.h index 34e6ef8..59bbc07 100644 --- a/gas/config/tc-cris.h +++ b/gas/config/tc-cris.h @@ -1,5 +1,5 @@ /* tc-cris.h -- Header file for tc-cris.c, the CRIS GAS port. - Copyright 2000, 2001, 2002, 2003, 2004, 2005 + Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc. Contributed by Axis Communications AB, Lund, Sweden. @@ -99,10 +99,9 @@ extern int md_cris_force_relocation (struct fix *); || (RTYPE) == BFD_RELOC_CRIS_32_PLT_PCREL) /* Make sure we don't resolve fixups for which we want to emit dynamic - relocations. FIXME: Set fx_plt instead of using IS_CRIS_PIC_RELOC. */ + relocations. */ #define TC_FORCE_RELOCATION_LOCAL(FIX) \ (!(FIX)->fx_pcrel \ - || (FIX)->fx_plt \ || IS_CRIS_PIC_RELOC ((FIX)->fx_r_type) \ || TC_FORCE_RELOCATION (FIX)) diff --git a/gas/config/tc-i386.h b/gas/config/tc-i386.h index 7a83e61..a2b4f5d 100644 --- a/gas/config/tc-i386.h +++ b/gas/config/tc-i386.h @@ -457,7 +457,6 @@ extern int tc_i386_fix_adjustable (struct fix *); #define TC_FORCE_RELOCATION_LOCAL(FIX) \ (!(FIX)->fx_pcrel \ - || (FIX)->fx_plt \ || (FIX)->fx_r_type == BFD_RELOC_386_PLT32 \ || (FIX)->fx_r_type == BFD_RELOC_386_GOT32 \ || (FIX)->fx_r_type == BFD_RELOC_386_GOTPC \ diff --git a/gas/config/tc-i960.h b/gas/config/tc-i960.h index 05db36e..c5c33d3 100644 --- a/gas/config/tc-i960.h +++ b/gas/config/tc-i960.h @@ -1,6 +1,6 @@ /* tc-i960.h - Basic 80960 instruction formats. Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 + 2000, 2001, 2002, 2003, 2007 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -139,7 +139,6 @@ extern int reloc_callj PARAMS ((struct fix *)); #define TC_FORCE_RELOCATION_LOCAL(FIX) \ (!(FIX)->fx_pcrel \ - || (FIX)->fx_plt \ || TC_FORCE_RELOCATION (FIX) \ || reloc_callj (FIX)) diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c index 53da869..3a7ac94 100644 --- a/gas/config/tc-ia64.c +++ b/gas/config/tc-ia64.c @@ -1,5 +1,5 @@ /* tc-ia64.c -- Assembler for the HP/Intel IA-64 architecture. - Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Contributed by David Mosberger-Tang @@ -7067,7 +7067,6 @@ emit_one_bundle () fix = fix_new_exp (frag_now, frag_now_fix () - 16 + i, 8, &ifix->expr, ifix->is_pcrel, ifix->code); fix->tc_fix_data.opnd = ifix->opnd; - fix->fx_plt = (fix->fx_r_type == BFD_RELOC_IA64_PLTOFF22); fix->fx_file = md.slot[curr].src_file; fix->fx_line = md.slot[curr].src_line; } diff --git a/gas/config/tc-ia64.h b/gas/config/tc-ia64.h index c17494b..b851b9f 100644 --- a/gas/config/tc-ia64.h +++ b/gas/config/tc-ia64.h @@ -1,5 +1,5 @@ /* tc-ia64.h -- Header file for tc-ia64.c. - Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc. Contributed by David Mosberger-Tang @@ -315,5 +315,5 @@ typedef struct unwind_record #define TC_FORCE_RELOCATION_LOCAL(FIX) \ ((FIX)->fx_r_type != BFD_RELOC_UNUSED \ && (!(FIX)->fx_pcrel \ - || (FIX)->fx_plt \ + || (FIX)->fx_r_type == BFD_RELOC_IA64_PLTOFF22 \ || TC_FORCE_RELOCATION (FIX))) diff --git a/gas/config/tc-msp430.c b/gas/config/tc-msp430.c index 72c73da..6936a2a 100644 --- a/gas/config/tc-msp430.c +++ b/gas/config/tc-msp430.c @@ -1,6 +1,7 @@ /* tc-msp430.c -- Assembler code for the Texas Instruments MSP430 - Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 + Free Software Foundation, Inc. Contributed by Dmitry Diky This file is part of GAS, the GNU Assembler. @@ -1915,7 +1916,6 @@ msp430_force_relocation_local(fixS *fixp) return 1; else return (!fixp->fx_pcrel - || fixp->fx_plt || generic_force_reloc(fixp)); } diff --git a/gas/config/tc-sh.h b/gas/config/tc-sh.h index 4f0d11e..93fdd90 100644 --- a/gas/config/tc-sh.h +++ b/gas/config/tc-sh.h @@ -1,6 +1,6 @@ /* This file is tc-sh.h Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -189,7 +189,6 @@ extern bfd_boolean sh_fix_adjustable (struct fix *); #define TC_FORCE_RELOCATION_LOCAL(FIX) \ (!(FIX)->fx_pcrel \ - || (FIX)->fx_plt \ || (FIX)->fx_r_type == BFD_RELOC_32_PLT_PCREL \ || (FIX)->fx_r_type == BFD_RELOC_32_GOT_PCREL \ || (FIX)->fx_r_type == BFD_RELOC_SH_GOTPC \ diff --git a/gas/config/tc-sh64.h b/gas/config/tc-sh64.h index 21f5d59..f31f750 100644 --- a/gas/config/tc-sh64.h +++ b/gas/config/tc-sh64.h @@ -1,5 +1,6 @@ /* This file is tc-sh64.h - Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright 2000, 2001, 2002, 2003, 2007 + Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -79,7 +80,6 @@ extern int sh64_target_mach (void); #undef TC_FORCE_RELOCATION_LOCAL #define TC_FORCE_RELOCATION_LOCAL(FIX) \ (!(FIX)->fx_pcrel \ - || (FIX)->fx_plt \ || (FIX)->fx_r_type == BFD_RELOC_32_PLT_PCREL \ || (FIX)->fx_r_type == BFD_RELOC_SH_PLT_LOW16 \ || (FIX)->fx_r_type == BFD_RELOC_SH_PLT_MEDLOW16 \ diff --git a/gas/config/tc-sparc.h b/gas/config/tc-sparc.h index 3318ddd..90c0e95 100644 --- a/gas/config/tc-sparc.h +++ b/gas/config/tc-sparc.h @@ -1,6 +1,7 @@ /* tc-sparc.h - Macros and type defines for the sparc. Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc. + 1999, 2000, 2001, 2002, 2003, 2005, 2007 + Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -91,7 +92,6 @@ extern void sparc_handle_align PARAMS ((struct frag *)); #define TC_FORCE_RELOCATION_LOCAL(FIX) \ (!(FIX)->fx_pcrel \ - || (FIX)->fx_plt \ || (sparc_pic_code \ && S_IS_EXTERNAL ((FIX)->fx_addsy)) \ || TC_FORCE_RELOCATION (FIX)) diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c index a8cfd2b..1facdc5 100644 --- a/gas/config/tc-xtensa.c +++ b/gas/config/tc-xtensa.c @@ -4118,7 +4118,7 @@ xg_add_opcode_fix (TInsn *tinsn, if (expr->X_add_symbol && (S_IS_EXTERNAL (expr->X_add_symbol) || S_IS_WEAK (expr->X_add_symbol))) - the_fix->fx_plt = TRUE; + the_fix->fx_tcbit = TRUE; the_fix->tc_fix_data.X_add_symbol = expr->X_add_symbol; the_fix->tc_fix_data.X_add_number = expr->X_add_number; @@ -5566,7 +5566,8 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg) readable when all branch targets are encoded in relocations. */ assert (fixP->fx_addsy); - if (S_GET_SEGMENT (fixP->fx_addsy) == seg && !fixP->fx_plt + if (S_GET_SEGMENT (fixP->fx_addsy) == seg + && !fixP->fx_tcbit && !S_FORCE_RELOC (fixP->fx_addsy, 1)) { val = (S_GET_VALUE (fixP->fx_addsy) + fixP->fx_offset diff --git a/gas/config/tc-xtensa.h b/gas/config/tc-xtensa.h index 838a9ad..47fee4e 100644 --- a/gas/config/tc-xtensa.h +++ b/gas/config/tc-xtensa.h @@ -319,6 +319,10 @@ extern char *xtensa_section_rename (char *); #define TC_FORCE_RELOCATION(fix) xtensa_force_relocation (fix) #define TC_FORCE_RELOCATION_SUB_SAME(fix, seg) \ (! SEG_NORMAL (seg) || xtensa_force_relocation (fix)) +#define TC_FORCE_RELOCATION_LOCAL(FIX) \ + (!(FIX)->fx_pcrel \ + || (FIX)->fx_tcbit \ + || TC_FORCE_RELOCATION (FIX)) #define TC_VALIDATE_FIX_SUB(fix) xtensa_validate_fix_sub (fix) #define NO_PSEUDO_DOT xtensa_check_inside_bundle () #define tc_canonicalize_symbol_name(s) xtensa_section_rename (s) diff --git a/gas/doc/internals.texi b/gas/doc/internals.texi index b2c8586..c63a2db 100644 --- a/gas/doc/internals.texi +++ b/gas/doc/internals.texi @@ -1279,7 +1279,7 @@ absolute symbol. If undefined, @code{TC_FORCE_RELOCATION} will be used. @cindex TC_FORCE_RELOCATION_LOCAL Like @code{TC_FORCE_RELOCATION}, but used only for fixup expressions against a symbol in the current section. If undefined, fixups that are not -@code{fx_pcrel} or @code{fx_plt} or for which @code{TC_FORCE_RELOCATION} +@code{fx_pcrel} or for which @code{TC_FORCE_RELOCATION} returns non-zero, will emit relocs. @item TC_FORCE_RELOCATION_SUB_SAME (@var{fix}, @var{seg}) diff --git a/gas/write.c b/gas/write.c index 2b084e3..62df35c 100644 --- a/gas/write.c +++ b/gas/write.c @@ -1,6 +1,6 @@ /* write.c - emit .o file Copyright 1986, 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, - 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -45,7 +45,6 @@ #ifndef TC_FORCE_RELOCATION_LOCAL #define TC_FORCE_RELOCATION_LOCAL(FIX) \ (!(FIX)->fx_pcrel \ - || (FIX)->fx_plt \ || TC_FORCE_RELOCATION (FIX)) #endif @@ -169,13 +168,13 @@ fix_new_internal (fragS *frag, /* Which frag? */ fixP->fx_offset = offset; fixP->fx_dot_value = dot_value; fixP->fx_pcrel = pcrel; - fixP->fx_plt = 0; fixP->fx_r_type = r_type; fixP->fx_im_disp = 0; fixP->fx_pcrel_adjust = 0; fixP->fx_bit_fixP = 0; fixP->fx_addnumber = 0; fixP->fx_tcbit = 0; + fixP->fx_tcbit2 = 0; fixP->fx_done = 0; fixP->fx_no_overflow = 0; fixP->fx_signed = 0; diff --git a/gas/write.h b/gas/write.h index 1f9b72d..fd21a09 100644 --- a/gas/write.h +++ b/gas/write.h @@ -1,6 +1,7 @@ /* write.h Copyright 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, - 2002, 2003, 2005, 2006 Free Software Foundation, Inc. + 2002, 2003, 2005, 2006, 2007 + Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -45,29 +46,16 @@ struct fix /* These small fields are grouped together for compactness of this structure, and efficiency of access on some architectures. */ - /* pc-relative offset adjust (only used by m68k) */ - char fx_pcrel_adjust; - - /* How many bytes are involved? */ - unsigned char fx_size; - /* Is this a pc-relative relocation? */ unsigned fx_pcrel : 1; - /* Is this a relocation to a procedure linkage table entry? If so, - some of the reductions we try to apply are invalid. A better way - might be to represent PLT entries with different kinds of - symbols, and use normal relocations (with undefined symbols); - look into it for version 2.6. */ - unsigned fx_plt : 1; - /* Is this value an immediate displacement? */ - /* Only used on i960 and ns32k; merge it into TC_FIX_TYPE sometime. */ + /* Only used on ns32k; merge it into TC_FIX_TYPE sometime. */ unsigned fx_im_disp : 2; - /* A bit for the CPU specific code. - This probably can be folded into tc_fix_data, below. */ + /* Some bits for the CPU specific code. */ unsigned fx_tcbit : 1; + unsigned fx_tcbit2 : 1; /* Has this relocation already been applied? */ unsigned fx_done : 1; @@ -82,6 +70,12 @@ struct fix /* The value is signed when checking for overflow. */ unsigned fx_signed : 1; + /* pc-relative offset adjust (only used by m68k and m68hc11) */ + char fx_pcrel_adjust; + + /* How many bytes are involved? */ + unsigned char fx_size; + /* Which frag does this fix apply to? */ fragS *fx_frag; -- 2.7.4