]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Add R_AARCH64_P32_MOVW_PREL_* ELF32 relocs
authorSzabolcs Nagy <szabolcs.nagy@arm.com>
Wed, 28 Nov 2018 19:35:04 +0000 (19:35 +0000)
committerSzabolcs Nagy <szabolcs.nagy@arm.com>
Fri, 14 Jun 2019 11:02:19 +0000 (12:02 +0100)
These ilp32 relocations were missing for some reason.

bfd/ChangeLog:

* elfnn-aarch64.c: Enable MOVW_PREL relocs for ELF32.

include/ChangeLog:

* elf/aarch64.h (R_AARCH64_P32_MOVW_PREL_G0): Define.
(R_AARCH64_P32_MOVW_PREL_G0_NC): Define.
(R_AARCH64_P32_MOVW_PREL_G1): Define.

ld/ChangeLog:

* testsuite/ld-aarch64/aarch64-elf.exp: Add emit-relocs-22 and -23.
* testsuite/ld-aarch64/emit-relocs-22.d: New test.
* testsuite/ld-aarch64/emit-relocs-22.s: New test.
* testsuite/ld-aarch64/emit-relocs-23.d: New test.
* testsuite/ld-aarch64/emit-relocs-23.s: New test.

bfd/ChangeLog
bfd/elfnn-aarch64.c
include/ChangeLog
include/elf/aarch64.h
ld/ChangeLog
ld/testsuite/ld-aarch64/aarch64-elf.exp
ld/testsuite/ld-aarch64/emit-relocs-22.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/emit-relocs-22.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/emit-relocs-23.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/emit-relocs-23.s [new file with mode: 0644]

index d6a213160417dc872b2956456f4a45eea09b827d..fa07d3e11c6d834541a6bcf4dab588e52ae2b827 100644 (file)
@@ -1,3 +1,7 @@
+2019-06-14  Szabolcs Nagy  <szabolcs.nagy@arm.com>
+
+       * elfnn-aarch64.c: Enable MOVW_PREL relocs for ELF32.
+
 2019-06-14  Alan Modra  <amodra@gmail.com>
 
        * Makefile.in: Regenerate.
index e33a5c6207f8c8510aba7816fcea2092f043ce9f..ed64e8256c7442e5973e221afe57f9b08c91f44f 100644 (file)
@@ -717,7 +717,7 @@ static reloc_howto_type elfNN_aarch64_howto_table[] =
      PC relative address inline.  */
 
   /* MOV[NZ]:   ((S+A-P) >>  0) & 0xffff */
-  HOWTO64 (AARCH64_R (MOVW_PREL_G0),   /* type */
+  HOWTO (AARCH64_R (MOVW_PREL_G0),     /* type */
         0,                     /* rightshift */
         2,                     /* size (0 = byte, 1 = short, 2 = long) */
         17,                    /* bitsize */
@@ -732,7 +732,7 @@ static reloc_howto_type elfNN_aarch64_howto_table[] =
         TRUE),         /* pcrel_offset */
 
   /* MOVK:   ((S+A-P) >>  0) & 0xffff [no overflow check] */
-  HOWTO64 (AARCH64_R (MOVW_PREL_G0_NC),        /* type */
+  HOWTO (AARCH64_R (MOVW_PREL_G0_NC),  /* type */
         0,                     /* rightshift */
         2,                     /* size (0 = byte, 1 = short, 2 = long) */
         16,                    /* bitsize */
@@ -747,7 +747,7 @@ static reloc_howto_type elfNN_aarch64_howto_table[] =
         TRUE),         /* pcrel_offset */
 
   /* MOV[NZ]:   ((S+A-P) >> 16) & 0xffff */
-  HOWTO64 (AARCH64_R (MOVW_PREL_G1),   /* type */
+  HOWTO (AARCH64_R (MOVW_PREL_G1),     /* type */
         16,                    /* rightshift */
         2,                     /* size (0 = byte, 1 = short, 2 = long) */
         17,                    /* bitsize */
index f84498b590bd3ccd8e3dd72bfe33bad8633b652d..8169b6aae34243aae30988d27235b884e2ebf493 100644 (file)
@@ -1,3 +1,9 @@
+2019-06-14  Szabolcs Nagy  <szabolcs.nagy@arm.com>
+
+       * elf/aarch64.h (R_AARCH64_P32_MOVW_PREL_G0): Define.
+       (R_AARCH64_P32_MOVW_PREL_G0_NC): Define.
+       (R_AARCH64_P32_MOVW_PREL_G1): Define.
+
 2019-06-03  Nick Alcock  <nick.alcock@oracle.com>
 
        * ctf.h (ctf_enum.cte_value): Fix type to int32_t.
index 721378abf864ed98047d75475863d057c713b31e..16abd864231313cd5ac8cceaaa07a65e9ea19c3a 100644 (file)
@@ -128,6 +128,10 @@ RELOC_NUMBER (R_AARCH64_P32_JUMP26, 20)
 /* BL:     ((S+A-P) >> 2) & 0x3ffffff.  */
 RELOC_NUMBER (R_AARCH64_P32_CALL26, 21)
 
+/* Group relocations to create a 16 or 32 bit PC-relative offset inline.  */
+RELOC_NUMBER (R_AARCH64_P32_MOVW_PREL_G0, 22)
+RELOC_NUMBER (R_AARCH64_P32_MOVW_PREL_G0_NC, 23)
+RELOC_NUMBER (R_AARCH64_P32_MOVW_PREL_G1, 24)
 
 RELOC_NUMBER (R_AARCH64_P32_GOT_LD_PREL19, 25)
 RELOC_NUMBER (R_AARCH64_P32_ADR_GOT_PAGE, 26)
index 9f38cc2c153fca1f670ca42c845648502befa0ac..e5c85e101e5e3e322366d2e9ccca86d0b52beb85 100644 (file)
@@ -1,3 +1,11 @@
+2019-06-14  Szabolcs Nagy  <szabolcs.nagy@arm.com>
+
+       * testsuite/ld-aarch64/aarch64-elf.exp: Add emit-relocs-22 and -23.
+       * testsuite/ld-aarch64/emit-relocs-22.d: New test.
+       * testsuite/ld-aarch64/emit-relocs-22.s: New test.
+       * testsuite/ld-aarch64/emit-relocs-23.d: New test.
+       * testsuite/ld-aarch64/emit-relocs-23.s: New test.
+
 2019-06-14  Alan Modra  <amodra@gmail.com>
 
        * Makefile.in: Regenerate.
index d0a588c5f92158f4fa39ed0078c6abd1bd699a4d..ab8d15271c9a767782ec0145c1a036399ea791bf 100644 (file)
@@ -96,6 +96,8 @@ run_dump_test "erratum843419-no-args"
 
 # Relocation Tests
 run_dump_test_lp64 "weak-undefined"
+run_dump_test "emit-relocs-22"
+run_dump_test "emit-relocs-23"
 run_dump_test "emit-relocs-28"
 run_dump_test "emit-relocs-86"
 run_dump_test "emit-relocs-86-overflow"
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-22.d b/ld/testsuite/ld-aarch64/emit-relocs-22.d
new file mode 100644 (file)
index 0000000..b1e69e0
--- /dev/null
@@ -0,0 +1,15 @@
+#source: emit-relocs-22.s
+#as: -mabi=ilp32
+#ld: -m [aarch64_choose_ilp32_emul] -T relocs-ilp32.ld --defsym foo1=0x12345 --defsym foo2=0x1234 -e0 --emit-relocs
+#objdump: -dr
+
+.*: +file format .*
+
+
+Disassembly of section \.text:
+
+.* <\.text>:
+ +10000:       528468ad        mov     w13, #0x2345                    // #9029
+       +10000: R_AARCH64_P32_MOVW_PREL_G0      foo1
+ +10004:       129db9f1        mov     w17, #0xffff1230                // #-60880
+       +10004: R_AARCH64_P32_MOVW_PREL_G0      foo2
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-22.s b/ld/testsuite/ld-aarch64/emit-relocs-22.s
new file mode 100644 (file)
index 0000000..1b7870b
--- /dev/null
@@ -0,0 +1,3 @@
+.text
+       movz w13, :prel_g0:foo1
+       movz w17, :prel_g0:foo2
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-23.d b/ld/testsuite/ld-aarch64/emit-relocs-23.d
new file mode 100644 (file)
index 0000000..abb939d
--- /dev/null
@@ -0,0 +1,15 @@
+#source: emit-relocs-23.s
+#as: -mabi=ilp32
+#ld: -m [aarch64_choose_ilp32_emul] -T relocs-ilp32.ld --defsym foo=0x12345678 -e0 --emit-relocs
+#objdump: -dr
+
+.*: +file format .*
+
+
+Disassembly of section \.text:
+
+.* <\.text>:
+ +10000:       728acf0d        movk    w13, #0x5678
+       +10000: R_AARCH64_P32_MOVW_PREL_G0_NC   foo
+ +10004:       52a24671        mov     w17, #0x12330000                // #305332224
+       +10004: R_AARCH64_P32_MOVW_PREL_G1      foo
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-23.s b/ld/testsuite/ld-aarch64/emit-relocs-23.s
new file mode 100644 (file)
index 0000000..f9c5869
--- /dev/null
@@ -0,0 +1,3 @@
+.text
+       movk w13, :prel_g0_nc:foo
+       movz w17, :prel_g1:foo