From: law@redhat.com
To: binutils@sources.redhat.com
Subject: H8 ELF PCREL relocs
Date: Wed, 29 Aug 2001 19:15:00 -0000 [thread overview]
Message-ID: <18698.999137839@localhost.localdomain> (raw)
Whee. Really complex stuff, PC relative relocation support.
* elf32-h8300.c (h8_elf_howto_table): Add new PC relative
relocations.
(h8_reloc_map): Similarly.
(elf32_h8_final_link_relocate): Remove incorrect overflow tests.
Add support for PC relative relocations.
Index: elf32-h8300.c
===================================================================
RCS file: /cvs/cvsfiles/devo/bfd/elf32-h8300.c,v
retrieving revision 1.4
diff -c -3 -p -r1.4 elf32-h8300.c
*** elf32-h8300.c 2001/08/30 00:05:34 1.4
--- elf32-h8300.c 2001/08/30 02:11:32
*************** static reloc_howto_type h8_elf_howto_tab
*** 171,176 ****
--- 171,204 ----
0, /* src_mask */
0xffffffff, /* dst_mask */
false), /* pcrel_offset */
+ #define R_H8_PCREL16_X (R_H8_DIR32A16_X + 1)
+ HOWTO (R_H8_PCREL16, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ NULL, /* special_function */
+ "R_H8_PCREL16", /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ true), /* pcrel_offset */
+ #define R_H8_PCREL8_X (R_H8_PCREL16_X + 1)
+ HOWTO (R_H8_PCREL8, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ NULL, /* special_function */
+ "R_H8_PCREL8", /* name */
+ false, /* partial_inplace */
+ 0xff, /* src_mask */
+ 0xff, /* dst_mask */
+ true), /* pcrel_offset */
};
/* This structure is used to map BFD reloc codes to H8 ELF relocs. */
*************** static const struct elf_reloc_map h8_rel
*** 194,199 ****
--- 222,229 ----
{ BFD_RELOC_H8_DIR24A8, R_H8_DIR24A8_X },
{ BFD_RELOC_H8_DIR24R8, R_H8_DIR24R8_X },
{ BFD_RELOC_H8_DIR32A16, R_H8_DIR32A16_X },
+ { BFD_RELOC_16_PCREL, R_H8_PCREL16_X },
+ { BFD_RELOC_8_PCREL, R_H8_PCREL8_X },
};
*************** elf32_h8_final_link_relocate (r_type, in
*** 287,295 ****
case R_H8_DIR8:
value += addend;
- if ((long) value > 0x7f || (long) value < -0x80)
- return bfd_reloc_overflow;
-
bfd_put_8 (input_bfd, value, hit_data);
return bfd_reloc_ok;
--- 317,322 ----
*************** elf32_h8_final_link_relocate (r_type, in
*** 297,308 ****
case R_H8_DIR24R8:
value += addend;
- if ((long) value > 0x7fffff || (long) value < -0x800000)
- return bfd_reloc_overflow;
-
value &= 0xffffff;
value |= (bfd_get_32 (input_bfd, hit_data) & 0xff000000);
bfd_put_32 (input_bfd, value, hit_data);
return bfd_reloc_ok;
default:
--- 324,350 ----
case R_H8_DIR24R8:
value += addend;
value &= 0xffffff;
value |= (bfd_get_32 (input_bfd, hit_data) & 0xff000000);
bfd_put_32 (input_bfd, value, hit_data);
+ return bfd_reloc_ok;
+
+ case R_H8_PCREL16:
+ value -= (input_section->output_section->vma
+ + input_section->output_offset);
+ value -= offset;
+ value += addend;
+
+ bfd_put_16 (input_bfd, value, hit_data);
+ return bfd_reloc_ok;
+
+ case R_H8_PCREL8:
+ value -= (input_section->output_section->vma
+ + input_section->output_offset);
+ value -= offset;
+ value += addend;
+
+ bfd_put_8 (input_bfd, value, hit_data);
return bfd_reloc_ok;
default:
reply other threads:[~2001-08-29 19:15 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=18698.999137839@localhost.localdomain \
--to=law@redhat.com \
--cc=binutils@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).