#undef CAP_MAX_EXPONENT
}
-#define ONES(x) ((1ULL << ((x) + 1)) - 1)
+#define ONES(x) ((1ULL << (x)) - 1)
#define ALIGN_UP(x, a) (((x) + ONES (a)) & (~ONES (a)))
static bfd_boolean
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 "emit-relocs-morello-4"
+run_dump_test_lp64 "emit-relocs-morello-5"
run_dump_test_lp64 "morello-capinit"
run_dump_test_lp64 "morello-stubs"
--- /dev/null
+#source: emit-relocs-morello-4.s
+#as: -march=morello+c64
+#ld: -static
+#readelf: --relocs --syms
+
+
+#...
+Relocation section[^\n]*contains 1 entry:
+#...
+Symbol table[^\n]*contains[^\n]*:
+ Num: Value Size.*
+#...
+ [0-9]+: [0-9a-f]+0 64016 [^\n]* bigarray
+#pass
--- /dev/null
+// Checking that having a relocation against very large arrays that are not
+// problematic w.r.t. capability bounds representation do not error.
+// The below is somthing that requires being padded
+.bss
+.globl bigarray
+.p2align 4
+bigarray:
+ .zero 64004
+ .zero 12 // Tail padding to ensure precise bounds.
+ .size bigarray, 64016
+
+.text
+.globl _start
+.type _start STT_FUNC
+_start:
+ adrp c0, :got:bigarray
+ ldr c0, [c0, #:got_lo12:bigarray]
--- /dev/null
+#source: emit-relocs-morello-5.s
+#as: -march=morello+c64
+#ld: -static
+#error: .*: capability range may exceed object bounds
+#error: .*: in function `_start':.*
+#error: .*: dangerous relocation: unsupported relocation
--- /dev/null
+// Checking that having a relocation against very large arrays whose size can
+// not be represented gives the corresponding error.
+.bss
+.globl bigarray
+.p2align 4
+bigarray:
+ .zero 64004
+ .size bigarray, 64004
+
+.text
+.globl _start
+.type _start STT_FUNC
+_start:
+ adrp c0, :got:bigarray
+ ldr c0, [c0, #:got_lo12:bigarray]
#...
1 .text_sec 00020004 ...........20000 [0-9a-f]+ [0-9a-f]+ 2\*\*17
CONTENTS, ALLOC, LOAD, READONLY, CODE
- 2 \..* [0-9a-f]+ ...........40080 [0-9a-f]+ [0-9a-f]+ .*
+ 2 \..* [0-9a-f]+ ...........40040 [0-9a-f]+ [0-9a-f]+ .*
#pass