File: ELF_i386_small_pic_relocations.s

package info (click to toggle)
llvm-toolchain-16 1%3A16.0.6-15~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,634,792 kB
  • sloc: cpp: 6,179,261; ansic: 1,216,205; asm: 741,319; python: 196,614; objc: 75,325; f90: 49,640; lisp: 32,396; pascal: 12,286; sh: 9,394; perl: 7,442; ml: 5,494; awk: 3,523; makefile: 2,723; javascript: 1,206; xml: 886; fortran: 581; cs: 573
file content (68 lines) | stat: -rw-r--r-- 1,933 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# RUN: rm -rf %t && mkdir -p %t
# RUN: llvm-mc -triple=i386-unknown-linux-gnu -position-independent \
# RUN:  -filetype=obj -o %t/elf_sm_pic_reloc.o %s
# RUN: llvm-jitlink -noexec \
# RUN:     -slab-allocate 100Kb -slab-address 0xfff00000 -slab-page-size 4096 \
# RUN:     -check %s %t/elf_sm_pic_reloc.o
#
# Test ELF small/PIC relocations.

        .text
        .globl  main
        .p2align        4, 0x90
        .type   main,@function
main:
        ret
        .size   main, .-main


# Test GOT32 handling.
# 
# We want to check both the offset to the GOT entry and its contents. 
# jitlink-check: decode_operand(test_got, 4) = got_addr(elf_sm_pic_reloc.o, named_data1) - _GLOBAL_OFFSET_TABLE_
# jitlink-check: *{4}(got_addr(elf_sm_pic_reloc.o, named_data1)) = named_data1
# 
# jitlink-check: decode_operand(test_got+6, 4) = got_addr(elf_sm_pic_reloc.o, named_data2) - _GLOBAL_OFFSET_TABLE_
# jitlink-check: *{4}(got_addr(elf_sm_pic_reloc.o, named_data2)) = named_data2

        .globl test_got
        .p2align      4, 0x90
        .type   test_got,@function
test_got:
	leal    named_data1@GOT, %eax
        leal    named_data2@GOT, %eax
        .size   test_got, .-test_got



# Test GOTOFF64 handling.
# jitlink-check: decode_operand(test_gotoff, 1) = named_func - _GLOBAL_OFFSET_TABLE_
        .globl test_gotoff
        .p2align     4, 0x90
        .type  test_gotoff,@function
test_gotoff:
        mov $named_func@GOTOFF, %eax
        .size   test_gotoff, .-test_gotoff


        .globl  named_func
        .p2align       4, 0x90
        .type   named_func,@function
named_func:
        xor    %eax, %eax
        .size   named_func, .-named_func


        .data

        .type   named_data1,@object
        .p2align        3
named_data1:
        .quad   42
        .size   named_data1, 8
        
        .type   named_data2,@object
        .p2align        3
named_data2:
        .quad   42
        .size   named_data2, 8