* [PATCH] New port @GOTOFF, @GOT, @PLT relocation token for target m32r
@ 2004-06-22 12:11 Kazuhiro Inaoka
2004-06-25 4:26 ` Kazuhiro Inaoka
2005-07-29 9:19 ` Kazuhiro Inaoka
0 siblings, 2 replies; 7+ messages in thread
From: Kazuhiro Inaoka @ 2004-06-22 12:11 UTC (permalink / raw)
To: Nick Clifton; +Cc: binutils
[-- Attachment #1: Type: text/plain, Size: 1034 bytes --]
Hi Nick,
This is a patch to support R_M32R_GOTOFF relocation and new token
(@GOTOFF, @GOT, @PLT).
Please commit it.
Regards,
Kauhiro Inaoka
bfd/ChangeLog
2004-06-22 Kazuhiro Inaoka <inaoka dot kazuhiro at renesas dot com>
* elf32-m32r.c (m32r_elf_howto_table): Support R_M32R_GOTOFF.
(m32r_elf_relocate_section): Changed for R_M32R_GOTOFF.
(m32r_elf_gcsweep_hook): Ditto.
(m32r_elf_check_relocs): Ditto.
gas/ChangeLog
2004-06-22 Kazuhiro Inaoka <inaoka dot kazuhiro at renesas dot com>
* config/tc-m32r.c (md_convert_frag): Changed for @PLT.
(m32r_cgen_record_fixup_exp): Changed for @GOTOFF, @GOT.
(m32r_fix_adjustable): Changed for @GOTOFF, @GOT, @PLT.
(tc_gen_reloc): Ditto.
(m32r_end_of_match): Add for @GOTOFF, @GOT, @PLT.
(m32r_parse_name): Ditto.
(m32r_cgen_parse_fix_exp): Ditto.
* config/tc-m32r.h (md_parse_name): Define for @GOTOFF,
@GOT, @PLT.
(O_PIC_reloc): Ditto
(TC_CGEN_PARSE_FIX_EXP): Ditto.
* cgen.c (gas_cgen_parse_operand): Add TC_CGEN_PARSE_FIX_EXP
for @GOTOFF, @GOT, @PLT.
[-- Attachment #2: gotoff.patch --]
[-- Type: text/plain, Size: 12496 bytes --]
Index: bfd/elf32-m32r.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m32r.c,v
retrieving revision 1.44
diff -c -r1.44 elf32-m32r.c
*** bfd/elf32-m32r.c 27 Mar 2004 10:58:06 -0000 1.44
--- bfd/elf32-m32r.c 22 Jun 2004 11:32:26 -0000
***************
*** 685,692 ****
bfd_elf_generic_reloc, /* special_function */
"R_M32R_GOTOFF", /* name */
FALSE, /* partial_inplace */
! 0xffffffff, /* src_mask */
! 0xffffffff, /* dst_mask */
FALSE), /* pcrel_offset */
/* An PC Relative 24-bit relocation used when setting PIC offset
--- 685,692 ----
bfd_elf_generic_reloc, /* special_function */
"R_M32R_GOTOFF", /* name */
FALSE, /* partial_inplace */
! 0xffffff, /* src_mask */
! 0xffffff, /* dst_mask */
FALSE), /* pcrel_offset */
/* An PC Relative 24-bit relocation used when setting PIC offset
***************
*** 2787,2792 ****
--- 2787,2806 ----
switch ((int) r_type)
{
+ case R_M32R_GOTOFF:
+ /* Relocation is relative to the start of the global offset
+ table. (for ld24 rx,#uimm24)
+ ex) access at label+addend
+ ld24 rx.#label@GOTOFF + addend
+ sub rx,r12
+ */
+
+ BFD_ASSERT (sgot != NULL);
+
+ relocation = -(relocation - sgot->output_section->vma);
+ rel->r_addend = -rel->r_addend;
+ break;
+
case R_M32R_GOTPC24:
/* .got(_GLOBAL_OFFSET_TABLE_) - pc relocation
ld24 rx,#_GLOBAL_OFFSET_TABLE_
***************
*** 4314,4319 ****
--- 4328,4334 ----
case R_M32R_GOT16_HI_SLO:
case R_M32R_GOT16_LO:
case R_M32R_GOT24:
+ case R_M32R_GOTOFF:
case R_M32R_GOTPC_HI_ULO:
case R_M32R_GOTPC_HI_SLO:
case R_M32R_GOTPC_LO:
***************
*** 4443,4448 ****
--- 4458,4464 ----
case R_M32R_GOT16_HI_ULO:
case R_M32R_GOT16_HI_SLO:
case R_M32R_GOT16_LO:
+ case R_M32R_GOTOFF:
case R_M32R_GOTPC24:
case R_M32R_GOTPC_HI_ULO:
case R_M32R_GOTPC_HI_SLO:
Index: gas/cgen.c
===================================================================
RCS file: /cvs/src/src/gas/cgen.c,v
retrieving revision 1.23
diff -c -r1.23 cgen.c
*** gas/cgen.c 21 Nov 2003 01:52:16 -0000 1.23
--- gas/cgen.c 22 Jun 2004 11:32:27 -0000
***************
*** 355,360 ****
--- 355,364 ----
*strP = input_line_pointer;
input_line_pointer = hold;
+ #ifdef TC_CGEN_PARSE_FIX_EXP
+ opinfo = TC_CGEN_PARSE_FIX_EXP (opinfo, &exp);
+ #endif
+
/* FIXME: Need to check `want'. */
switch (exp.X_op)
Index: gas/config/tc-m32r.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-m32r.c,v
retrieving revision 1.36
diff -c -r1.36 tc-m32r.c
*** gas/config/tc-m32r.c 13 Apr 2004 16:47:57 -0000 1.36
--- gas/config/tc-m32r.c 22 Jun 2004 11:32:27 -0000
***************
*** 489,494 ****
--- 489,557 ----
{ NULL, NULL, 0 }
};
+ #define GOT_NAME "_GLOBAL_OFFSET_TABLE_"
+ symbolS *GOT_symbol;
+
+ static inline int
+ m32r_PIC_related_p (symbolS *sym)
+ {
+ expressionS *exp;
+
+ if (! sym)
+ return 0;
+
+ if (sym == GOT_symbol)
+ return 1;
+
+ exp = symbol_get_value_expression (sym);
+
+ return (exp->X_op == O_PIC_reloc
+ || exp->X_md == BFD_RELOC_M32R_26_PLTREL
+ || m32r_PIC_related_p (exp->X_add_symbol)
+ || m32r_PIC_related_p (exp->X_op_symbol));
+ }
+
+ static inline int
+ m32r_check_fixup (expressionS *main_exp, bfd_reloc_code_real_type *r_type_p)
+ {
+ expressionS *exp = main_exp;
+
+ if (exp->X_op == O_add && m32r_PIC_related_p (exp->X_op_symbol))
+ return 1;
+
+ if (exp->X_op == O_symbol && exp->X_add_symbol)
+ {
+ if (exp->X_add_symbol == GOT_symbol)
+ {
+ *r_type_p = BFD_RELOC_M32R_GOTPC24;
+ return 0;
+ }
+ }
+ else if (exp->X_op == O_add)
+ {
+ exp = symbol_get_value_expression (exp->X_add_symbol);
+ if (! exp)
+ return 0;
+ }
+
+ if (exp->X_op == O_PIC_reloc || exp->X_md != BFD_RELOC_UNUSED)
+ {
+ *r_type_p = exp->X_md;
+ if (exp == main_exp)
+ exp->X_op = O_symbol;
+ else
+ {
+ main_exp->X_add_symbol = exp->X_add_symbol;
+ main_exp->X_add_number += exp->X_add_number;
+ }
+ }
+ else
+ return (m32r_PIC_related_p (exp->X_add_symbol)
+ || m32r_PIC_related_p (exp->X_op_symbol));
+
+ return 0;
+ }
+
/* FIXME: Should be machine generated. */
#define NOP_INSN 0x7000
#define PAR_NOP_INSN 0xf000 /* Can only be used in 2nd slot. */
***************
*** 1888,1895 ****
--- 1951,1961 ----
|| S_IS_EXTERNAL (fragP->fr_symbol)
|| S_IS_WEAK (fragP->fr_symbol))
{
+ fixS *fixP;
assert (fragP->fr_subtype != 1);
assert (fragP->fr_cgen.insn != 0);
+
+ fixP =
gas_cgen_record_fixup (fragP,
/* Offset of branch insn in frag. */
fragP->fr_fix + extension - 4,
***************
*** 1905,1910 ****
--- 1971,1978 ----
#endif
fragP->fr_cgen.opinfo,
fragP->fr_symbol, fragP->fr_offset);
+ if (fragP->fr_cgen.opinfo)
+ fixP->fx_r_type = fragP->fr_cgen.opinfo;
}
#define SIZE_FROM_RELAX_STATE(n) ((n) == 1 ? 1 : 3)
***************
*** 2006,2013 ****
int opinfo;
expressionS *exp;
{
! fixS *fixP = gas_cgen_record_fixup_exp (frag, where, insn, length,
! operand, opinfo, exp);
switch (operand->type)
{
--- 2074,2087 ----
int opinfo;
expressionS *exp;
{
! fixS *fixP;
! bfd_reloc_code_real_type r_type = BFD_RELOC_UNUSED;
!
! if (m32r_check_fixup (exp, &r_type))
! as_bad (_("Invalid PIC expression."));
!
! fixP = gas_cgen_record_fixup_exp (frag, where, insn, length,
! operand, opinfo, exp);
switch (operand->type)
{
***************
*** 2022,2027 ****
--- 2096,2131 ----
break;
}
+ switch(r_type)
+ {
+ case BFD_RELOC_UNUSED:
+ default:
+ return fixP;
+ case BFD_RELOC_M32R_GOTPC24:
+ if (fixP->fx_cgen.opinfo == BFD_RELOC_M32R_HI16_SLO)
+ r_type = BFD_RELOC_M32R_GOTPC_HI_SLO;
+ else if (fixP->fx_cgen.opinfo == BFD_RELOC_M32R_HI16_ULO)
+ r_type = BFD_RELOC_M32R_GOTPC_HI_ULO;
+ else if (fixP->fx_cgen.opinfo == BFD_RELOC_M32R_LO16)
+ r_type = BFD_RELOC_M32R_GOTPC_LO;
+ break;
+ case BFD_RELOC_M32R_GOT24:
+ if (fixP->fx_cgen.opinfo == BFD_RELOC_M32R_HI16_SLO)
+ r_type = BFD_RELOC_M32R_GOT16_HI_SLO;
+ else if (fixP->fx_cgen.opinfo == BFD_RELOC_M32R_HI16_ULO)
+ r_type = BFD_RELOC_M32R_GOT16_HI_ULO;
+ else if (fixP->fx_cgen.opinfo == BFD_RELOC_M32R_LO16)
+ r_type = BFD_RELOC_M32R_GOT16_LO;
+ break;
+ case BFD_RELOC_M32R_GOTOFF:
+ break;
+ case BFD_RELOC_M32R_26_PLTREL:
+ as_bad (_("Invalid PIC expression."));
+ break;
+ }
+
+ fixP->fx_r_type = r_type;
+
return fixP;
}
***************
*** 2261,2266 ****
--- 2365,2380 ----
|| reloc_type == BFD_RELOC_M32R_LO16))
return 0;
+ if (reloc_type == BFD_RELOC_M32R_GOT24
+ || reloc_type == BFD_RELOC_M32R_26_PLTREL
+ || reloc_type == BFD_RELOC_M32R_GOTPC_HI_SLO
+ || reloc_type == BFD_RELOC_M32R_GOTPC_HI_ULO
+ || reloc_type == BFD_RELOC_M32R_GOTPC_LO
+ || reloc_type == BFD_RELOC_M32R_GOT16_HI_SLO
+ || reloc_type == BFD_RELOC_M32R_GOT16_HI_ULO
+ || reloc_type == BFD_RELOC_M32R_GOT16_LO)
+ return 0;
+
/* We need the symbol name for the VTABLE entries. */
if (reloc_type == BFD_RELOC_VTABLE_INHERIT
|| reloc_type == BFD_RELOC_VTABLE_ENTRY)
***************
*** 2277,2284 ****
elf_elfheader (stdoutput)->e_flags |= m32r_flags;
}
- #define GOT_NAME "_GLOBAL_OFFSET_TABLE_"
-
/* Translate internal representation of relocation info to BFD target
format. */
arelent *
--- 2391,2396 ----
***************
*** 2358,2364 ****
if ( fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY
|| fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT)
reloc->addend = fixP->fx_offset;
! else if (!pic_code
&& fixP->fx_pcrel
&& fixP->fx_addsy != NULL
&& (S_GET_SEGMENT(fixP->fx_addsy) != section)
--- 2470,2477 ----
if ( fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY
|| fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT)
reloc->addend = fixP->fx_offset;
! else if ((!pic_code
! && code != BFD_RELOC_M32R_26_PLTREL)
&& fixP->fx_pcrel
&& fixP->fx_addsy != NULL
&& (S_GET_SEGMENT(fixP->fx_addsy) != section)
***************
*** 2372,2374 ****
--- 2485,2589 ----
return reloc;
}
+
+ inline static char *
+ m32r_end_of_match (char *cont, char *what)
+ {
+ int len = strlen (what);
+
+ if (strncasecmp (cont, what, strlen (what)) == 0
+ && ! is_part_of_name (cont[len]))
+ return cont + len;
+
+ return NULL;
+ }
+
+ int
+ m32r_parse_name (char const *name, expressionS *exprP, char *nextcharP)
+ {
+ char *next = input_line_pointer;
+ char *next_end;
+ int reloc_type;
+ operatorT op_type;
+ segT segment;
+
+ exprP->X_op_symbol = NULL;
+ exprP->X_md = BFD_RELOC_UNUSED;
+
+ if (strcmp (name, GOT_NAME) == 0)
+ {
+ if (! GOT_symbol)
+ GOT_symbol = symbol_find_or_make (name);
+
+ exprP->X_add_symbol = GOT_symbol;
+ no_suffix:
+ /* If we have an absolute symbol or a reg, then we know its
+ value now. */
+ segment = S_GET_SEGMENT (exprP->X_add_symbol);
+ if (segment == absolute_section)
+ {
+ exprP->X_op = O_constant;
+ exprP->X_add_number = S_GET_VALUE (exprP->X_add_symbol);
+ exprP->X_add_symbol = NULL;
+ }
+ else if (segment == reg_section)
+ {
+ exprP->X_op = O_register;
+ exprP->X_add_number = S_GET_VALUE (exprP->X_add_symbol);
+ exprP->X_add_symbol = NULL;
+ }
+ else
+ {
+ exprP->X_op = O_symbol;
+ exprP->X_add_number = 0;
+ }
+
+ return 1;
+ }
+
+ exprP->X_add_symbol = symbol_find_or_make (name);
+
+ if (*nextcharP != '@')
+ goto no_suffix;
+ else if ((next_end = m32r_end_of_match (next + 1, "GOTOFF")))
+ {
+ reloc_type = BFD_RELOC_M32R_GOTOFF;
+ op_type = O_PIC_reloc;
+ }
+ else if ((next_end = m32r_end_of_match (next + 1, "GOT")))
+ {
+ reloc_type = BFD_RELOC_M32R_GOT24;
+ op_type = O_PIC_reloc;
+ }
+ else if ((next_end = m32r_end_of_match (next + 1, "PLT")))
+ {
+ reloc_type = BFD_RELOC_M32R_26_PLTREL;
+ op_type = O_PIC_reloc;
+ }
+ else
+ goto no_suffix;
+
+ *input_line_pointer = *nextcharP;
+ input_line_pointer = next_end;
+ *nextcharP = *input_line_pointer;
+ *input_line_pointer = '\0';
+
+ exprP->X_op = op_type;
+ exprP->X_add_number = 0;
+ exprP->X_md = reloc_type;
+
+ return 1;
+ }
+
+ int
+ m32r_cgen_parse_fix_exp(int opinfo, expressionS *exp)
+ {
+ if (exp->X_op == O_PIC_reloc
+ && exp->X_md == BFD_RELOC_M32R_26_PLTREL)
+ {
+ exp->X_op = O_symbol;
+ opinfo = exp->X_md;
+ }
+
+ return opinfo;
+ }
Index: gas/config/tc-m32r.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-m32r.h,v
retrieving revision 1.11
diff -c -r1.11 tc-m32r.h
*** gas/config/tc-m32r.h 19 Dec 2003 11:43:37 -0000 1.11
--- gas/config/tc-m32r.h 22 Jun 2004 11:32:27 -0000
***************
*** 131,133 ****
--- 131,145 ----
#define elf_tc_final_processing m32r_elf_final_processing
extern void m32r_elf_final_processing PARAMS ((void));
+
+ #define md_parse_name(name, exprP, nextcharP) \
+ m32r_parse_name ((name), (exprP), (nextcharP))
+ int m32r_parse_name (char const *name, expressionS *exprP, char *nextchar);
+
+ /* This is used to construct expressions out of @GOTOFF, @PLT and @GOT
+ symbols. The relocation type is stored in X_md. */
+ #define O_PIC_reloc O_md1
+
+ #define TC_CGEN_PARSE_FIX_EXP(opinfo, exp) \
+ m32r_cgen_parse_fix_exp(opinfo, exp)
+ int m32r_cgen_parse_fix_exp(int opinfo, expressionS *exp);
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] New port @GOTOFF, @GOT, @PLT relocation token for target m32r
2004-06-22 12:11 [PATCH] New port @GOTOFF, @GOT, @PLT relocation token for target m32r Kazuhiro Inaoka
@ 2004-06-25 4:26 ` Kazuhiro Inaoka
2004-06-25 16:10 ` Nick Clifton
2005-07-29 9:19 ` Kazuhiro Inaoka
1 sibling, 1 reply; 7+ messages in thread
From: Kazuhiro Inaoka @ 2004-06-25 4:26 UTC (permalink / raw)
To: Nick Clifton; +Cc: binutils
[-- Attachment #1: Type: text/plain, Size: 1494 bytes --]
Hi Nick,
Excuse me, The following patch was not enough to support GOTOFF relocation.
http://sources.redhat.com/ml/binutils/2004-06/msg00397.html
This patch is to support GOTOFF relocation.
Please apply it.
Regards,
Kazuhiro Inaoka
include/ChangeLog
2004-06-25 Kazuhiro Inaoka <inaoka dot kazuhiro at renesas dot com>
* elf/m32r.h: Add
R_M32R_GOTOFF_HI_ULO, R_M32R_GOTOFF_HI_SLO, R_M32R_GOTOFF_LO
bfd/ChangeLog
2004-06-25 Kazuhiro Inaoka <inaoka dot kazuhiro at renesas dot com>
* elf32-m32r.c (m32r_elf_howto_table): Support R_M32R_GOTOFF.
(m32r_elf_relocate_section): Changed for R_M32R_GOTOFF.
(m32r_elf_gcsweep_hook): Ditto.
(m32r_elf_check_relocs): Ditto.
(m32r_elf_howto_table): Added
R_M32R_GOTOFF_HI_ULO, R_M32R_GOTOFF_HI_SLO, R_M32R_GOTOFF_LO
* reloc.c: Added
BFD_RELOC_M32R_GOTOFF_HI_ULO, BFD_RELOC_M32R_GOTOFF_HI_SLO,
BFD_RELOC_M32R_GOTOFF_LO
gas/ChangeLog
2004-06-25 Kazuhiro Inaoka <inaoka dot kazuhiro at renesas dot com>
* config/tc-m32r.c (md_convert_frag): Changed for @PLT.
(m32r_cgen_record_fixup_exp): Changed for @GOTOFF, @GOT.
(m32r_fix_adjustable): Changed for @GOTOFF, @GOT, @PLT.
(tc_gen_reloc): Ditto.
(m32r_end_of_match): Add for @GOTOFF, @GOT, @PLT.
(m32r_parse_name): Ditto.
(m32r_cgen_parse_fix_exp): Ditto.
* config/tc-m32r.h (md_parse_name): Define for @GOTOFF, @GOT, @PLT.
(O_PIC_reloc): Ditto
(TC_CGEN_PARSE_FIX_EXP): Ditto.
* cgen.c (gas_cgen_parse_operand): Add TC_CGEN_PARSE_FIX_EXP
for @GOTOFF, @GOT, @PLT.
[-- Attachment #2: gotoff2.patch --]
[-- Type: text/plain, Size: 17306 bytes --]
Index: bfd/elf32-m32r.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m32r.c,v
retrieving revision 1.45
diff -c -r1.45 elf32-m32r.c
*** bfd/elf32-m32r.c 24 Jun 2004 04:46:19 -0000 1.45
--- bfd/elf32-m32r.c 25 Jun 2004 04:11:34 -0000
***************
*** 678,692 ****
HOWTO (R_M32R_GOTOFF, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
! 32, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_M32R_GOTOFF", /* name */
FALSE, /* partial_inplace */
! 0xffffffff, /* src_mask */
! 0xffffffff, /* dst_mask */
FALSE), /* pcrel_offset */
/* An PC Relative 24-bit relocation used when setting PIC offset
--- 678,692 ----
HOWTO (R_M32R_GOTOFF, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
! 24, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_M32R_GOTOFF", /* name */
FALSE, /* partial_inplace */
! 0xffffff, /* src_mask */
! 0xffffff, /* dst_mask */
FALSE), /* pcrel_offset */
/* An PC Relative 24-bit relocation used when setting PIC offset
***************
*** 803,808 ****
--- 803,850 ----
0x0000ffff, /* src_mask */
0x0000ffff, /* dst_mask */
TRUE), /* pcrel_offset */
+
+ HOWTO (R_M32R_GOTOFF_HI_ULO, /* type */
+ 16, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_M32R_GOTOFF_HI_ULO",/* name */
+ FALSE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_M32R_GOTOFF_HI_SLO, /* type */
+ 16, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_M32R_GOTOFF_HI_SLO",/* name */
+ FALSE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_M32R_GOTOFF_LO, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_M32R_GOTOFF_LO", /* name */
+ FALSE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
};
\f
/* Handle the R_M32R_10_PCREL reloc. */
***************
*** 1269,1274 ****
--- 1311,1319 ----
{ BFD_RELOC_M32R_GOTPC_HI_ULO, R_M32R_GOTPC_HI_ULO },
{ BFD_RELOC_M32R_GOTPC_HI_SLO, R_M32R_GOTPC_HI_SLO },
{ BFD_RELOC_M32R_GOTPC_LO, R_M32R_GOTPC_LO },
+ { BFD_RELOC_M32R_GOTOFF_HI_ULO, R_M32R_GOTOFF_HI_ULO },
+ { BFD_RELOC_M32R_GOTOFF_HI_SLO, R_M32R_GOTOFF_HI_SLO },
+ { BFD_RELOC_M32R_GOTOFF_LO, R_M32R_GOTOFF_LO },
};
static reloc_howto_type *
***************
*** 2796,2801 ****
--- 2841,2875 ----
switch ((int) r_type)
{
+ case R_M32R_GOTOFF:
+ /* Relocation is relative to the start of the global offset
+ table. (for ld24 rx,#uimm24)
+ ex) access at label+addend
+ ld24 rx.#label@GOTOFF + addend
+ sub rx,r12
+ */
+
+ BFD_ASSERT (sgot != NULL);
+
+ relocation = -(relocation - sgot->output_section->vma);
+ rel->r_addend = -rel->r_addend;
+ break;
+
+ case R_M32R_GOTOFF_HI_ULO:
+ case R_M32R_GOTOFF_HI_SLO:
+ case R_M32R_GOTOFF_LO:
+ {
+ BFD_ASSERT (sgot != NULL);
+
+ relocation -= sgot->output_section->vma;
+
+ if ((r_type == R_M32R_GOTOFF_HI_SLO)
+ && ((relocation + rel->r_addend) & 0x8000))
+ rel->r_addend += 0x10000;
+
+ break;
+ }
+
case R_M32R_GOTPC24:
/* .got(_GLOBAL_OFFSET_TABLE_) - pc relocation
ld24 rx,#_GLOBAL_OFFSET_TABLE_
***************
*** 4307,4312 ****
--- 4381,4390 ----
case R_M32R_GOT16_HI_SLO:
case R_M32R_GOT16_LO:
case R_M32R_GOT24:
+ case R_M32R_GOTOFF:
+ case R_M32R_GOTOFF_HI_ULO:
+ case R_M32R_GOTOFF_HI_SLO:
+ case R_M32R_GOTOFF_LO:
case R_M32R_GOTPC_HI_ULO:
case R_M32R_GOTPC_HI_SLO:
case R_M32R_GOTPC_LO:
***************
*** 4436,4441 ****
--- 4514,4523 ----
case R_M32R_GOT16_HI_ULO:
case R_M32R_GOT16_HI_SLO:
case R_M32R_GOT16_LO:
+ case R_M32R_GOTOFF:
+ case R_M32R_GOTOFF_HI_ULO:
+ case R_M32R_GOTOFF_HI_SLO:
+ case R_M32R_GOTOFF_LO:
case R_M32R_GOTPC24:
case R_M32R_GOTPC_HI_ULO:
case R_M32R_GOTPC_HI_SLO:
Index: bfd/reloc.c
===================================================================
RCS file: /cvs/src/src/bfd/reloc.c,v
retrieving revision 1.104
diff -c -r1.104 reloc.c
*** bfd/reloc.c 24 Jun 2004 04:46:26 -0000 1.104
--- bfd/reloc.c 25 Jun 2004 04:11:34 -0000
***************
*** 2955,2960 ****
--- 2955,2966 ----
ENUMX
BFD_RELOC_M32R_GOTOFF
ENUMX
+ BFD_RELOC_M32R_GOTOFF_HI_ULO
+ ENUMX
+ BFD_RELOC_M32R_GOTOFF_HI_SLO
+ ENUMX
+ BFD_RELOC_M32R_GOTOFF_LO
+ ENUMX
BFD_RELOC_M32R_GOTPC24
ENUMX
BFD_RELOC_M32R_GOT16_HI_ULO
Index: gas/cgen.c
===================================================================
RCS file: /cvs/src/src/gas/cgen.c,v
retrieving revision 1.23
diff -c -r1.23 cgen.c
*** gas/cgen.c 21 Nov 2003 01:52:16 -0000 1.23
--- gas/cgen.c 25 Jun 2004 04:11:35 -0000
***************
*** 355,360 ****
--- 355,364 ----
*strP = input_line_pointer;
input_line_pointer = hold;
+ #ifdef TC_CGEN_PARSE_FIX_EXP
+ opinfo = TC_CGEN_PARSE_FIX_EXP (opinfo, &exp);
+ #endif
+
/* FIXME: Need to check `want'. */
switch (exp.X_op)
Index: gas/config/tc-m32r.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-m32r.c,v
retrieving revision 1.36
diff -c -r1.36 tc-m32r.c
*** gas/config/tc-m32r.c 13 Apr 2004 16:47:57 -0000 1.36
--- gas/config/tc-m32r.c 25 Jun 2004 04:11:35 -0000
***************
*** 489,494 ****
--- 489,557 ----
{ NULL, NULL, 0 }
};
+ #define GOT_NAME "_GLOBAL_OFFSET_TABLE_"
+ symbolS *GOT_symbol;
+
+ static inline int
+ m32r_PIC_related_p (symbolS *sym)
+ {
+ expressionS *exp;
+
+ if (! sym)
+ return 0;
+
+ if (sym == GOT_symbol)
+ return 1;
+
+ exp = symbol_get_value_expression (sym);
+
+ return (exp->X_op == O_PIC_reloc
+ || exp->X_md == BFD_RELOC_M32R_26_PLTREL
+ || m32r_PIC_related_p (exp->X_add_symbol)
+ || m32r_PIC_related_p (exp->X_op_symbol));
+ }
+
+ static inline int
+ m32r_check_fixup (expressionS *main_exp, bfd_reloc_code_real_type *r_type_p)
+ {
+ expressionS *exp = main_exp;
+
+ if (exp->X_op == O_add && m32r_PIC_related_p (exp->X_op_symbol))
+ return 1;
+
+ if (exp->X_op == O_symbol && exp->X_add_symbol)
+ {
+ if (exp->X_add_symbol == GOT_symbol)
+ {
+ *r_type_p = BFD_RELOC_M32R_GOTPC24;
+ return 0;
+ }
+ }
+ else if (exp->X_op == O_add)
+ {
+ exp = symbol_get_value_expression (exp->X_add_symbol);
+ if (! exp)
+ return 0;
+ }
+
+ if (exp->X_op == O_PIC_reloc || exp->X_md != BFD_RELOC_UNUSED)
+ {
+ *r_type_p = exp->X_md;
+ if (exp == main_exp)
+ exp->X_op = O_symbol;
+ else
+ {
+ main_exp->X_add_symbol = exp->X_add_symbol;
+ main_exp->X_add_number += exp->X_add_number;
+ }
+ }
+ else
+ return (m32r_PIC_related_p (exp->X_add_symbol)
+ || m32r_PIC_related_p (exp->X_op_symbol));
+
+ return 0;
+ }
+
/* FIXME: Should be machine generated. */
#define NOP_INSN 0x7000
#define PAR_NOP_INSN 0xf000 /* Can only be used in 2nd slot. */
***************
*** 1888,1895 ****
--- 1951,1961 ----
|| S_IS_EXTERNAL (fragP->fr_symbol)
|| S_IS_WEAK (fragP->fr_symbol))
{
+ fixS *fixP;
assert (fragP->fr_subtype != 1);
assert (fragP->fr_cgen.insn != 0);
+
+ fixP =
gas_cgen_record_fixup (fragP,
/* Offset of branch insn in frag. */
fragP->fr_fix + extension - 4,
***************
*** 1905,1910 ****
--- 1971,1978 ----
#endif
fragP->fr_cgen.opinfo,
fragP->fr_symbol, fragP->fr_offset);
+ if (fragP->fr_cgen.opinfo)
+ fixP->fx_r_type = fragP->fr_cgen.opinfo;
}
#define SIZE_FROM_RELAX_STATE(n) ((n) == 1 ? 1 : 3)
***************
*** 2006,2013 ****
int opinfo;
expressionS *exp;
{
! fixS *fixP = gas_cgen_record_fixup_exp (frag, where, insn, length,
! operand, opinfo, exp);
switch (operand->type)
{
--- 2074,2087 ----
int opinfo;
expressionS *exp;
{
! fixS *fixP;
! bfd_reloc_code_real_type r_type = BFD_RELOC_UNUSED;
!
! if (m32r_check_fixup (exp, &r_type))
! as_bad (_("Invalid PIC expression."));
!
! fixP = gas_cgen_record_fixup_exp (frag, where, insn, length,
! operand, opinfo, exp);
switch (operand->type)
{
***************
*** 2022,2027 ****
--- 2096,2137 ----
break;
}
+ switch(r_type)
+ {
+ case BFD_RELOC_UNUSED:
+ default:
+ return fixP;
+ case BFD_RELOC_M32R_GOTPC24:
+ if (fixP->fx_cgen.opinfo == BFD_RELOC_M32R_HI16_SLO)
+ r_type = BFD_RELOC_M32R_GOTPC_HI_SLO;
+ else if (fixP->fx_cgen.opinfo == BFD_RELOC_M32R_HI16_ULO)
+ r_type = BFD_RELOC_M32R_GOTPC_HI_ULO;
+ else if (fixP->fx_cgen.opinfo == BFD_RELOC_M32R_LO16)
+ r_type = BFD_RELOC_M32R_GOTPC_LO;
+ break;
+ case BFD_RELOC_M32R_GOT24:
+ if (fixP->fx_cgen.opinfo == BFD_RELOC_M32R_HI16_SLO)
+ r_type = BFD_RELOC_M32R_GOT16_HI_SLO;
+ else if (fixP->fx_cgen.opinfo == BFD_RELOC_M32R_HI16_ULO)
+ r_type = BFD_RELOC_M32R_GOT16_HI_ULO;
+ else if (fixP->fx_cgen.opinfo == BFD_RELOC_M32R_LO16)
+ r_type = BFD_RELOC_M32R_GOT16_LO;
+ break;
+ case BFD_RELOC_M32R_GOTOFF:
+ if (fixP->fx_cgen.opinfo == BFD_RELOC_M32R_HI16_SLO)
+ r_type = BFD_RELOC_M32R_GOTOFF_HI_SLO;
+ else if (fixP->fx_cgen.opinfo == BFD_RELOC_M32R_HI16_ULO)
+ r_type = BFD_RELOC_M32R_GOTOFF_HI_ULO;
+ else if (fixP->fx_cgen.opinfo == BFD_RELOC_M32R_LO16)
+ r_type = BFD_RELOC_M32R_GOTOFF_LO;
+ break;
+ case BFD_RELOC_M32R_26_PLTREL:
+ as_bad (_("Invalid PIC expression."));
+ break;
+ }
+
+ fixP->fx_r_type = r_type;
+
return fixP;
}
***************
*** 2261,2266 ****
--- 2371,2386 ----
|| reloc_type == BFD_RELOC_M32R_LO16))
return 0;
+ if (reloc_type == BFD_RELOC_M32R_GOT24
+ || reloc_type == BFD_RELOC_M32R_26_PLTREL
+ || reloc_type == BFD_RELOC_M32R_GOTPC_HI_SLO
+ || reloc_type == BFD_RELOC_M32R_GOTPC_HI_ULO
+ || reloc_type == BFD_RELOC_M32R_GOTPC_LO
+ || reloc_type == BFD_RELOC_M32R_GOT16_HI_SLO
+ || reloc_type == BFD_RELOC_M32R_GOT16_HI_ULO
+ || reloc_type == BFD_RELOC_M32R_GOT16_LO)
+ return 0;
+
/* We need the symbol name for the VTABLE entries. */
if (reloc_type == BFD_RELOC_VTABLE_INHERIT
|| reloc_type == BFD_RELOC_VTABLE_ENTRY)
***************
*** 2277,2284 ****
elf_elfheader (stdoutput)->e_flags |= m32r_flags;
}
- #define GOT_NAME "_GLOBAL_OFFSET_TABLE_"
-
/* Translate internal representation of relocation info to BFD target
format. */
arelent *
--- 2397,2402 ----
***************
*** 2358,2364 ****
if ( fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY
|| fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT)
reloc->addend = fixP->fx_offset;
! else if (!pic_code
&& fixP->fx_pcrel
&& fixP->fx_addsy != NULL
&& (S_GET_SEGMENT(fixP->fx_addsy) != section)
--- 2476,2483 ----
if ( fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY
|| fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT)
reloc->addend = fixP->fx_offset;
! else if ((!pic_code
! && code != BFD_RELOC_M32R_26_PLTREL)
&& fixP->fx_pcrel
&& fixP->fx_addsy != NULL
&& (S_GET_SEGMENT(fixP->fx_addsy) != section)
***************
*** 2372,2374 ****
--- 2491,2595 ----
return reloc;
}
+
+ inline static char *
+ m32r_end_of_match (char *cont, char *what)
+ {
+ int len = strlen (what);
+
+ if (strncasecmp (cont, what, strlen (what)) == 0
+ && ! is_part_of_name (cont[len]))
+ return cont + len;
+
+ return NULL;
+ }
+
+ int
+ m32r_parse_name (char const *name, expressionS *exprP, char *nextcharP)
+ {
+ char *next = input_line_pointer;
+ char *next_end;
+ int reloc_type;
+ operatorT op_type;
+ segT segment;
+
+ exprP->X_op_symbol = NULL;
+ exprP->X_md = BFD_RELOC_UNUSED;
+
+ if (strcmp (name, GOT_NAME) == 0)
+ {
+ if (! GOT_symbol)
+ GOT_symbol = symbol_find_or_make (name);
+
+ exprP->X_add_symbol = GOT_symbol;
+ no_suffix:
+ /* If we have an absolute symbol or a reg, then we know its
+ value now. */
+ segment = S_GET_SEGMENT (exprP->X_add_symbol);
+ if (segment == absolute_section)
+ {
+ exprP->X_op = O_constant;
+ exprP->X_add_number = S_GET_VALUE (exprP->X_add_symbol);
+ exprP->X_add_symbol = NULL;
+ }
+ else if (segment == reg_section)
+ {
+ exprP->X_op = O_register;
+ exprP->X_add_number = S_GET_VALUE (exprP->X_add_symbol);
+ exprP->X_add_symbol = NULL;
+ }
+ else
+ {
+ exprP->X_op = O_symbol;
+ exprP->X_add_number = 0;
+ }
+
+ return 1;
+ }
+
+ exprP->X_add_symbol = symbol_find_or_make (name);
+
+ if (*nextcharP != '@')
+ goto no_suffix;
+ else if ((next_end = m32r_end_of_match (next + 1, "GOTOFF")))
+ {
+ reloc_type = BFD_RELOC_M32R_GOTOFF;
+ op_type = O_PIC_reloc;
+ }
+ else if ((next_end = m32r_end_of_match (next + 1, "GOT")))
+ {
+ reloc_type = BFD_RELOC_M32R_GOT24;
+ op_type = O_PIC_reloc;
+ }
+ else if ((next_end = m32r_end_of_match (next + 1, "PLT")))
+ {
+ reloc_type = BFD_RELOC_M32R_26_PLTREL;
+ op_type = O_PIC_reloc;
+ }
+ else
+ goto no_suffix;
+
+ *input_line_pointer = *nextcharP;
+ input_line_pointer = next_end;
+ *nextcharP = *input_line_pointer;
+ *input_line_pointer = '\0';
+
+ exprP->X_op = op_type;
+ exprP->X_add_number = 0;
+ exprP->X_md = reloc_type;
+
+ return 1;
+ }
+
+ int
+ m32r_cgen_parse_fix_exp(int opinfo, expressionS *exp)
+ {
+ if (exp->X_op == O_PIC_reloc
+ && exp->X_md == BFD_RELOC_M32R_26_PLTREL)
+ {
+ exp->X_op = O_symbol;
+ opinfo = exp->X_md;
+ }
+
+ return opinfo;
+ }
Index: gas/config/tc-m32r.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-m32r.h,v
retrieving revision 1.11
diff -c -r1.11 tc-m32r.h
*** gas/config/tc-m32r.h 19 Dec 2003 11:43:37 -0000 1.11
--- gas/config/tc-m32r.h 25 Jun 2004 04:11:35 -0000
***************
*** 131,133 ****
--- 131,145 ----
#define elf_tc_final_processing m32r_elf_final_processing
extern void m32r_elf_final_processing PARAMS ((void));
+
+ #define md_parse_name(name, exprP, nextcharP) \
+ m32r_parse_name ((name), (exprP), (nextcharP))
+ int m32r_parse_name (char const *name, expressionS *exprP, char *nextchar);
+
+ /* This is used to construct expressions out of @GOTOFF, @PLT and @GOT
+ symbols. The relocation type is stored in X_md. */
+ #define O_PIC_reloc O_md1
+
+ #define TC_CGEN_PARSE_FIX_EXP(opinfo, exp) \
+ m32r_cgen_parse_fix_exp(opinfo, exp)
+ int m32r_cgen_parse_fix_exp(int opinfo, expressionS *exp);
Index: include/elf/m32r.h
===================================================================
RCS file: /cvs/src/src/include/elf/m32r.h,v
retrieving revision 1.7
diff -c -r1.7 m32r.h
*** include/elf/m32r.h 19 Dec 2003 11:44:00 -0000 1.7
--- include/elf/m32r.h 25 Jun 2004 04:11:36 -0000
***************
*** 67,72 ****
--- 67,75 ----
RELOC_NUMBER (R_M32R_GOTPC_HI_ULO, 59)
RELOC_NUMBER (R_M32R_GOTPC_HI_SLO, 60)
RELOC_NUMBER (R_M32R_GOTPC_LO, 61)
+ RELOC_NUMBER (R_M32R_GOTOFF_HI_ULO, 62)
+ RELOC_NUMBER (R_M32R_GOTOFF_HI_SLO, 63)
+ RELOC_NUMBER (R_M32R_GOTOFF_LO, 64)
END_RELOC_NUMBERS (R_M32R_max)
/* Processor specific section indices. These sections do not actually
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] New port @GOTOFF, @GOT, @PLT relocation token for target m32r
2004-06-25 4:26 ` Kazuhiro Inaoka
@ 2004-06-25 16:10 ` Nick Clifton
2004-06-28 8:38 ` Kazuhiro Inaoka
0 siblings, 1 reply; 7+ messages in thread
From: Nick Clifton @ 2004-06-25 16:10 UTC (permalink / raw)
To: Kazuhiro Inaoka; +Cc: binutils
Hi Kazuhiro,
> include/elf/ChangeLog
> 2004-06-25 Kazuhiro Inaoka <inaoka dot kazuhiro at renesas dot com>
>
> * m32r.h: Add
> R_M32R_GOTOFF_HI_ULO, R_M32R_GOTOFF_HI_SLO, R_M32R_GOTOFF_LO
>
> bfd/ChangeLog
> 2004-06-25 Kazuhiro Inaoka <inaoka dot kazuhiro at renesas dot com>
>
> * elf32-m32r.c (m32r_elf_howto_table): Support R_M32R_GOTOFF.
> (m32r_elf_relocate_section): Changed for R_M32R_GOTOFF.
> (m32r_elf_gcsweep_hook): Ditto.
> (m32r_elf_check_relocs): Ditto.
> (m32r_elf_howto_table): Added
> R_M32R_GOTOFF_HI_ULO, R_M32R_GOTOFF_HI_SLO, R_M32R_GOTOFF_LO
> * reloc.c: Added
> BFD_RELOC_M32R_GOTOFF_HI_ULO, BFD_RELOC_M32R_GOTOFF_HI_SLO,
> BFD_RELOC_M32R_GOTOFF_LO
>
> gas/ChangeLog
> 2004-06-25 Kazuhiro Inaoka <inaoka dot kazuhiro at renesas dot com>
>
> * config/tc-m32r.c (md_convert_frag): Changed for @PLT.
> (m32r_cgen_record_fixup_exp): Changed for @GOTOFF, @GOT.
> (m32r_fix_adjustable): Changed for @GOTOFF, @GOT, @PLT.
> (tc_gen_reloc): Ditto.
> (m32r_end_of_match): Add for @GOTOFF, @GOT, @PLT.
> (m32r_parse_name): Ditto.
> (m32r_cgen_parse_fix_exp): Ditto.
> * config/tc-m32r.h (md_parse_name): Define for @GOTOFF, @GOT, @PLT.
> (O_PIC_reloc): Ditto
> (TC_CGEN_PARSE_FIX_EXP): Ditto.
> * cgen.c (gas_cgen_parse_operand): Add TC_CGEN_PARSE_FIX_EXP
> for @GOTOFF, @GOT, @PLT.
Approved and applied.
One thing though - please would you consider adding a new test to the
m32r section of the GAS testsuite to make sure that this new support
works, and continues to work with future releases.
Cheers
Nick
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] New port @GOTOFF, @GOT, @PLT relocation token for target m32r
2004-06-25 16:10 ` Nick Clifton
@ 2004-06-28 8:38 ` Kazuhiro Inaoka
2004-07-09 16:25 ` Nick Clifton
0 siblings, 1 reply; 7+ messages in thread
From: Kazuhiro Inaoka @ 2004-06-28 8:38 UTC (permalink / raw)
To: Nick Clifton; +Cc: binutils
[-- Attachment #1: Type: text/plain, Size: 627 bytes --]
> Approved and applied.
>
> One thing though - please would you consider adding a new test to the
> m32r section of the GAS testsuite to make sure that this new support
> works, and continues to work with future releases.
>
> Cheers
> Nick
Thanks Nick!
I made a test case for @GOTOFF, @GOT, @PLT.
Please apply it too.
Regards,
Kazuhiro Inaoka
gas/testsuite/ChangeLog
2004-06-28 Kazuhiro Inaoka <inaoka dot kazuhiro at renesas dot com>
* gas/m32r/pic.exp: Add New Test case for @GOTOFF, @GOT, @PLT.
* gas/m32r/pic2.s: New file: Test case for @GOTOFF, @GOT, @PLT.
* gas/m32r/pic2.d: New file: Expected results.
[-- Attachment #2: pic2.patch --]
[-- Type: text/plain, Size: 397 bytes --]
Index: pic.exp
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/m32r/pic.exp,v
retrieving revision 1.1
diff -c -r1.1 pic.exp
*** pic.exp 19 Dec 2003 11:44:01 -0000 1.1
--- pic.exp 28 Jun 2004 08:25:39 -0000
***************
*** 2,5 ****
--- 2,6 ----
if [istarget m32r*-*-*] {
run_dump_test "pic"
+ run_dump_test "pic2"
}
[-- Attachment #3: pic2.s --]
[-- Type: text/plain, Size: 1056 bytes --]
.section .text
# R_M32R_GOTPC24
pic_gotpc:
bl.s .+4
ld24 r12,#_GLOBAL_OFFSET_TABLE_
add r12,lr
# R_M32R_GOTPC_HI_ULO
# R_M32R_GOTPC_HI_SLO
# R_M32R_GOTPC_LO
pic_gotpc_slo:
bl.s .+4
seth r12,#shigh(_GLOBAL_OFFSET_TABLE_)
add3 r12,r12,#low(_GLOBAL_OFFSET_TABLE_+4)
add r12,lr
pic_gotpc_ulo:
bl.s .+4
seth r12,#high(_GLOBAL_OFFSET_TABLE_)
or3 r12,r12,#low(_GLOBAL_OFFSET_TABLE_+4)
add r12,lr
# R_M32R_GOT24
pic_got:
.global sym
ld24 r0,#sym@GOTOFF
# R_M32R_GOT16_HI_ULO
# R_M32R_GOT16_HI_SLO
# R_M32R_GOT16_LO
pic_got16:
.global sym2
seth r12,#shigh(sym2@GOT)
add3 r12,r12,#low(sym2@GOT)
seth r12,#high(sym2@GOTOFF)
or3 r12,r12,#low(sym2@GOT)
# R_M32R_26_PLTREL
pic_plt:
.global func
bl func@PLT
# R_M32R_GOTOFF
gotoff:
ld24 r0,#gotoff@GOTOFF
# R_M32R_GOTOFF_HI_ULO
# R_M32R_GOTOFF_HI_SLO
# R_M32R_GOTOFF_LO
seth r0,#shigh(gotoff@GOTOFF)
add3 r0,r0,#low(gotoff@GOTOFF)
seth r0,#high(gotoff@GOTOFF)
or3 r0,r0,#low(gotoff@GOTOFF)
.end
[-- Attachment #4: pic2.d --]
[-- Type: text/plain, Size: 1692 bytes --]
#objdump: -dr
#name: pic2
.*: +file format .*
Disassembly of section .text:
0+0000 <pic_gotpc>:
0: 7e 01 f0 00 bl 4 <pic_gotpc\+0x4> \|\| nop
4: ec 00 00 00 ld24 r12,0 <pic_gotpc>
4: R_M32R_GOTPC24 _GLOBAL_OFFSET_TABLE_
8: 0c ae f0 00 add r12,lr \|\| nop
0+000c <pic_gotpc_slo>:
c: 7e 01 f0 00 bl 10 <pic_gotpc_slo\+0x4> \|\| nop
10: dc c0 00 00 seth r12,[#]0x0
10: R_M32R_GOTPC_HI_SLO _GLOBAL_OFFSET_TABLE_
14: 8c ac 00 00 add3 r12,r12,[#]0
14: R_M32R_GOTPC_LO _GLOBAL_OFFSET_TABLE_\+0x4
18: 0c ae f0 00 add r12,lr \|\| nop
0+001c <pic_gotpc_ulo>:
1c: 7e 01 f0 00 bl 20 <pic_gotpc_ulo\+0x4> \|\| nop
20: dc c0 00 00 seth r12,[#]0x0
20: R_M32R_GOTPC_HI_ULO _GLOBAL_OFFSET_TABLE_
24: 8c ec 00 00 or3 r12,r12,[#]0x0
24: R_M32R_GOTPC_LO _GLOBAL_OFFSET_TABLE_\+0x4
28: 0c ae f0 00 add r12,lr \|\| nop
0+002c <pic_got>:
2c: e0 00 00 00 ld24 r0,0 <pic_gotpc>
2c: R_M32R_GOTOFF sym
0+0030 <pic_got16>:
30: dc c0 00 00 seth r12,[#]0x0
30: R_M32R_GOT16_HI_SLO sym2
34: 8c ac 00 00 add3 r12,r12,[#]0
34: R_M32R_GOT16_LO sym2
38: dc c0 00 00 seth r12,[#]0x0
38: R_M32R_GOTOFF_HI_ULO sym2
3c: 8c ec 00 00 or3 r12,r12,[#]0x0
3c: R_M32R_GOT16_LO sym2
0+0040 <pic_plt>:
40: fe 00 00 00 bl 40 <pic_plt>
40: R_M32R_26_PLTREL func
0+0044 <gotoff>:
44: e0 00 00 00 ld24 r0,0 <pic_gotpc>
44: R_M32R_GOTOFF .text\+0x44
48: d0 c0 00 00 seth r0,[#]0x0
48: R_M32R_GOTOFF_HI_SLO .text\+0x44
4c: 80 a0 00 00 add3 r0,r0,[#]0
4c: R_M32R_GOTOFF_LO .text\+0x44
50: d0 c0 00 00 seth r0,[#]0x0
50: R_M32R_GOTOFF_HI_ULO .text\+0x44
54: 80 e0 00 00 or3 r0,r0,[#]0x0
54: R_M32R_GOTOFF_LO .text\+0x44
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] New port @GOTOFF, @GOT, @PLT relocation token for target m32r
2004-06-28 8:38 ` Kazuhiro Inaoka
@ 2004-07-09 16:25 ` Nick Clifton
0 siblings, 0 replies; 7+ messages in thread
From: Nick Clifton @ 2004-07-09 16:25 UTC (permalink / raw)
To: Kazuhiro Inaoka; +Cc: binutils
Hi Kazuhiro,
> I made a test case for @GOTOFF, @GOT, @PLT.
Thanks - I have added this test now. Sorry for the delay in processing
this request.
Cheers
Nick
> gas/testsuite/ChangeLog
> 2004-06-28 Kazuhiro Inaoka <inaoka dot kazuhiro at renesas dot com>
>
> * gas/m32r/pic.exp: Add New Test case for @GOTOFF, @GOT, @PLT.
> * gas/m32r/pic2.s: New file: Test case for @GOTOFF, @GOT, @PLT.
> * gas/m32r/pic2.d: New file: Expected results.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] New port @GOTOFF, @GOT, @PLT relocation token for target m32r
2004-06-22 12:11 [PATCH] New port @GOTOFF, @GOT, @PLT relocation token for target m32r Kazuhiro Inaoka
2004-06-25 4:26 ` Kazuhiro Inaoka
@ 2005-07-29 9:19 ` Kazuhiro Inaoka
2005-07-29 13:52 ` Nick Clifton
1 sibling, 1 reply; 7+ messages in thread
From: Kazuhiro Inaoka @ 2005-07-29 9:19 UTC (permalink / raw)
To: Nick Clifton; +Cc: binutils
[-- Attachment #1: Type: text/plain, Size: 333 bytes --]
Hi Nick,
The following patch was not enough to check X_op attribute.
http://sourceware.org/ml/binutils/2004-06/msg00397.html
This is a patch to fix it.
Please commit it.
Regards,
Kazuhiro Inaoka
gas/ChangeLog
2005-07-29 Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com>
* config/tc-m32r.c (m32r_check_fixup): Fixed X_op check.
[-- Attachment #2: tc-m32r.c.patch --]
[-- Type: text/plain, Size: 524 bytes --]
Index: tc-m32r.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-m32r.c,v
retrieving revision 1.46
diff -u -p -r1.46 tc-m32r.c
--- tc-m32r.c 20 Jul 2005 11:35:00 -0000 1.46
+++ tc-m32r.c 26 Jul 2005 09:11:32 -0000
@@ -479,7 +479,7 @@ m32r_check_fixup (expressionS *main_exp,
return 0;
}
- if (exp->X_op == O_PIC_reloc || exp->X_md != BFD_RELOC_UNUSED)
+ if (exp->X_op == O_PIC_reloc)
{
*r_type_p = exp->X_md;
if (exp == main_exp)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] New port @GOTOFF, @GOT, @PLT relocation token for target m32r
2005-07-29 9:19 ` Kazuhiro Inaoka
@ 2005-07-29 13:52 ` Nick Clifton
0 siblings, 0 replies; 7+ messages in thread
From: Nick Clifton @ 2005-07-29 13:52 UTC (permalink / raw)
To: Kazuhiro Inaoka; +Cc: binutils
Hi Kazuhiro,
> gas/ChangeLog
> 2005-07-29 Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com>
>
> * config/tc-m32r.c (m32r_check_fixup): Fixed X_op check.
Approved and applied.
Cheers
Nick
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2005-07-29 13:52 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-22 12:11 [PATCH] New port @GOTOFF, @GOT, @PLT relocation token for target m32r Kazuhiro Inaoka
2004-06-25 4:26 ` Kazuhiro Inaoka
2004-06-25 16:10 ` Nick Clifton
2004-06-28 8:38 ` Kazuhiro Inaoka
2004-07-09 16:25 ` Nick Clifton
2005-07-29 9:19 ` Kazuhiro Inaoka
2005-07-29 13:52 ` Nick Clifton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).