aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Eckhardt <jle@rice.edu>2000-08-21 23:26:19 +0000
committerJason Eckhardt <jle@rice.edu>2000-08-21 23:26:19 +0000
commitded0649cd504e9895ab37f7ffae110d00ebbaaef (patch)
tree20ad6a27c89278c0940a7aa85e1dba3076e8e229
parentc8c5888ebc7925fcc631e3a7be075ad6c5cc2ad1 (diff)
downloadgdb-ded0649cd504e9895ab37f7ffae110d00ebbaaef.zip
gdb-ded0649cd504e9895ab37f7ffae110d00ebbaaef.tar.gz
gdb-ded0649cd504e9895ab37f7ffae110d00ebbaaef.tar.bz2
2000-08-21 Jason Eckhardt <jle@cygnus.com>
bfd: * elf32-i860.c (elf32_i860_relocate_pc16): Just write the immediate field with the newly relocated value instead of adding it to the existing immediate field. (elf32_i860_relocate_splitn): Likewise. (elf32_i860_relocate_highadj): Likewise. gas: * config/tc-i860.c (md_apply_fix3): Do not insert the immediate if the fixup resulted in a relocation.
-rw-r--r--bfd/ChangeLog8
-rw-r--r--bfd/elf32-i860.c23
-rw-r--r--gas/ChangeLog5
-rw-r--r--gas/config/tc-i860.c80
4 files changed, 75 insertions, 41 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index f993cc8..8509380 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,11 @@
+2000-08-21 Jason Eckhardt <jle@cygnus.com>
+
+ * elf32-i860.c (elf32_i860_relocate_pc16): Just write the immediate
+ field with the newly relocated value instead of adding it to the
+ existing immediate field.
+ (elf32_i860_relocate_splitn): Likewise.
+ (elf32_i860_relocate_highadj): Likewise.
+
2000-08-16 Jason Eckhardt <jle@cygnus.com>
* elf32-i860.c (elf32_i860_relocate_pc16): Implemented function (it
diff --git a/bfd/elf32-i860.c b/bfd/elf32-i860.c
index bc10093..08c2e16 100644
--- a/bfd/elf32-i860.c
+++ b/bfd/elf32-i860.c
@@ -709,20 +709,15 @@ elf32_i860_relocate_splitn (input_bfd, rello, contents, value)
bfd_byte *contents;
bfd_vma value;
{
- bfd_vma insn, t;
+ bfd_vma insn;
reloc_howto_type *howto;
howto = lookup_howto (ELF32_R_TYPE (rello->r_info));
insn = bfd_get_32 (input_bfd, contents + rello->r_offset);
- /* Remove encode bits and intervening bits. Then concatenate the
- two fields into one 16-bit quantity. */
- t = (insn & howto->src_mask);
- t = ((t >> 5) & 0xf8) | (t & 0x7ff);
-
/* Relocate. */
- value += (rello->r_addend + t);
+ value += rello->r_addend;
- /* Separate the fields and re-insert. */
+ /* Separate the fields and insert. */
value = (((value & 0xf8) << 5) | (value & 0x7ff)) & howto->dst_mask;
insn = (insn & ~howto->dst_mask) | value;
@@ -742,7 +737,7 @@ elf32_i860_relocate_pc16 (input_bfd, input_section, rello, contents, value)
bfd_byte *contents;
bfd_vma value;
{
- bfd_vma insn, t;
+ bfd_vma insn;
reloc_howto_type *howto;
howto = lookup_howto (ELF32_R_TYPE (rello->r_info));
insn = bfd_get_32 (input_bfd, contents + rello->r_offset);
@@ -752,15 +747,10 @@ elf32_i860_relocate_pc16 (input_bfd, input_section, rello, contents, value)
+ input_section->output_offset);
value -= rello->r_offset;
- /* Remove encode bits and intervening bits. Then concatenate the
- two fields into one 16-bit quantity. */
- t = (insn & howto->src_mask);
- t = ((t >> 5) & 0xf8) | (t & 0x7ff);
-
/* Relocate. */
- value += (rello->r_addend + t);
+ value += rello->r_addend;
- /* Separate the fields and re-insert. */
+ /* Separate the fields and insert. */
value = (((value & 0xf8) << 5) | (value & 0x7ff)) & howto->dst_mask;
insn = (insn & ~howto->dst_mask) | value;
@@ -785,7 +775,6 @@ elf32_i860_relocate_highadj (input_bfd, rel, contents, value)
value += ((rel->r_addend & 0x8000) << 1);
value += rel->r_addend;
value = ((value >> 16) & 0xffff);
- value = (value + (insn & 0xffff)) & 0xffff;
insn = (insn & 0xffff0000) | value;
diff --git a/gas/ChangeLog b/gas/ChangeLog
index f2e576e..2c7402f 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,8 @@
+2000-08-21 Jason Eckhardt <jle@cygnus.com>
+
+ * config/tc-i860.c (md_apply_fix3): Do not insert the immediate
+ if the fixup resulted in a relocation.
+
2000-08-18 Nick Clifton <nickc@redhat.com>
* config/tc-arm.c (decode_shift): Replace as_tsktsk with as_warn.
diff --git a/gas/config/tc-i860.c b/gas/config/tc-i860.c
index 2255eee..56cad24 100644
--- a/gas/config/tc-i860.c
+++ b/gas/config/tc-i860.c
@@ -1298,10 +1298,15 @@ md_apply_fix3 (fix, valuep, seg)
fix->fx_r_type = obtain_reloc_for_imm16 (fix, &val);
/* Insert the immediate. */
- insn |= val & 0xffff;
- bfd_putl32 (insn, buf);
-
- fix->fx_done = (fix->fx_addsy == 0);
+ if (fix->fx_addsy)
+ fix->fx_done = 0;
+ else
+ {
+ insn |= val & 0xffff;
+ bfd_putl32 (insn, buf);
+ fix->fx_r_type = BFD_RELOC_NONE;
+ fix->fx_done = 1;
+ }
}
else if (fup & OP_IMM_U16)
{
@@ -1312,11 +1317,16 @@ md_apply_fix3 (fix, valuep, seg)
fix->fx_r_type = obtain_reloc_for_imm16 (fix, &val);
/* Insert the immediate. */
- insn |= val & 0x7ff;
- insn |= (val & 0xf800) << 5;
- bfd_putl32 (insn, buf);
-
- fix->fx_done = (fix->fx_addsy == 0);
+ if (fix->fx_addsy)
+ fix->fx_done = 0;
+ else
+ {
+ insn |= val & 0x7ff;
+ insn |= (val & 0xf800) << 5;
+ bfd_putl32 (insn, buf);
+ fix->fx_r_type = BFD_RELOC_NONE;
+ fix->fx_done = 1;
+ }
}
else if (fup & OP_IMM_BR16)
{
@@ -1327,12 +1337,19 @@ md_apply_fix3 (fix, valuep, seg)
val = val >> 2;
/* Insert the immediate. */
- insn |= (val & 0x7ff);
- insn |= ((val & 0xf800) << 5);
- bfd_putl32 (insn, buf);
-
- fix->fx_r_type = BFD_RELOC_860_PC16;
- fix->fx_done = (fix->fx_addsy == 0);
+ if (fix->fx_addsy)
+ {
+ fix->fx_done = 0;
+ fix->fx_r_type = BFD_RELOC_860_PC16;
+ }
+ else
+ {
+ insn |= (val & 0x7ff);
+ insn |= ((val & 0xf800) << 5);
+ bfd_putl32 (insn, buf);
+ fix->fx_r_type = BFD_RELOC_NONE;
+ fix->fx_done = 1;
+ }
}
else if (fup & OP_IMM_BR26)
{
@@ -1343,11 +1360,18 @@ md_apply_fix3 (fix, valuep, seg)
val >>= 2;
/* Insert the immediate. */
- insn |= (val & 0x3ffffff);
- bfd_putl32 (insn, buf);
-
- fix->fx_r_type = BFD_RELOC_860_PC26;
- fix->fx_done = (fix->fx_addsy == 0);
+ if (fix->fx_addsy)
+ {
+ fix->fx_r_type = BFD_RELOC_860_PC26;
+ fix->fx_done = 0;
+ }
+ else
+ {
+ insn |= (val & 0x3ffffff);
+ bfd_putl32 (insn, buf);
+ fix->fx_r_type = BFD_RELOC_NONE;
+ fix->fx_done = 1;
+ }
}
else if (fup != OP_NONE)
{
@@ -1359,10 +1383,18 @@ md_apply_fix3 (fix, valuep, seg)
{
/* I believe only fix-ups such as ".long .ep.main-main+0xc8000000"
reach here (???). */
- insn |= (val & 0xffffffff);
- bfd_putl32 (insn, buf);
- fix->fx_r_type = BFD_RELOC_32;
- fix->fx_done = (fix->fx_addsy == 0);
+ if (fix->fx_addsy)
+ {
+ fix->fx_r_type = BFD_RELOC_32;
+ fix->fx_done = 0;
+ }
+ else
+ {
+ insn |= (val & 0xffffffff);
+ bfd_putl32 (insn, buf);
+ fix->fx_r_type = BFD_RELOC_NONE;
+ fix->fx_done = 1;
+ }
}
/* Return value ignored. */