From 7fa9fcb6db636f393bcef5ed9f14559d3a8354f2 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Wed, 24 Jul 2013 14:12:41 +0000 Subject: bfd/ 2013-07-24 Tristan Gingold * coff-rs6000.c (xcoff_howto_table): Fix masks and pc_relative for R_RBR. Add numbers in comments. (_bfd_xcoff_reloc_type_lookup): Handle BFD_RELOC_PPC_B16. * coff64-rs6000.c: Likewise. gas/ 2013-07-24 Tristan Gingold * config/tc-ppc.c (md_apply_fix): Adjust BFD_RELOC_PPC_B16 on xcoff targets. gas/testsuite/ 2013-07-24 Tristan Gingold * gas/ppc/test2xcoff32.s, gas/ppc/test2xcoff32.d: New files * gas/ppc/ppc.exp: Add new test. * gas/ppc/xcoff-br16-1.s, gas/ppc/xcoff-br16-1.d, gas/ppc/xcoff-br16-2.s, gas/ppc/xcoff-br16-2.d: New files * gas/ppc/aix.exp: Add new tests. --- bfd/coff-rs6000.c | 58 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 30 insertions(+), 28 deletions(-) (limited to 'bfd/coff-rs6000.c') diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c index 9abe04d..309ea77 100644 --- a/bfd/coff-rs6000.c +++ b/bfd/coff-rs6000.c @@ -731,7 +731,7 @@ end: reloc_howto_type xcoff_howto_table[] = { - /* Standard 32 bit relocation. */ + /* 0x00: Standard 32 bit relocation. */ HOWTO (R_POS, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ @@ -746,7 +746,7 @@ reloc_howto_type xcoff_howto_table[] = 0xffffffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* 32 bit relocation, but store negative value. */ + /* 0x01: 32 bit relocation, but store negative value. */ HOWTO (R_NEG, /* type */ 0, /* rightshift */ -2, /* size (0 = byte, 1 = short, 2 = long) */ @@ -761,7 +761,7 @@ reloc_howto_type xcoff_howto_table[] = 0xffffffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* 32 bit PC relative relocation. */ + /* 0x02: 32 bit PC relative relocation. */ HOWTO (R_REL, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ @@ -776,7 +776,7 @@ reloc_howto_type xcoff_howto_table[] = 0xffffffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* 16 bit TOC relative relocation. */ + /* 0x03: 16 bit TOC relative relocation. */ HOWTO (R_TOC, /* type */ 0, /* rightshift */ 1, /* size (0 = byte, 1 = short, 2 = long) */ @@ -791,7 +791,7 @@ reloc_howto_type xcoff_howto_table[] = 0xffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* I don't really know what this is. */ + /* 0x04: I don't really know what this is. */ HOWTO (R_RTB, /* type */ 1, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ @@ -806,7 +806,7 @@ reloc_howto_type xcoff_howto_table[] = 0xffffffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* External TOC relative symbol. */ + /* 0x05: External TOC relative symbol. */ HOWTO (R_GL, /* type */ 0, /* rightshift */ 1, /* size (0 = byte, 1 = short, 2 = long) */ @@ -821,7 +821,7 @@ reloc_howto_type xcoff_howto_table[] = 0xffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* Local TOC relative symbol. */ + /* 0x06: Local TOC relative symbol. */ HOWTO (R_TCL, /* type */ 0, /* rightshift */ 1, /* size (0 = byte, 1 = short, 2 = long) */ @@ -838,7 +838,7 @@ reloc_howto_type xcoff_howto_table[] = EMPTY_HOWTO (7), - /* Non modifiable absolute branch. */ + /* 0x08: Non modifiable absolute branch. */ HOWTO (R_BA, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ @@ -855,7 +855,7 @@ reloc_howto_type xcoff_howto_table[] = EMPTY_HOWTO (9), - /* Non modifiable relative branch. */ + /* 0x0a: Non modifiable relative branch. */ HOWTO (R_BR, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ @@ -872,7 +872,7 @@ reloc_howto_type xcoff_howto_table[] = EMPTY_HOWTO (0xb), - /* Indirect load. */ + /* 0x0c: Indirect load. */ HOWTO (R_RL, /* type */ 0, /* rightshift */ 1, /* size (0 = byte, 1 = short, 2 = long) */ @@ -887,7 +887,7 @@ reloc_howto_type xcoff_howto_table[] = 0xffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* Load address. */ + /* 0x0d: Load address. */ HOWTO (R_RLA, /* type */ 0, /* rightshift */ 1, /* size (0 = byte, 1 = short, 2 = long) */ @@ -904,7 +904,7 @@ reloc_howto_type xcoff_howto_table[] = EMPTY_HOWTO (0xe), - /* Non-relocating reference. Bitsize is 1 so that r_rsize is 0. */ + /* 0x0f: Non-relocating reference. Bitsize is 1 so that r_rsize is 0. */ HOWTO (R_REF, /* type */ 0, /* rightshift */ 0, /* size (0 = byte, 1 = short, 2 = long) */ @@ -922,7 +922,7 @@ reloc_howto_type xcoff_howto_table[] = EMPTY_HOWTO (0x10), EMPTY_HOWTO (0x11), - /* TOC relative indirect load. */ + /* 0x12: TOC relative indirect load. */ HOWTO (R_TRL, /* type */ 0, /* rightshift */ 1, /* size (0 = byte, 1 = short, 2 = long) */ @@ -937,7 +937,7 @@ reloc_howto_type xcoff_howto_table[] = 0xffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* TOC relative load address. */ + /* 0x13: TOC relative load address. */ HOWTO (R_TRLA, /* type */ 0, /* rightshift */ 1, /* size (0 = byte, 1 = short, 2 = long) */ @@ -952,7 +952,7 @@ reloc_howto_type xcoff_howto_table[] = 0xffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* Modifiable relative branch. */ + /* 0x14: Modifiable relative branch. */ HOWTO (R_RRTBI, /* type */ 1, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ @@ -967,7 +967,7 @@ reloc_howto_type xcoff_howto_table[] = 0xffffffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* Modifiable absolute branch. */ + /* 0x15: Modifiable absolute branch. */ HOWTO (R_RRTBA, /* type */ 1, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ @@ -982,7 +982,7 @@ reloc_howto_type xcoff_howto_table[] = 0xffffffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* Modifiable call absolute indirect. */ + /* 0x16: Modifiable call absolute indirect. */ HOWTO (R_CAI, /* type */ 0, /* rightshift */ 1, /* size (0 = byte, 1 = short, 2 = long) */ @@ -997,7 +997,7 @@ reloc_howto_type xcoff_howto_table[] = 0xffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* Modifiable call relative. */ + /* 0x17: Modifiable call relative. */ HOWTO (R_CREL, /* type */ 0, /* rightshift */ 1, /* size (0 = byte, 1 = short, 2 = long) */ @@ -1012,7 +1012,7 @@ reloc_howto_type xcoff_howto_table[] = 0xffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* Modifiable branch absolute. */ + /* 0x18: Modifiable branch absolute. */ HOWTO (R_RBA, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ @@ -1027,7 +1027,7 @@ reloc_howto_type xcoff_howto_table[] = 0x03fffffc, /* dst_mask */ FALSE), /* pcrel_offset */ - /* Modifiable branch absolute. */ + /* 0x19: Modifiable branch absolute. */ HOWTO (R_RBAC, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ @@ -1042,7 +1042,7 @@ reloc_howto_type xcoff_howto_table[] = 0xffffffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* Modifiable branch relative. */ + /* 0x1a: Modifiable branch relative. */ HOWTO (R_RBR, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ @@ -1057,7 +1057,7 @@ reloc_howto_type xcoff_howto_table[] = 0x03fffffc, /* dst_mask */ FALSE), /* pcrel_offset */ - /* Modifiable branch absolute. */ + /* 0x1b: Modifiable branch absolute. */ HOWTO (R_RBRC, /* type */ 0, /* rightshift */ 1, /* size (0 = byte, 1 = short, 2 = long) */ @@ -1072,7 +1072,7 @@ reloc_howto_type xcoff_howto_table[] = 0xffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* 16 bit Non modifiable absolute branch. */ + /* 0x1c: 16 bit Non modifiable absolute branch. */ HOWTO (R_BA, /* type */ 0, /* rightshift */ 1, /* size (0 = byte, 1 = short, 2 = long) */ @@ -1087,22 +1087,22 @@ reloc_howto_type xcoff_howto_table[] = 0xfffc, /* dst_mask */ FALSE), /* pcrel_offset */ - /* Modifiable branch relative. */ + /* 0x1d: Modifiable branch relative. */ HOWTO (R_RBR, /* type */ 0, /* rightshift */ 1, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ - FALSE, /* pc_relative */ + TRUE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ 0, /* special_function */ "R_RBR_16", /* name */ TRUE, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ + 0xfffc, /* src_mask */ + 0xfffc, /* dst_mask */ FALSE), /* pcrel_offset */ - /* Modifiable branch relative. */ + /* 0x1e: Modifiable branch relative. */ HOWTO (R_RBA, /* type */ 0, /* rightshift */ 1, /* size (0 = byte, 1 = short, 2 = long) */ @@ -1166,6 +1166,8 @@ _bfd_xcoff_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, case BFD_RELOC_16: /* Note that this relocation is only internally used by gas. */ return &xcoff_howto_table[0xc]; + case BFD_RELOC_PPC_B16: + return &xcoff_howto_table[0x1d]; case BFD_RELOC_32: case BFD_RELOC_CTOR: return &xcoff_howto_table[0]; -- cgit v1.1