[memprof] Remove an unused using directive (#117004)
[llvm-project.git] / lld / test / ELF / got32x-i386.s
blob3b19de9c98a05f595b69910981701a5b6e204855
1 # REQUIRES: x86
3 ## i386-got32x-baseless.elf is a file produced using GNU as v.2.27
4 ## using following code and command line:
5 ## (as --32 -o base.o base.s)
6 ##
7 ## .text
8 ## .globl foo
9 ## .type foo, @function
10 ## foo:
11 ## nop
13 ## _start:
14 ## movl foo@GOT, %eax
15 ## movl foo@GOT, %ebx
16 ## movl foo@GOT(%eax), %eax
17 ## movl foo@GOT(%ebx), %eax
19 ## Result file contains four R_386_GOT32X relocations. Generated code
20 ## is also a four mov instructions. And first two has no base register:
21 ## <_start>:
22 ## 1: 8b 05 00 00 00 00 mov 0x0,%eax
23 ## 7: 8b 1d 00 00 00 00 mov 0x0,%ebx
24 ## d: 8b 80 00 00 00 00 mov 0x0(%eax),%eax
25 ## 13: 8b 83 00 00 00 00 mov 0x0(%ebx),%eax
27 ## R_386_GOT32X is computed as G + A - GOT, but if it used without base
28 ## register, it should be calculated as G + A. Using without base register
29 ## is only allowed for non-PIC code.
31 # RUN: ld.lld %S/Inputs/i386-got32x-baseless.elf -o %t1
32 # RUN: llvm-objdump --no-print-imm-hex --section-headers -d %t1 | FileCheck %s
34 ## 73728 == 0x12000 == ADDR(.got)
35 # CHECK: Sections:
36 # CHECK: Name Size VMA
37 # CHECK: .got.plt 0000000c 00403134
38 # CHECK: <_start>:
39 # CHECK-NEXT: 401115: 8b 05 {{.*}} movl 4202800, %eax
40 # CHECK-NEXT: 40111b: 8b 1d {{.*}} movl 4202800, %ebx
41 # CHECK-NEXT: 401121: 8b 80 {{.*}} movl -4100(%eax), %eax
42 # CHECK-NEXT: 401127: 8b 83 {{.*}} movl -4100(%ebx), %eax
44 # RUN: not ld.lld %S/Inputs/i386-got32x-baseless.elf -o /dev/null -pie 2>&1 | \
45 # RUN: FileCheck %s --check-prefix=ERR
46 # ERR-COUNT-2: error: relocation R_386_GOT32X cannot be used against symbol 'foo'; recompile with -fPIC