This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Blackfin patch: FD-PIC assembler bits
- From: Bernd Schmidt <bernds_cb1 at t-online dot de>
- To: binutils at sources dot redhat dot com
- Date: Sun, 26 Mar 2006 03:14:15 +0200
- Subject: Blackfin patch: FD-PIC assembler bits
This is the final binutils piece of the FD-PIC patches, I believe. It
adds (minimal) support to the assembler - only enough to support what
our compiler is generating now. Only a subset of the relocations are
actually needed at the moment.
Committed.
Bernd
Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gas/ChangeLog,v
retrieving revision 1.2837
diff -c -p -r1.2837 ChangeLog
*** ChangeLog 25 Mar 2006 10:24:27 -0000 1.2837
--- ChangeLog 26 Mar 2006 01:09:22 -0000
***************
*** 1,3 ****
--- 1,28 ----
+ 2006-03-25 Bernd Schmidt <bernd.schmidt@analog.com>
+
+ * config/bfin-defs.h (Expr_Node_Type enum): Add Expr_Node_GOT_Reloc.
+ * config/bfin-lex.l: Recognize GOT17M4 and FUNCDESC_GOT17M4.
+ * config/bfin-parse.y: Include "libbfd.h", "elf/common.h" and
+ "elf/bfin.h".
+ (GOT17M4, FUNCDESC_GOT17M4): New tokens of type <value>.
+ (any_gotrel): New rule.
+ (got): Use it, and create Expr_Node_GOT_Reloc nodes.
+ * config/tc-bfin.c: Include "libbfd.h", "elf/common.h" and
+ "elf/bfin.h".
+ (DEFAULT_FLAGS, bfin_flags, bfin_pic_flag): New.
+ (bfin_pic_ptr): New function.
+ (md_pseudo_table): Add it for ".picptr".
+ (OPTION_FDPIC): New macro.
+ (md_longopts): Add -mfdpic.
+ (md_parse_option): Handle it.
+ (md_begin): Set BFD flags.
+ (md_apply_fix3, bfin_fix_adjustable): Handle new relocs.
+ (bfin_gen_ldstidxi): Adjust to match the trees that the parser gives
+ us for GOT relocs.
+ * Makefile.am (bfin-parse.o): Update dependencies.
+ (DEPTC_bfin_elf): Likewise.
+ * Makefile.in: Regenerate.
+
2006-03-25 Richard Sandiford <richard@codesourcery.com>
* config/tc-m68k.c (m68k_cpus): Change cpu_cf5208 entries to use
Index: Makefile.am
===================================================================
RCS file: /cvs/src/src/gas/Makefile.am,v
retrieving revision 1.129
diff -c -p -r1.129 Makefile.am
*** Makefile.am 17 Feb 2006 14:36:23 -0000 1.129
--- Makefile.am 26 Mar 2006 01:09:23 -0000
*************** $(srcdir)/config/m68k-parse.h: ; @true
*** 613,619 ****
bfin-parse.c: $(srcdir)/config/bfin-parse.y
$(SHELL) $(YLWRAP) $(srcdir)/config/bfin-parse.y y.tab.c bfin-parse.c y.tab.h bfin-parse.h -- $(YACCCOMPILE) -d ;
bfin-parse.h: bfin-parse.c
! bfin-parse.o: bfin-parse.c bfin-parse.h $(srcdir)/config/bfin-defs.h
bfin-defs.h: ; @true
$(srcdir)/config/bfin-defs.h: ; @true
--- 613,620 ----
bfin-parse.c: $(srcdir)/config/bfin-parse.y
$(SHELL) $(YLWRAP) $(srcdir)/config/bfin-parse.y y.tab.c bfin-parse.c y.tab.h bfin-parse.h -- $(YACCCOMPILE) -d ;
bfin-parse.h: bfin-parse.c
! bfin-parse.o: bfin-parse.c bfin-parse.h $(srcdir)/config/bfin-defs.h \
! $(INCDIR)/elf/common.h $(INCDIR)/elf/bfin.h $(BFDDIR)/libbfd.h
bfin-defs.h: ; @true
$(srcdir)/config/bfin-defs.h: ; @true
*************** DEPTC_bfin_coff = $(INCDIR)/symcat.h $(s
*** 1021,1034 ****
$(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h struc-symbol.h \
$(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h dwarf2dbg.h \
! $(srcdir)/config/bfin-defs.h $(INCDIR)/obstack.h $(INCDIR)/safe-ctype.h \
! $(srcdir)/config/bfin-aux.h $(INCDIR)/opcode/bfin.h
DEPTC_bfin_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \
$(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-bfin.h \
dwarf2dbg.h struc-symbol.h $(srcdir)/config/bfin-defs.h \
$(INCDIR)/obstack.h $(INCDIR)/safe-ctype.h $(srcdir)/config/bfin-aux.h \
! $(INCDIR)/opcode/bfin.h
DEPTC_cris_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \
$(srcdir)/config/tc-cris.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \
$(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \
--- 1022,1038 ----
$(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h struc-symbol.h \
$(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h dwarf2dbg.h \
! $(INCDIR)/obstack.h $(INCDIR)/safe-ctype.h \
! $(srcdir)/config/bfin-aux.h $(INCDIR)/opcode/bfin.h \
! $(srcdir)/config/bfin-defs.h $(INCDIR)/elf/common.h \
! $(INCDIR)/elf/bfin.h $(BFDDIR)/libbfd.h
DEPTC_bfin_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \
$(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-bfin.h \
dwarf2dbg.h struc-symbol.h $(srcdir)/config/bfin-defs.h \
$(INCDIR)/obstack.h $(INCDIR)/safe-ctype.h $(srcdir)/config/bfin-aux.h \
! $(INCDIR)/opcode/bfin.h $(srcdir)/config/bfin-defs.h $(INCDIR)/elf/common.h \
! $(INCDIR)/elf/bfin.h $(BFDDIR)/libbfd.h
DEPTC_cris_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \
$(srcdir)/config/tc-cris.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \
$(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gas/Makefile.in,v
retrieving revision 1.140
diff -c -p -r1.140 Makefile.in
*** Makefile.in 17 Feb 2006 14:36:23 -0000 1.140
--- Makefile.in 26 Mar 2006 01:09:24 -0000
*************** DEPTC_bfin_coff = $(INCDIR)/symcat.h $(s
*** 802,816 ****
$(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h struc-symbol.h \
$(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h dwarf2dbg.h \
! $(srcdir)/config/bfin-defs.h $(INCDIR)/obstack.h $(INCDIR)/safe-ctype.h \
! $(srcdir)/config/bfin-aux.h $(INCDIR)/opcode/bfin.h
DEPTC_bfin_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \
$(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-bfin.h \
dwarf2dbg.h struc-symbol.h $(srcdir)/config/bfin-defs.h \
$(INCDIR)/obstack.h $(INCDIR)/safe-ctype.h $(srcdir)/config/bfin-aux.h \
! $(INCDIR)/opcode/bfin.h
DEPTC_cris_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \
$(srcdir)/config/tc-cris.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \
--- 802,819 ----
$(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h struc-symbol.h \
$(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h dwarf2dbg.h \
! $(INCDIR)/obstack.h $(INCDIR)/safe-ctype.h \
! $(srcdir)/config/bfin-aux.h $(INCDIR)/opcode/bfin.h \
! $(srcdir)/config/bfin-defs.h $(INCDIR)/elf/common.h \
! $(INCDIR)/elf/bfin.h $(BFDDIR)/libbfd.h
DEPTC_bfin_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \
$(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-bfin.h \
dwarf2dbg.h struc-symbol.h $(srcdir)/config/bfin-defs.h \
$(INCDIR)/obstack.h $(INCDIR)/safe-ctype.h $(srcdir)/config/bfin-aux.h \
! $(INCDIR)/opcode/bfin.h $(srcdir)/config/bfin-defs.h $(INCDIR)/elf/common.h \
! $(INCDIR)/elf/bfin.h $(BFDDIR)/libbfd.h
DEPTC_cris_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \
$(srcdir)/config/tc-cris.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \
*************** $(srcdir)/config/m68k-parse.h: ; @true
*** 2966,2972 ****
bfin-parse.c: $(srcdir)/config/bfin-parse.y
$(SHELL) $(YLWRAP) $(srcdir)/config/bfin-parse.y y.tab.c bfin-parse.c y.tab.h bfin-parse.h -- $(YACCCOMPILE) -d ;
bfin-parse.h: bfin-parse.c
! bfin-parse.o: bfin-parse.c bfin-parse.h $(srcdir)/config/bfin-defs.h
bfin-defs.h: ; @true
$(srcdir)/config/bfin-defs.h: ; @true
--- 2969,2976 ----
bfin-parse.c: $(srcdir)/config/bfin-parse.y
$(SHELL) $(YLWRAP) $(srcdir)/config/bfin-parse.y y.tab.c bfin-parse.c y.tab.h bfin-parse.h -- $(YACCCOMPILE) -d ;
bfin-parse.h: bfin-parse.c
! bfin-parse.o: bfin-parse.c bfin-parse.h $(srcdir)/config/bfin-defs.h \
! $(INCDIR)/elf/common.h $(INCDIR)/elf/bfin.h $(BFDDIR)/libbfd.h
bfin-defs.h: ; @true
$(srcdir)/config/bfin-defs.h: ; @true
Index: config/bfin-defs.h
===================================================================
RCS file: /cvs/src/src/gas/config/bfin-defs.h,v
retrieving revision 1.2
diff -c -p -r1.2 bfin-defs.h
*** config/bfin-defs.h 18 Nov 2005 14:21:29 -0000 1.2
--- config/bfin-defs.h 26 Mar 2006 01:09:29 -0000
*************** typedef enum
*** 263,268 ****
--- 263,269 ----
Expr_Node_Binop, /* Binary operator. */
Expr_Node_Unop, /* Unary operator. */
Expr_Node_Reloc, /* Symbol to be relocated. */
+ Expr_Node_GOT_Reloc, /* Symbol to be relocated using the GOT. */
Expr_Node_Constant /* Constant. */
} Expr_Node_Type;
Index: config/bfin-lex.l
===================================================================
RCS file: /cvs/src/src/gas/config/bfin-lex.l,v
retrieving revision 1.2
diff -c -p -r1.2 bfin-lex.l
*** config/bfin-lex.l 24 Oct 2005 16:31:22 -0000 1.2
--- config/bfin-lex.l 26 Mar 2006 01:09:29 -0000
*************** abort
*** 241,246 ****
--- 241,248 ----
[aA]0"."[wW] _REG.regno = REG_A0w; return REG;
[aA]0 _REG.regno = REG_A0; return REG_A_DOUBLE_ZERO;
[Gg][Oo][Tt] return GOT;
+ [Gg][Oo][Tt]"17"[Mm]"4" return GOT17M4;
+ [Ff][Uu][Nn][Cc][Dd][Ee][Ss][Cc]"_"[Gg][Oo][Tt]"17"[Mm]"4" return FUNCDESC_GOT17M4;
[Pp][Ll][Tt][Pp][Cc] return PLTPC;
Index: config/bfin-parse.y
===================================================================
RCS file: /cvs/src/src/gas/config/bfin-parse.y,v
retrieving revision 1.4
diff -c -p -r1.4 bfin-parse.y
*** config/bfin-parse.y 20 Jan 2006 17:22:50 -0000 1.4
--- config/bfin-parse.y 26 Mar 2006 01:09:30 -0000
***************
*** 21,30 ****
%{
#include <stdio.h>
- #include "bfin-aux.h"
#include <stdarg.h>
#include <obstack.h>
#define DSP32ALU(aopcde, HL, dst1, dst0, src0, src1, s, x, aop) \
bfin_gen_dsp32alu (HL, aopcde, aop, s, x, dst0, dst1, src0, src1)
--- 21,34 ----
%{
#include <stdio.h>
#include <stdarg.h>
#include <obstack.h>
+ #include "bfin-aux.h" // opcode generating auxiliaries
+ #include "libbfd.h"
+ #include "elf/common.h"
+ #include "elf/bfin.h"
+
#define DSP32ALU(aopcde, HL, dst1, dst0, src0, src1, s, x, aop) \
bfin_gen_dsp32alu (HL, aopcde, aop, s, x, dst0, dst1, src0, src1)
*************** is_group2 (INSTR_T x)
*** 485,491 ****
%token STATUS_REG
%token MNOP
%token SYMBOL NUMBER
! %token GOT AT PLTPC
/* Types. */
%type <instr> asm
--- 489,496 ----
%token STATUS_REG
%token MNOP
%token SYMBOL NUMBER
! %token GOT GOT17M4 FUNCDESC_GOT17M4
! %token AT PLTPC
/* Types. */
%type <instr> asm
*************** is_group2 (INSTR_T x)
*** 544,550 ****
%type <expr> got
%type <expr> got_or_expr
%type <expr> pltpc
!
/* Precedence rules. */
%left BAR
--- 549,555 ----
%type <expr> got
%type <expr> got_or_expr
%type <expr> pltpc
! %type <value> any_gotrel GOT GOT17M4 FUNCDESC_GOT17M4
/* Precedence rules. */
%left BAR
*************** symbol: SYMBOL
*** 4111,4119 ****
}
;
! got: symbol AT GOT
{
! $$ = $1;
}
;
--- 4116,4135 ----
}
;
! any_gotrel:
! GOT
! { $$ = BFD_RELOC_BFIN_GOT; }
! | GOT17M4
! { $$ = BFD_RELOC_BFIN_GOT17M4; }
! | FUNCDESC_GOT17M4
! { $$ = BFD_RELOC_BFIN_FUNCDESC_GOT17M4; }
! ;
!
! got: symbol AT any_gotrel
{
! Expr_Node_Value val;
! val.i_value = $3;
! $$ = Expr_Node_Create (Expr_Node_GOT_Reloc, val, $1, NULL);
}
;
Index: config/tc-bfin.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-bfin.c,v
retrieving revision 1.4
diff -c -p -r1.4 tc-bfin.c
*** config/tc-bfin.c 24 Oct 2005 18:35:59 -0000 1.4
--- config/tc-bfin.c 26 Mar 2006 01:09:31 -0000
***************
*** 28,33 ****
--- 28,36 ----
#ifdef OBJ_ELF
#include "dwarf2dbg.h"
#endif
+ #include "libbfd.h"
+ #include "elf/common.h"
+ #include "elf/bfin.h"
extern int yyparse (void);
struct yy_buffer_state;
*************** int last_insn_size;
*** 45,50 ****
--- 48,59 ----
extern struct obstack mempool;
FILE *errorf;
+ /* Flags to set in the elf header */
+ #define DEFAULT_FLAGS 0
+
+ static flagword bfin_flags = DEFAULT_FLAGS;
+ static const char *bfin_pic_flag = (const char *)0;
+
/* Registers list. */
struct bfin_reg_entry
{
*************** static const struct bfin_reg_entry bfin_
*** 202,212 ****
--- 211,283 ----
{0, 0}
};
+ /* Blackfin specific function to handle FD-PIC pointer initializations. */
+
+ static void
+ bfin_pic_ptr (int nbytes)
+ {
+ expressionS exp;
+ char *p;
+
+ if (nbytes != 4)
+ abort ();
+
+ #ifdef md_flush_pending_output
+ md_flush_pending_output ();
+ #endif
+
+ if (is_it_end_of_statement ())
+ {
+ demand_empty_rest_of_line ();
+ return;
+ }
+
+ #ifdef md_cons_align
+ md_cons_align (nbytes);
+ #endif
+
+ do
+ {
+ bfd_reloc_code_real_type reloc_type = BFD_RELOC_BFIN_FUNCDESC;
+
+ if (strncasecmp (input_line_pointer, "funcdesc(", 9) == 0)
+ {
+ input_line_pointer += 9;
+ expression (&exp);
+ if (*input_line_pointer == ')')
+ input_line_pointer++;
+ else
+ as_bad ("missing ')'");
+ }
+ else
+ error ("missing funcdesc in picptr");
+
+ p = frag_more (4);
+ memset (p, 0, 4);
+ fix_new_exp (frag_now, p - frag_now->fr_literal, 4, &exp, 0,
+ reloc_type);
+ }
+ while (*input_line_pointer++ == ',');
+
+ input_line_pointer--; /* Put terminator back into stream. */
+ demand_empty_rest_of_line ();
+ }
+
+ static void
+ bfin_s_bss (int ignore ATTRIBUTE_UNUSED)
+ {
+ register int temp;
+
+ temp = get_absolute_expression ();
+ subseg_set (bss_section, (subsegT) temp);
+ demand_empty_rest_of_line ();
+ }
const pseudo_typeS md_pseudo_table[] = {
{"align", s_align_bytes, 0},
{"byte2", cons, 2},
{"byte4", cons, 4},
+ {"picptr", bfin_pic_ptr, 4},
{"code", obj_elf_section, 0},
{"db", cons, 1},
{"dd", cons, 4},
*************** const pseudo_typeS md_pseudo_table[] = {
*** 218,234 ****
{0, 0, 0}
};
- static void
- bfin_s_bss (int ignore ATTRIBUTE_UNUSED)
- {
- register int temp;
-
- temp = get_absolute_expression ();
- subseg_set (bss_section, (subsegT) temp);
- demand_empty_rest_of_line ();
- }
-
-
/* Characters that are used to denote comments and line separators. */
const char comment_chars[] = "";
const char line_comment_chars[] = "#";
--- 289,294 ----
*************** const char FLT_CHARS[] = "fFdDxX";
*** 245,260 ****
/* Define bfin-specific command-line options (there are none). */
const char *md_shortopts = "";
! struct option md_longopts[] = {
! {NULL, no_argument, NULL, 0}
};
size_t md_longopts_size = sizeof (md_longopts);
int
md_parse_option (int c ATTRIBUTE_UNUSED, char *arg ATTRIBUTE_UNUSED)
{
! return 0;
}
void
--- 305,336 ----
/* Define bfin-specific command-line options (there are none). */
const char *md_shortopts = "";
! #define OPTION_FDPIC (OPTION_MD_BASE)
!
! struct option md_longopts[] =
! {
! { "mfdpic", no_argument, NULL, OPTION_FDPIC },
! { NULL, no_argument, NULL, 0 },
};
+
size_t md_longopts_size = sizeof (md_longopts);
int
md_parse_option (int c ATTRIBUTE_UNUSED, char *arg ATTRIBUTE_UNUSED)
{
! switch (c)
! {
! default:
! return 0;
!
! case OPTION_FDPIC:
! bfin_flags |= EF_BFIN_FDPIC;
! bfin_pic_flag = "-mfdpic";
! break;
! }
!
! return 1;
}
void
*************** md_show_usage (FILE * stream ATTRIBUTE_U
*** 267,272 ****
--- 343,352 ----
void
md_begin ()
{
+ /* Set the ELF flags if desired. */
+ if (bfin_flags)
+ bfd_set_private_flags (stdoutput, bfin_flags);
+
/* Set the default machine type. */
if (!bfd_set_arch_mach (stdoutput, bfd_arch_bfin, 0))
as_warn ("Could not set architecture and machine.");
*************** md_apply_fix (fixS *fixP, valueT *valueP
*** 476,481 ****
--- 556,563 ----
switch (fixP->fx_r_type)
{
case BFD_RELOC_BFIN_GOT:
+ case BFD_RELOC_BFIN_GOT17M4:
+ case BFD_RELOC_BFIN_FUNCDESC_GOT17M4:
fixP->fx_no_overflow = 1;
newval = md_chars_to_number (where, 2);
newval |= 0x0 & 0x7f;
*************** md_apply_fix (fixS *fixP, valueT *valueP
*** 579,584 ****
--- 661,667 ----
md_number_to_chars (where, value, 2);
break;
+ case BFD_RELOC_BFIN_FUNCDESC:
case BFD_RELOC_VTABLE_INHERIT:
case BFD_RELOC_VTABLE_ENTRY:
fixP->fx_done = FALSE;
*************** bfin_fix_adjustable (fixS *fixP)
*** 725,732 ****
switch (fixP->fx_r_type)
{
/* Adjust_reloc_syms doesn't know about the GOT. */
! case BFD_RELOC_BFIN_GOT :
! case BFD_RELOC_BFIN_PLTPC :
/* We need the symbol name for the VTABLE entries. */
case BFD_RELOC_VTABLE_INHERIT:
case BFD_RELOC_VTABLE_ENTRY:
--- 808,817 ----
switch (fixP->fx_r_type)
{
/* Adjust_reloc_syms doesn't know about the GOT. */
! case BFD_RELOC_BFIN_GOT:
! case BFD_RELOC_BFIN_GOT17M4:
! case BFD_RELOC_BFIN_FUNCDESC_GOT17M4:
! case BFD_RELOC_BFIN_PLTPC:
/* We need the symbol name for the VTABLE entries. */
case BFD_RELOC_VTABLE_INHERIT:
case BFD_RELOC_VTABLE_ENTRY:
*************** Expr_Node_Gen_Reloc (Expr_Node * head, i
*** 982,987 ****
--- 1067,1074 ----
break;
case BFD_RELOC_16:
case BFD_RELOC_BFIN_GOT:
+ case BFD_RELOC_BFIN_GOT17M4:
+ case BFD_RELOC_BFIN_FUNCDESC_GOT17M4:
note1 = conscode (gencode (value), NULL_CODE);
pcrel = 0;
break;
*************** bfin_gen_ldimmhalf (REG_T reg, int H, in
*** 1356,1363 ****
INSTR_T
bfin_gen_ldstidxi (REG_T ptr, REG_T reg, int W, int sz, int Z, Expr_Node * poffset)
{
- int offset;
- int value = 0;
INIT (LDSTidxI);
if (!IS_PREG (*ptr) || (!IS_DREG (*reg) && !Z))
--- 1443,1448 ----
*************** bfin_gen_ldstidxi (REG_T ptr, REG_T reg,
*** 1370,1413 ****
ASSIGN_R (reg);
ASSIGN (W);
ASSIGN (sz);
- switch (sz)
- {
- case 0:
- value = EXPR_VALUE (poffset) >> 2;
- break;
- case 1:
- value = EXPR_VALUE (poffset) >> 1;
- break;
- case 2:
- value = EXPR_VALUE (poffset);
- break;
- }
-
ASSIGN (Z);
! offset = (value & 0xffff);
! ASSIGN (offset);
! /* TODO : test if you need to check this here.
! The reloc case should automatically generate instruction
! if constant. */
! if(poffset->type != Expr_Node_Constant){
! /* A GOT relocation such as R0 = [P5 + symbol@GOT].
! Distinguish between R0 = [P5 + symbol@GOT] and
! P5 = [P5 + _current_shared_library_p5_offset_]. */
! if(!strcmp(poffset->value.s_value, "_current_shared_library_p5_offset_")){
! return conscode (gencode (HI (c_code.opcode)),
! Expr_Node_Gen_Reloc(poffset, BFD_RELOC_16));
}
! else
{
! return conscode (gencode (HI (c_code.opcode)),
! Expr_Node_Gen_Reloc(poffset, BFD_RELOC_BFIN_GOT));
}
- }
- else{
- return GEN_OPCODE32 ();
- }
}
--- 1455,1505 ----
ASSIGN_R (reg);
ASSIGN (W);
ASSIGN (sz);
ASSIGN (Z);
! if (poffset->type != Expr_Node_Constant)
! {
! /* a GOT relocation such as R0 = [P5 + symbol@GOT] */
! /* distinguish between R0 = [P5 + symbol@GOT] and
! P5 = [P5 + _current_shared_library_p5_offset_]
! */
! if (poffset->type == Expr_Node_Reloc
! && !strcmp (poffset->value.s_value,
! "_current_shared_library_p5_offset_"))
! {
! return conscode (gencode (HI (c_code.opcode)),
! Expr_Node_Gen_Reloc(poffset, BFD_RELOC_16));
! }
! else if (poffset->type != Expr_Node_GOT_Reloc)
! abort ();
!
! return conscode (gencode (HI (c_code.opcode)),
! Expr_Node_Gen_Reloc(poffset->Left_Child,
! poffset->value.i_value));
}
! else
{
! int value, offset;
! switch (sz)
! { // load/store access size
! case 0: // 32 bit
! value = EXPR_VALUE (poffset) >> 2;
! break;
! case 1: // 16 bit
! value = EXPR_VALUE (poffset) >> 1;
! break;
! case 2: // 8 bit
! value = EXPR_VALUE (poffset);
! break;
! default:
! abort ();
! }
!
! offset = (value & 0xffff);
! ASSIGN (offset);
! return GEN_OPCODE32 ();
}
}