1 # Checking that the "compatibility hack" around symbols named with _start is
4 # Use known offsets into the GOT. Have ensured that the GOT is 12bit aligned
5 # in the linker script, which means we know that the lo12 relocations should
6 # all have a known value (assuming a constant order of entries into the GOT).
8 # Need this since a large point of this test is to demonstrate that different
9 # symbols with the same address end up having different valued relocations, so
10 # we want to ensure a direct link between the relevant relocations and their
13 # As far as the linker is concerned, each of the symbols defined in our linker
14 # script are associated with the output section just before them. However, we
15 # add a hack for symbols which are named in the pattern __*_start so that their
16 # Morello bounds are given as if the symbol was associated with the section just
19 # Hence the __text_start and __data_other symbols should end up with permissions
20 # for the text section. This should mean that they have PCC bounds, and the
21 # value of the __data_other symbol should include an addend. These are the
22 # symbols used in the first and last LDR instructions in the function.
24 # Meanwhile, the __text_other symbol should have bounds of everything remaining
25 # in the section *before* it (which is nothing), and the __data_start symbol
26 # should have bounds spanning the entire section *after* it (the .data section).
28 #source: emit-relocs-morello-7.s
29 #as: -march=morello+c64
30 #ld: -static -pie -T emit-relocs-morello-7.ld
31 #objdump: -DR --section-headers -j .text -j .got -j .data
36 Idx Name Size VMA LMA File off Algn
38 .* .text 00000010 ([0-9a-f]+) .* .* 2\*\*2
39 CONTENTS, ALLOC, LOAD, READONLY, CODE
41 .* .data 00000004 ([0-9a-f]+) .* .* 2\*\*0
42 CONTENTS, ALLOC, LOAD, DATA
43 .* .got 00000050 0000000000001000 0000000000001000 00001000 2\*\*4
44 CONTENTS, ALLOC, LOAD, DATA
46 #check: TXT_START string tolower $TEXT_START
47 #check: DTA_START string tolower $DATA_START
49 Disassembly of section \.text:
52 .*: c2400400 ldr c0, \[c0, #16\]
53 .*: c2401000 ldr c0, \[c0, #64\]
54 .*: c2400c00 ldr c0, \[c0, #48\]
55 .*: c2400800 ldr c0, \[c0, #32\]
58 Disassembly of section \.data:
63 Disassembly of section \.got:
65 #check: PCC_START aarch64_8digit_addr $TEXT_START
66 #check: DAT_START aarch64_8digit_addr $DATA_START
67 #check: PCC_LENGTH aarch64_8digit_addr [format %x [expr "0x1050 - 0x$TEXT_START"]]
68 0000000000001000 <\.got>:
72 1010: R_MORELLO_RELATIVE \*ABS\*
77 1020: R_MORELLO_RELATIVE \*ABS\*\+0x10
82 1030: R_MORELLO_RELATIVE \*ABS\*
87 1040: R_MORELLO_RELATIVE \*ABS\*