+2020-10-20 Siddhesh Poyarekar <siddesh.poyarekar@arm.com>
+
+ * testsuite/ld-aarch64/emit-relocs-morello-2-a64c.d: New test.
+ * testsuite/ld-aarch64/emit-relocs-morello-2.d: Likewise.
+ * testsuite/ld-aarch64/emit-relocs-morello-2.s: Likewise.
+ * testsuite/ld-aarch64/emit-relocs-morello-3-a64c.d: Likewise.
+ * testsuite/ld-aarch64/emit-relocs-morello-3.d: Likewise.
+ * testsuite/ld-aarch64/emit-relocs-morello-3.s: Likewise.
+ * testsuite/ld-aarch64/emit-relocs-morello-a64c.d: Likewise.
+ * testsuite/ld-aarch64/emit-relocs-morello.d: Likewise.
+ * testsuite/ld-aarch64/emit-relocs-morello.s: Likewise.
+ * testsuite/ld-aarch64/aarch64-elf.exp: Add new tests.
+
2020-10-20 Siddhesh Poyarekar <siddesh.poyarekar@arm.com>
* testsuite/ld-aarch64/emit-relocs-morello-1.d: New file.
run_dump_test_lp64 "emit-relocs-559"
run_dump_test_lp64 "emit-relocs-560"
run_dump_test_lp64 "emit-relocs-morello-1"
+run_dump_test_lp64 "emit-relocs-morello"
+run_dump_test_lp64 "emit-relocs-morello-a64c"
+run_dump_test_lp64 "emit-relocs-morello-2"
+run_dump_test_lp64 "emit-relocs-morello-2-a64c"
+run_dump_test_lp64 "emit-relocs-morello-3"
+run_dump_test_lp64 "emit-relocs-morello-3-a64c"
run_dump_test_lp64 "morello-capinit"
--- /dev/null
+#source: emit-relocs-morello-2.s
+#as: -march=morello+a64c
+#ld: -shared
+#objdump: -DR -j .text -j .data -j .got
+
+.*: file format .*
+
+
+Disassembly of section .text:
+
+.* <_start>:
+.*: 90000082 adrp x2, [0-9a-f]+ <.*>
+.*: 826...42 ldr c2, \[c2, #[0-9]+\]
+.*: c24...42 ldr c2, \[x2, #[0-9]+\]
+.*: f94...42 ldr x2, \[x2, #[0-9]+\]
+
+Disassembly of section .got:
+
+.* <.got>:
+.*: [0-9a-f]+ .*
+ ...
+ .*: R_MORELLO_GLOB_DAT cap
+
+Disassembly of section .data:
+
+.* <str>:
+.*: 6c6c6548 .*
+.*: 6874206f .*
+.*: 20657265 .*
+.*: 20676962 .*
+.*: 20646162 .*
+.*: 6c726f77 .*
+.*: .*
+ .*: R_AARCH64_RELATIVE \*ABS\*\+.*
+
+.* <ptr>:
+.*: [0-9a-f]+ .*
+ ...
+
+.* <cap>:
+.*: [0-9a-f]+ .*
+ .*: R_MORELLO_RELATIVE \*ABS\*
+.*: 00000000 .*
+.*: 00001b02 .*
+.*: 00000000 .*
--- /dev/null
+#source: emit-relocs-morello-2.s
+#as: -march=morello+c64 --defsym C64MODE=1
+#ld: -shared
+#objdump: -DR -j .text -j .data -j .got
+
+.*: file format .*
+
+
+Disassembly of section .text:
+
+.* <_start>:
+.*: 90800082 adrp c2, [0-9a-f]+ <.*>
+.*: c24...42 ldr c2, \[c2, #[0-9]+\]
+.*: 826...42 ldr c2, \[x2, #[0-9]+\]
+.*: 826...42 ldr x2, \[x2, #[0-9]+\]
+
+Disassembly of section .got:
+
+.* <.got>:
+.*: [0-9a-f]+ .*
+ ...
+ .*: R_MORELLO_GLOB_DAT cap
+
+Disassembly of section .data:
+
+.* <str>:
+.*: 6c6c6548 .*
+.*: 6874206f .*
+.*: 20657265 .*
+.*: 20676962 .*
+.*: 20646162 .*
+.*: 6c726f77 .*
+.*: .*
+ .*: R_AARCH64_RELATIVE \*ABS\*\+.*
+
+.* <ptr>:
+.*: 00010350 .*
+ ...
+
+.* <cap>:
+.*: 00010350 .*
+ .*: R_MORELLO_RELATIVE \*ABS\*
+.*: 00000000 .*
+.*: 00001b02 .*
+.*: 00000000 .*
--- /dev/null
+.data
+str:
+ .string "Hello there big bad world!"
+ .size str,.-str
+ptr:
+ .8byte str
+.align 4
+.globl cap
+cap:
+ .capinit str
+ .8byte 0
+ .8byte 0
+
+.text
+.globl _start
+.type _start STT_FUNC
+_start:
+ adrp c2, :got:cap
+ ldr c2, [c2, :got_lo12:cap]
+ ldr c2, [x2, :got_lo12:cap]
+ ldr x2, [x2, :got_lo12:cap]
--- /dev/null
+#source: emit-relocs-morello-3.s
+#as: -march=morello
+#ld: -shared
+#objdump: -DR -j .text -j .data -j .got
+
+.*: file format .*
+
+
+Disassembly of section .text:
+
+.* <_start>:
+.*: 90000082 adrp x2, [0-9a-f]+ <.*>
+.*: 826...42 ldr c2, \[c2, #[0-9]+\]
+.*: 826...42 ldr c2, \[c2, #[0-9]+\]
+.*: 826...42 ldr c2, \[c2, #[0-9]+\]
+
+Disassembly of section .got:
+
+.* <.got>:
+.*: [0-9a-f]+ .*
+ ...
+ .*: R_MORELLO_GLOB_DAT cap3
+ .*: R_MORELLO_GLOB_DAT cap2
+ .*: R_MORELLO_GLOB_DAT cap
+
+Disassembly of section .data:
+
+.* <str>:
+.*: 6c6c6548 .*
+.*: 6874206f .*
+.*: 20657265 .*
+.*: 20676962 .*
+.*: 20646162 .*
+.*: 6c726f77 .*
+.*: 00002164 .*
+.*: 00000000 .*
+
+.* <cap>:
+.*: [0-9a-f]+ .*
+ .*: R_MORELLO_CAPINIT str
+.*: 00000000 .*
+.*: 00001b02 .*
+.*: 00000000 .*
+
+.* <cap2>:
+ ...
+ .*: R_MORELLO_CAPINIT str2
--- /dev/null
+#source: emit-relocs-morello-3.s
+#as: -march=morello+c64 --defsym C64MODE=1
+#ld: -shared
+#objdump: -DR -j .text -j .data -j .got
+
+.*: file format .*
+
+
+Disassembly of section .text:
+
+.* <_start>:
+.*: 90800082 adrp c2, [0-9a-f]+ <.*>
+.*: c24...42 ldr c2, \[c2, #[0-9]+\]
+.*: c24...42 ldr c2, \[c2, #[0-9]+\]
+.*: c24...42 ldr c2, \[c2, #[0-9]+\]
+
+Disassembly of section .got:
+
+.* <.got>:
+.*: [0-9a-f]+ .*
+ ...
+ .*: R_MORELLO_GLOB_DAT cap3
+ .*: R_MORELLO_GLOB_DAT cap2
+ .*: R_MORELLO_GLOB_DAT cap
+
+Disassembly of section .data:
+
+.* <str>:
+.*: 6c6c6548 .*
+.*: 6874206f .*
+.*: 20657265 .*
+.*: 20676962 .*
+.*: 20646162 .*
+.*: 6c726f77 .*
+.*: 00002164 .*
+.*: 00000000 .*
+
+.* <cap>:
+.*: [0-9a-f]+ .*
+ .*: R_MORELLO_CAPINIT str
+.*: 00000000 .*
+.*: 00001b02 .*
+.*: 00000000 .*
+
+.* <cap2>:
+ ...
+ .*: R_MORELLO_CAPINIT str2
--- /dev/null
+.data
+.globl str
+str:
+ .string "Hello there big bad world!"
+ .size str,.-str
+.align 4
+.globl cap
+cap:
+ .capinit str
+ .8byte 0
+ .8byte 0
+
+.globl cap2
+cap2:
+ .capinit str2
+ .8byte 0
+ .8byte 0
+
+.text
+.globl _start
+.type _start STT_FUNC
+_start:
+ adrp c2, :got:cap
+ ldr c2, [c2, :got_lo12:cap]
+ ldr c2, [c2, :got_lo12:cap2]
+ // An external symbol. The linker should create a R_MORELLO_GLOB_DAT
+ // for this since it is a capability load.
+ ldr c2, [c2, :got_lo12:cap3]
--- /dev/null
+#source: emit-relocs-morello.s
+#as: -march=morello
+#ld: -shared
+#objdump: -DR -j .text -j .data -j .got
+
+.*: file format .*
+
+
+Disassembly of section .text:
+
+.* <_start>:
+.*: 826...42 ldr c2, \[c2, #[0-9]+\]
+.*: c24...42 ldr c2, \[x2, #[0-9]+\]
+.*: f94...42 ldr x2, \[x2, #[0-9]+\]
+.*: b94...42 ldr w2, \[x2, #[0-9]+\]
+
+.* <f1>:
+.*: 826...42 ldr c2, \[c2, #[0-9]+\]
+
+Disassembly of section .got:
+
+.* <.got>:
+.*: [0-9a-f]+ .*
+.*: 00000000 .*
+
+Disassembly of section .data:
+
+.* <num>:
+.*: 00000042 .*
+
+.* <ptr>:
+.*: [0-9a-f]+ .*
+ .*: R_AARCH64_RELATIVE \*ABS\*\+.*
+ ...
+
+.* <cap>:
+.*: [0-9a-f]+ .*
+ .*: R_MORELLO_RELATIVE \*ABS\*
+.*: 00000000 .*
+.*: 00000402 .*
+.*: 00000000 .*
+
+.* <globcap>:
+ ...
+ .*: R_MORELLO_CAPINIT globvar
--- /dev/null
+#source: emit-relocs-morello.s
+#as: -march=morello+c64
+#ld: -shared
+#objdump: -DR -j .text -j .data -j .got
+
+.*: file format .*
+
+
+Disassembly of section .text:
+
+.* <_start>:
+.*: c24...42 ldr c2, \[c2, #[0-9]+\]
+.*: 826...42 ldr c2, \[x2, #[0-9]+\]
+.*: 826...42 ldr x2, \[x2, #[0-9]+\]
+.*: 826...42 ldr w2, \[x2, #[0-9]+\]
+
+.* <f1>:
+.*: c24...42 ldr c2, \[c2, #[0-9]+\]
+
+Disassembly of section .got:
+
+.* <.got>:
+.*: [0-9a-f]+ .*
+.*: 00000000 .*
+
+Disassembly of section .data:
+
+.* <num>:
+.*: 00000042 .*
+
+.* <ptr>:
+.*: [0-9a-f]+ .*
+ .*: R_AARCH64_RELATIVE \*ABS\*\+.*
+ ...
+
+.* <cap>:
+.*: [0-9a-f]+ .*
+ .*: R_MORELLO_RELATIVE \*ABS\*
+.*: 00000000 .*
+.*: 00000402 .*
+.*: 00000000 .*
+
+.* <globcap>:
+ ...
+ .*: R_MORELLO_CAPINIT globvar
--- /dev/null
+.data
+num:
+ .word 0x42
+ .size num, .-num
+ptr:
+ .8byte num
+.align 4
+cap:
+ .capinit num
+ .8byte 0
+ .8byte 0
+
+globcap:
+ .capinit globvar
+ .8byte 0
+ .8byte 0
+
+.text
+.globl _start
+.type _start STT_FUNC
+_start:
+ ldr c2, [c2, :lo12:cap]
+ ldr c2, [x2, :lo12:cap]
+ ldr x2, [x2, :lo12:cap]
+ ldr w2, [x2, :lo12:cap]
+
+// Capability pointing to an undefined variable.
+f1:
+ ldr c2, [c2, :lo12:globcap]