aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorAndreas Krebbel <Andreas.Krebbel@de.ibm.com>2013-07-05 09:45:44 +0000
committerAndreas Krebbel <Andreas.Krebbel@de.ibm.com>2013-07-05 09:45:44 +0000
commitfb798c50b2c896195fb94af229dfbcc52babdfea (patch)
tree5b669afd3f77487790288a9944f633c13fe8af26 /gas
parent4767856f5022ec1aa0f5c2f1ecb73111ececa6fa (diff)
downloadgdb-fb798c50b2c896195fb94af229dfbcc52babdfea.zip
gdb-fb798c50b2c896195fb94af229dfbcc52babdfea.tar.gz
gdb-fb798c50b2c896195fb94af229dfbcc52babdfea.tar.bz2
2013-07-05 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
opcodes/ * s390-opc.c (J12_12, J24_24): New macros. (INSTR_MII_UPI): Rename to INSTR_MII_UPP. (MASK_MII_UPI): Rename to MASK_MII_UPP. * s390-opc.txt: Rename MII_UPI to MII_UPP for bprp instruction. include/elf/ * s390.h: Add new relocs R_390_PC12DBL, R_390_PLT12DBL, R_390_PC24DBL, and R_390_PLT24DBL. gas/testsuite/ * gas/s390/zarch-zEC12.s: Change bprp second operand and add variants requiring relocations. * gas/s390/zarch-zEC12.d: Likewise. gas/ * config/tc-s390.c (md_gather_operands, md_apply_fix): Support new relocs. bfd/ * elf32-s390.c: Add new relocation definitions R_390_PC12DBL, R_390_PLT12DBL, R_390_PC24DBL, and R_390_PLT24DBL. (elf_s390_reloc_type_lookup, elf_s390_check_relocs) (elf_s390_gc_sweep_hook, elf_s390_relocate_section): Support new relocations. * elf64-s390.c: See elf32-s390.c * bfd-in2.h: Add new relocs to enum bfd_reloc_code_real. * libbfd.h: Add new reloc strings.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog5
-rw-r--r--gas/config/tc-s390.c52
-rw-r--r--gas/testsuite/ChangeLog6
-rw-r--r--gas/testsuite/gas/s390/zarch-zEC12.d11
-rw-r--r--gas/testsuite/gas/s390/zarch-zEC12.s6
5 files changed, 74 insertions, 6 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 4551f99..333eb03 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,8 @@
+2013-07-05 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
+
+ * config/tc-s390.c (md_gather_operands, md_apply_fix): Support new
+ relocs.
+
2013-07-03 Marcus Shawcroft <marcus.shawcroft@arm.com>
* config/tc-aarch64.c (reloc_table): Merge got_prel19 into got.
diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c
index 28b526c..4f9b5b0 100644
--- a/gas/config/tc-s390.c
+++ b/gas/config/tc-s390.c
@@ -1316,9 +1316,15 @@ md_gather_operands (char *str,
else if (suffix == ELF_SUFFIX_PLT)
{
if ((operand->flags & S390_OPERAND_PCREL)
- && (operand->bits == 16))
+ && (operand->bits == 12))
+ reloc = BFD_RELOC_390_PLT12DBL;
+ else if ((operand->flags & S390_OPERAND_PCREL)
+ && (operand->bits == 16))
reloc = BFD_RELOC_390_PLT16DBL;
else if ((operand->flags & S390_OPERAND_PCREL)
+ && (operand->bits == 24))
+ reloc = BFD_RELOC_390_PLT24DBL;
+ else if ((operand->flags & S390_OPERAND_PCREL)
&& (operand->bits == 32))
reloc = BFD_RELOC_390_PLT32DBL;
}
@@ -1554,7 +1560,7 @@ md_gather_operands (char *str,
if (!reloc_howto)
abort ();
- size = bfd_get_reloc_size (reloc_howto);
+ size = ((reloc_howto->bitsize - 1) / 8) + 1;
if (size < 1 || size > 4)
abort ();
@@ -2034,7 +2040,9 @@ tc_s390_fix_adjustable (fixS *fixP)
|| fixP->fx_r_type == BFD_RELOC_390_PLTOFF16
|| fixP->fx_r_type == BFD_RELOC_390_PLTOFF32
|| fixP->fx_r_type == BFD_RELOC_390_PLTOFF64
+ || fixP->fx_r_type == BFD_RELOC_390_PLT12DBL
|| fixP->fx_r_type == BFD_RELOC_390_PLT16DBL
+ || fixP->fx_r_type == BFD_RELOC_390_PLT24DBL
|| fixP->fx_r_type == BFD_RELOC_390_PLT32
|| fixP->fx_r_type == BFD_RELOC_390_PLT32DBL
|| fixP->fx_r_type == BFD_RELOC_390_PLT64
@@ -2100,7 +2108,9 @@ tc_s390_force_relocation (struct fix *fixp)
case BFD_RELOC_390_GOT64:
case BFD_RELOC_390_GOTENT:
case BFD_RELOC_390_PLT32:
+ case BFD_RELOC_390_PLT12DBL:
case BFD_RELOC_390_PLT16DBL:
+ case BFD_RELOC_390_PLT24DBL:
case BFD_RELOC_390_PLT32DBL:
case BFD_RELOC_390_PLT64:
case BFD_RELOC_390_GOTPLT12:
@@ -2192,6 +2202,14 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
fixP->fx_where += 1;
fixP->fx_r_type = BFD_RELOC_8;
}
+ else if (operand->bits == 12 && operand->shift == 12
+ && (operand->flags & S390_OPERAND_PCREL))
+ {
+ fixP->fx_size = 2;
+ fixP->fx_where += 1;
+ fixP->fx_offset += 1;
+ fixP->fx_r_type = BFD_RELOC_390_PC12DBL;
+ }
else if (operand->bits == 16 && operand->shift == 16)
{
fixP->fx_size = 2;
@@ -2204,6 +2222,14 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
else
fixP->fx_r_type = BFD_RELOC_16;
}
+ else if (operand->bits == 24 && operand->shift == 24
+ && (operand->flags & S390_OPERAND_PCREL))
+ {
+ fixP->fx_size = 3;
+ fixP->fx_where += 3;
+ fixP->fx_offset += 3;
+ fixP->fx_r_type = BFD_RELOC_390_PC24DBL;
+ }
else if (operand->bits == 32 && operand->shift == 16
&& (operand->flags & S390_OPERAND_PCREL))
{
@@ -2242,10 +2268,18 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
case BFD_RELOC_390_12:
case BFD_RELOC_390_GOT12:
case BFD_RELOC_390_GOTPLT12:
+ case BFD_RELOC_390_PC12DBL:
+ case BFD_RELOC_390_PLT12DBL:
+ if (fixP->fx_pcrel)
+ value++;
+
if (fixP->fx_done)
{
unsigned short mop;
+ if (fixP->fx_pcrel)
+ value >>= 1;
+
mop = bfd_getb16 ((unsigned char *) where);
mop |= (unsigned short) (value & 0xfff);
bfd_putb16 ((bfd_vma) mop, (unsigned char *) where);
@@ -2293,6 +2327,20 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
md_number_to_chars (where, (offsetT) value >> 1, 2);
break;
+ case BFD_RELOC_390_PC24DBL:
+ case BFD_RELOC_390_PLT24DBL:
+ value += 3;
+ if (fixP->fx_done)
+ {
+ unsigned int mop;
+ value >>= 1;
+
+ mop = bfd_getb32 ((unsigned char *) where - 1);
+ mop |= (unsigned int) (value & 0xffffff);
+ bfd_putb32 ((bfd_vma) mop, (unsigned char *) where - 1);
+ }
+ break;
+
case BFD_RELOC_32:
if (fixP->fx_pcrel)
fixP->fx_r_type = BFD_RELOC_32_PCREL;
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index e48f88c..82b437c 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2013-07-05 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
+
+ * gas/s390/zarch-zEC12.s: Change bprp second operand and add
+ variants requiring relocations.
+ * gas/s390/zarch-zEC12.d: Likewise.
+
2013-07-03 Marcus Shawcroft <marcus.shawcroft@arm.com>
* gas/aarch64/reloc-insn.s (func): Replace :got_prel19: with :got:.
diff --git a/gas/testsuite/gas/s390/zarch-zEC12.d b/gas/testsuite/gas/s390/zarch-zEC12.d
index 25424c9..5a6d5f1 100644
--- a/gas/testsuite/gas/s390/zarch-zEC12.d
+++ b/gas/testsuite/gas/s390/zarch-zEC12.d
@@ -1,5 +1,5 @@
#name: s390x opcode
-#objdump: -drw
+#objdump: -dr
.*: +file format .*
@@ -13,7 +13,7 @@ Disassembly of section .text:
.*: e5 61 6f a0 fd e8 [ ]*tbeginc 4000\(%r6\),65000
.*: b2 f8 00 00 [ ]*tend
.*: c7 a0 6f a0 00 00 [ ]*bpp 10,1e <foo\+0x1e>,4000\(%r6\)
-.*: c5 a0 00 fe c7 80 [ ]*bprp 10,24 <foo\+0x24>,-80000
+.*: c5 a0 00 00 00 0c [ ]*bprp 10,24 <foo\+0x24>,3c <foo\+0x3c>
.*: b2 fa 00 ad [ ]*niai 10,13
.*: e3 67 8a 4d fe 9f [ ]*lat %r6,-5555\(%r7,%r8\)
.*: e3 67 8a 4d fe 85 [ ]*lgat %r6,-5555\(%r7,%r8\)
@@ -54,4 +54,9 @@ Disassembly of section .text:
.*: b2 e8 c0 56 [ ]*ppa %r5,%r6,12
.*: b9 8f 60 59 [ ]*crdte %r5,%r6,%r9,0
.*: b9 8f 61 59 [ ]*crdte %r5,%r6,%r9,1
-.*: 07 07 [ ]*nopr %r7
+.*: c5 a0 06 00 00 06 [ ]*bprp 10,11e <bar>,11e <bar>
+.*: c5 a0 00 00 00 00 [ ]*bprp 10,118 <foo\+0x118>,118 <foo\+0x118>
+[ ]*119: R_390_PLT12DBL bar\+0x1
+[ ]*11b: R_390_PLT24DBL bar\+0x3
+.* <bar>:
+.*: 07 07 [ ]*nopr %r7
diff --git a/gas/testsuite/gas/s390/zarch-zEC12.s b/gas/testsuite/gas/s390/zarch-zEC12.s
index a5ece0f..98f0fde 100644
--- a/gas/testsuite/gas/s390/zarch-zEC12.s
+++ b/gas/testsuite/gas/s390/zarch-zEC12.s
@@ -7,7 +7,7 @@ foo:
tbeginc 4000(%r6),65000
tend
bpp 10,.,4000(%r6)
- bprp 10,.,-80000
+ bprp 10,.,.+24
niai 10,13
lat %r6,-5555(%r7,%r8)
lgat %r6,-5555(%r7,%r8)
@@ -52,3 +52,7 @@ foo:
ppa %r5,%r6,12
crdte %r5,%r6,%r9
crdte %r5,%r6,%r9,1
+
+ bprp 10,bar,bar
+ bprp 10,bar@PLT,bar@PLT
+bar: