• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

修訂55ff522848fef1fc5323060fd042d0988e71d4b9 (tree)
時間2017-02-23 12:31:06
作者Alan Modra <amodra@gmai...>
CommiterAlan Modra

Log Message

Correct VLE 16D and SDAREL relocations

PR 20744
bfd/
* elf32-ppc.c (ppc_elf_howto_raw): Correct dst_mask on all VLE
16D relocations.
(ppc_elf_vle_split16): Correct field mask and shift for 16D relocs.
(ppc_elf_relocate_section): Correct calculation for VLE SDAREL
relocs.
ld/
* testsuite/ld-powerpc/vle-reloc-2.s: Use r6 for last insn of
each group.
* testsuite/ld-powerpc/vle-reloc-2.d: Update for above change
and sdarel reloc fix.

Change Summary

差異

--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,12 @@
1+2017-02-23 Alan Modra <amodra@gmail.com>
2+
3+ PR 20744
4+ * elf32-ppc.c (ppc_elf_howto_raw): Correct dst_mask on all VLE
5+ 16D relocations.
6+ (ppc_elf_vle_split16): Correct field mask and shift for 16D relocs.
7+ (ppc_elf_relocate_section): Correct calculation for VLE SDAREL
8+ relocs.
9+
110 2017-02-22 Alan Modra <amodra@gmail.com>
211
312 * elf64-ppc.c (ppc64_elf_finish_dynamic_sections): Don't segfault
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -1471,7 +1471,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
14711471 "R_PPC_VLE_LO16D", /* name */
14721472 FALSE, /* partial_inplace */
14731473 0, /* src_mask */
1474- 0x1f007ff, /* dst_mask */
1474+ 0x3e007ff, /* dst_mask */
14751475 FALSE), /* pcrel_offset */
14761476
14771477 /* Bits 16-31 split16a format. */
@@ -1501,7 +1501,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
15011501 "R_PPC_VLE_HI16D", /* name */
15021502 FALSE, /* partial_inplace */
15031503 0, /* src_mask */
1504- 0x1f007ff, /* dst_mask */
1504+ 0x3e007ff, /* dst_mask */
15051505 FALSE), /* pcrel_offset */
15061506
15071507 /* Bits 16-31 (High Adjusted) in split16a format. */
@@ -1531,7 +1531,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
15311531 "R_PPC_VLE_HA16D", /* name */
15321532 FALSE, /* partial_inplace */
15331533 0, /* src_mask */
1534- 0x1f007ff, /* dst_mask */
1534+ 0x3e007ff, /* dst_mask */
15351535 FALSE), /* pcrel_offset */
15361536
15371537 /* This reloc is like R_PPC_EMB_SDA21 but only applies to e_add16i
@@ -1593,7 +1593,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
15931593 "R_PPC_VLE_SDAREL_LO16D", /* name */
15941594 FALSE, /* partial_inplace */
15951595 0, /* src_mask */
1596- 0x1f007ff, /* dst_mask */
1596+ 0x3e007ff, /* dst_mask */
15971597 FALSE), /* pcrel_offset */
15981598
15991599 /* Bits 16-31 relative to _SDA_BASE_ in split16a format. */
@@ -1623,7 +1623,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
16231623 "R_PPC_VLE_SDAREL_HI16D", /* name */
16241624 FALSE, /* partial_inplace */
16251625 0, /* src_mask */
1626- 0x1f007ff, /* dst_mask */
1626+ 0x3e007ff, /* dst_mask */
16271627 FALSE), /* pcrel_offset */
16281628
16291629 /* Bits 16-31 (HA) relative to _SDA_BASE split16a format. */
@@ -1653,7 +1653,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
16531653 "R_PPC_VLE_SDAREL_HA16D", /* name */
16541654 FALSE, /* partial_inplace */
16551655 0, /* src_mask */
1656- 0x1f007ff, /* dst_mask */
1656+ 0x3e007ff, /* dst_mask */
16571657 FALSE), /* pcrel_offset */
16581658
16591659 HOWTO (R_PPC_IRELATIVE, /* type */
@@ -4942,8 +4942,8 @@ ppc_elf_vle_split16 (bfd *input_bfd,
49424942 }
49434943 }
49444944 top5 = value & 0xf800;
4945- top5 = top5 << (split16_format == split16a_type ? 5 : 9);
4946- insn &= (split16_format == split16a_type ? ~0x1f07ff : ~0x1f007ff);
4945+ top5 = top5 << (split16_format == split16a_type ? 5 : 10);
4946+ insn &= (split16_format == split16a_type ? ~0x1f07ff : ~0x3e007ff);
49474947 insn |= top5;
49484948 insn |= value & 0x7ff;
49494949 bfd_put_32 (input_bfd, insn, loc);
@@ -9382,7 +9382,6 @@ ppc_elf_relocate_section (bfd *output_bfd,
93829382 {
93839383 bfd_vma value;
93849384 const char *name;
9385- //int reg;
93869385 struct elf_link_hash_entry *sda = NULL;
93879386
93889387 if (sec == NULL || sec->output_section == NULL)
@@ -9394,16 +9393,10 @@ ppc_elf_relocate_section (bfd *output_bfd,
93949393 name = bfd_get_section_name (output_bfd, sec->output_section);
93959394 if (strcmp (name, ".sdata") == 0
93969395 || strcmp (name, ".sbss") == 0)
9397- {
9398- //reg = 13;
9399- sda = htab->sdata[0].sym;
9400- }
9396+ sda = htab->sdata[0].sym;
94019397 else if (strcmp (name, ".sdata2") == 0
94029398 || strcmp (name, ".sbss2") == 0)
9403- {
9404- //reg = 2;
9405- sda = htab->sdata[1].sym;
9406- }
9399+ sda = htab->sdata[1].sym;
94079400 else
94089401 {
94099402 _bfd_error_handler
@@ -9420,18 +9413,12 @@ ppc_elf_relocate_section (bfd *output_bfd,
94209413 goto copy_reloc;
94219414 }
94229415
9423- if (sda != NULL)
9416+ if (sda == NULL || !is_static_defined (sda))
94249417 {
9425- if (!is_static_defined (sda))
9426- {
9427- unresolved_reloc = TRUE;
9428- break;
9429- }
9418+ unresolved_reloc = TRUE;
9419+ break;
94309420 }
9431-
9432- value = (sda->root.u.def.section->output_section->vma
9433- + sda->root.u.def.section->output_offset
9434- + addend);
9421+ value = relocation + addend - SYM_VAL (sda);
94359422
94369423 if (r_type == R_PPC_VLE_SDAREL_LO16A)
94379424 ppc_elf_vle_split16 (input_bfd, input_section, rel->r_offset,
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,11 @@
1+2017-02-23 Alan Modra <amodra@gmail.com>
2+
3+ PR 20744
4+ * testsuite/ld-powerpc/vle-reloc-2.s: Use r6 for last insn of
5+ each group.
6+ * testsuite/ld-powerpc/vle-reloc-2.d: Update for above change
7+ and sdarel reloc fix.
8+
19 2017-02-16 Alan Modra <amodra@gmail.com>
210
311 * testsuite/ld-unique/unique.exp: xfail two tests for hppa.
--- a/ld/testsuite/ld-powerpc/vle-reloc-2.d
+++ b/ld/testsuite/ld-powerpc/vle-reloc-2.d
@@ -10,75 +10,75 @@ Disassembly of section .text:
1010 .*: 70 20 c1 a2 e_or2i r1,418
1111 .*: 70 40 c1 81 e_or2i r2,385
1212 .*: 70 60 c1 81 e_or2i r3,385
13-.*: 70 80 c1 ae e_or2i r4,430
14-.*: 70 a0 c1 80 e_or2i r5,384
15-.*: 70 40 c1 81 e_or2i r2,385
13+.*: 70 90 c0 00 e_or2i r4,32768
14+.*: 70 bf c7 ff e_or2i r5,65535
15+.*: 70 c0 c0 00 e_or2i r6,0
1616 .*: 70 20 c9 a2 e_and2i\. r1,418
1717 .*: 70 40 c9 81 e_and2i\. r2,385
1818 .*: 70 60 c9 81 e_and2i\. r3,385
19-.*: 70 80 c9 ae e_and2i\. r4,430
20-.*: 70 a0 c9 80 e_and2i\. r5,384
21-.*: 70 40 c9 81 e_and2i\. r2,385
19+.*: 70 90 c8 00 e_and2i\. r4,32768
20+.*: 70 bf cf ff e_and2i\. r5,65535
21+.*: 70 c0 c8 00 e_and2i\. r6,0
2222 .*: 70 20 d1 a2 e_or2is r1,418
2323 .*: 70 40 d1 81 e_or2is r2,385
2424 .*: 70 60 d1 81 e_or2is r3,385
25-.*: 70 80 d1 ae e_or2is r4,430
26-.*: 70 a0 d1 80 e_or2is r5,384
27-.*: 70 40 d1 81 e_or2is r2,385
25+.*: 70 90 d0 00 e_or2is r4,32768
26+.*: 70 bf d7 ff e_or2is r5,65535
27+.*: 70 c0 d0 00 e_or2is r6,0
2828 .*: 70 20 e1 a2 e_lis r1,418
2929 .*: 70 40 e1 81 e_lis r2,385
3030 .*: 70 60 e1 81 e_lis r3,385
31-.*: 70 80 e1 ae e_lis r4,430
32-.*: 70 a0 e1 80 e_lis r5,384
33-.*: 70 40 e1 81 e_lis r2,385
31+.*: 70 90 e0 00 e_lis r4,32768
32+.*: 70 bf e7 ff e_lis r5,65535
33+.*: 70 c0 e0 00 e_lis r6,0
3434 .*: 70 20 e9 a2 e_and2is\. r1,418
3535 .*: 70 40 e9 81 e_and2is\. r2,385
3636 .*: 70 60 e9 81 e_and2is\. r3,385
37-.*: 70 80 e9 ae e_and2is\. r4,430
38-.*: 70 a0 e9 80 e_and2is\. r5,384
39-.*: 70 40 e9 81 e_and2is\. r2,385
37+.*: 70 90 e8 00 e_and2is\. r4,32768
38+.*: 70 bf ef ff e_and2is\. r5,65535
39+.*: 70 c0 e8 00 e_and2is\. r6,0
4040 .*: 70 01 99 a2 e_cmp16i r1,418
4141 .*: 70 02 99 81 e_cmp16i r2,385
4242 .*: 70 03 99 81 e_cmp16i r3,385
43-.*: 70 04 99 ae e_cmp16i r4,430
44-.*: 70 05 99 80 e_cmp16i r5,384
45-.*: 70 02 99 81 e_cmp16i r2,385
43+.*: 72 04 98 00 e_cmp16i r4,-32768
44+.*: 73 e5 9f ff e_cmp16i r5,-1
45+.*: 70 06 98 00 e_cmp16i r6,0
4646 .*: 70 01 a9 a2 e_cmpl16i r1,418
4747 .*: 70 02 a9 81 e_cmpl16i r2,385
4848 .*: 70 03 a9 81 e_cmpl16i r3,385
49-.*: 70 04 a9 ae e_cmpl16i r4,430
50-.*: 70 05 a9 80 e_cmpl16i r5,384
51-.*: 70 02 a9 81 e_cmpl16i r2,385
49+.*: 72 04 a8 00 e_cmpl16i r4,32768
50+.*: 73 e5 af ff e_cmpl16i r5,65535
51+.*: 70 06 a8 00 e_cmpl16i r6,0
5252 .*: 70 01 b1 a2 e_cmph16i r1,418
5353 .*: 70 02 b1 81 e_cmph16i r2,385
5454 .*: 70 03 b1 81 e_cmph16i r3,385
55-.*: 70 04 b1 ae e_cmph16i r4,430
56-.*: 70 05 b1 80 e_cmph16i r5,384
57-.*: 70 02 b1 81 e_cmph16i r2,385
55+.*: 72 04 b0 00 e_cmph16i r4,-32768
56+.*: 73 e5 b7 ff e_cmph16i r5,-1
57+.*: 70 06 b0 00 e_cmph16i r6,0
5858 .*: 70 01 b9 a2 e_cmphl16i r1,418
5959 .*: 70 02 b9 81 e_cmphl16i r2,385
6060 .*: 70 03 b9 81 e_cmphl16i r3,385
61-.*: 70 04 b9 ae e_cmphl16i r4,430
62-.*: 70 05 b9 80 e_cmphl16i r5,384
63-.*: 70 02 b9 81 e_cmphl16i r2,385
61+.*: 72 04 b8 00 e_cmphl16i r4,32768
62+.*: 73 e5 bf ff e_cmphl16i r5,65535
63+.*: 70 06 b8 00 e_cmphl16i r6,0
6464 .*: 70 01 89 a2 e_add2i\. r1,418
6565 .*: 70 02 89 81 e_add2i\. r2,385
6666 .*: 70 03 89 81 e_add2i\. r3,385
67-.*: 70 04 89 ae e_add2i\. r4,430
68-.*: 70 05 89 80 e_add2i\. r5,384
69-.*: 70 02 89 81 e_add2i\. r2,385
67+.*: 72 04 88 00 e_add2i. r4,-32768
68+.*: 73 e5 8f ff e_add2i. r5,-1
69+.*: 70 06 88 00 e_add2i. r6,0
7070 .*: 70 01 91 a2 e_add2is r1,418
7171 .*: 70 02 91 81 e_add2is r2,385
7272 .*: 70 03 91 81 e_add2is r3,385
73-.*: 70 04 91 ae e_add2is r4,430
74-.*: 70 05 91 80 e_add2is r5,384
75-.*: 70 02 91 81 e_add2is r2,385
73+.*: 72 04 90 00 e_add2is r4,-32768
74+.*: 73 e5 97 ff e_add2is r5,-1
75+.*: 70 06 90 00 e_add2is r6,0
7676 .*: 70 01 a1 a2 e_mull2i r1,418
7777 .*: 70 02 a1 81 e_mull2i r2,385
7878 .*: 70 03 a1 81 e_mull2i r3,385
79-.*: 70 04 a1 ae e_mull2i r4,430
80-.*: 70 05 a1 80 e_mull2i r5,384
81-.*: 70 02 a1 81 e_mull2i r2,385
79+.*: 72 04 a0 00 e_mull2i r4,-32768
80+.*: 73 e5 a7 ff e_mull2i r5,-1
81+.*: 70 06 a0 00 e_mull2i r6,0
8282 .* <sub3>:
8383 .*: 00 04 se_blr
8484 .* <sub4>:
--- a/ld/testsuite/ld-powerpc/vle-reloc-2.s
+++ b/ld/testsuite/ld-powerpc/vle-reloc-2.s
@@ -12,81 +12,81 @@ vle_reloc_2:
1212 e_or2i 3, high_adjust@ha
1313 e_or2i 4, low_sdarel@sdarel@l
1414 e_or2i 5, high_sdarel@sdarel@h
15- e_or2i 2, high_adjust_sdarel@sdarel@ha
15+ e_or2i 6, high_adjust_sdarel@sdarel@ha
1616
1717 e_and2i. 1, low@l
1818 e_and2i. 2, high@h
1919 e_and2i. 3, high_adjust@ha
2020 e_and2i. 4, low_sdarel@sdarel@l
2121 e_and2i. 5, high_sdarel@sdarel@h
22- e_and2i. 2, high_adjust_sdarel@sdarel@ha
22+ e_and2i. 6, high_adjust_sdarel@sdarel@ha
2323
2424 e_or2is 1, low@l
2525 e_or2is 2, high@h
2626 e_or2is 3, high_adjust@ha
2727 e_or2is 4, low_sdarel@sdarel@l
2828 e_or2is 5, high_sdarel@sdarel@h
29- e_or2is 2, high_adjust_sdarel@sdarel@ha
29+ e_or2is 6, high_adjust_sdarel@sdarel@ha
3030
3131 e_lis 1, low@l
3232 e_lis 2, high@h
3333 e_lis 3, high_adjust@ha
3434 e_lis 4, low_sdarel@sdarel@l
3535 e_lis 5, high_sdarel@sdarel@h
36- e_lis 2, high_adjust_sdarel@sdarel@ha
36+ e_lis 6, high_adjust_sdarel@sdarel@ha
3737
3838 e_and2is. 1, low@l
3939 e_and2is. 2, high@h
4040 e_and2is. 3, high_adjust@ha
4141 e_and2is. 4, low_sdarel@sdarel@l
4242 e_and2is. 5, high_sdarel@sdarel@h
43- e_and2is. 2, high_adjust_sdarel@sdarel@ha
43+ e_and2is. 6, high_adjust_sdarel@sdarel@ha
4444
4545 e_cmp16i 1, low@l
4646 e_cmp16i 2, high@h
4747 e_cmp16i 3, high_adjust@ha
4848 e_cmp16i 4, low_sdarel@sdarel@l
4949 e_cmp16i 5, high_sdarel@sdarel@h
50- e_cmp16i 2, high_adjust_sdarel@sdarel@ha
50+ e_cmp16i 6, high_adjust_sdarel@sdarel@ha
5151
5252 e_cmpl16i 1, low@l
5353 e_cmpl16i 2, high@h
5454 e_cmpl16i 3, high_adjust@ha
5555 e_cmpl16i 4, low_sdarel@sdarel@l
5656 e_cmpl16i 5, high_sdarel@sdarel@h
57- e_cmpl16i 2, high_adjust_sdarel@sdarel@ha
57+ e_cmpl16i 6, high_adjust_sdarel@sdarel@ha
5858
5959 e_cmph16i 1, low@l
6060 e_cmph16i 2, high@h
6161 e_cmph16i 3, high_adjust@ha
6262 e_cmph16i 4, low_sdarel@sdarel@l
6363 e_cmph16i 5, high_sdarel@sdarel@h
64- e_cmph16i 2, high_adjust_sdarel@sdarel@ha
64+ e_cmph16i 6, high_adjust_sdarel@sdarel@ha
6565
6666 e_cmphl16i 1, low@l
6767 e_cmphl16i 2, high@h
6868 e_cmphl16i 3, high_adjust@ha
6969 e_cmphl16i 4, low_sdarel@sdarel@l
7070 e_cmphl16i 5, high_sdarel@sdarel@h
71- e_cmphl16i 2, high_adjust_sdarel@sdarel@ha
71+ e_cmphl16i 6, high_adjust_sdarel@sdarel@ha
7272
7373 e_add2i. 1, low@l
7474 e_add2i. 2, high@h
7575 e_add2i. 3, high_adjust@ha
7676 e_add2i. 4, low_sdarel@sdarel@l
7777 e_add2i. 5, high_sdarel@sdarel@h
78- e_add2i. 2, high_adjust_sdarel@sdarel@ha
78+ e_add2i. 6, high_adjust_sdarel@sdarel@ha
7979
8080 e_add2is 1, low@l
8181 e_add2is 2, high@h
8282 e_add2is 3, high_adjust@ha
8383 e_add2is 4, low_sdarel@sdarel@l
8484 e_add2is 5, high_sdarel@sdarel@h
85- e_add2is 2, high_adjust_sdarel@sdarel@ha
85+ e_add2is 6, high_adjust_sdarel@sdarel@ha
8686
8787 e_mull2i 1, low@l
8888 e_mull2i 2, high@h
8989 e_mull2i 3, high_adjust@ha
9090 e_mull2i 4, low_sdarel@sdarel@l
9191 e_mull2i 5, high_sdarel@sdarel@h
92- e_mull2i 2, high_adjust_sdarel@sdarel@ha
92+ e_mull2i 6, high_adjust_sdarel@sdarel@ha