File: ELF_i386_small_pic_relocations_plt.s

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-19
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,999,616 kB
  • sloc: cpp: 6,951,724; ansic: 1,486,157; asm: 913,598; python: 232,059; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,079; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,430; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (38 lines) | stat: -rw-r--r-- 1,515 bytes parent folder | download | duplicates (9)
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
# 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_plt.o %s
# RUN: llvm-jitlink -noexec \
# RUN:     -slab-allocate 100Kb -slab-address 0xfff00000 -slab-page-size 4096 \
# RUN:     -abs external_func=0xffff0010 \
# RUN:     -check %s %t/elf_sm_pic_reloc_plt.o
#
# Test ELF small/PIC PLT relocations.

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

# Check R_386_PLT32 handling with a call to an external function via PLT. 
# This produces a Branch32 edge that is resolved like a regular PCRel32 
# (no PLT entry created).
# 
# NOTE - For ELF/i386 we always optimize away the PLT calls as the 
# displacement between the target address and the edge address always 
# fits in an int32_t. Regardless, we always create the PLT stub and GOT entry
# for position independent code, first, as there may be future use-cases
# where we would want to disable the optimization.
# 
# jitlink-check: decode_operand(test_call_extern_plt, 0) = external_func - next_pc(test_call_extern_plt)
# jitlink-check: *{4}(got_addr(elf_sm_pic_reloc_plt.o, external_func))= external_func
        .globl  test_call_extern_plt
        .p2align       4, 0x90
        .type   test_call_extern_plt,@function
test_call_extern_plt:
        call   external_func@plt

        .size   test_call_extern_plt, .-test_call_extern_plt