3 # Check addend adjustment in case of generating a relocatable object
4 # if some input files have non-zero GP0 value.
6 # We have to use GNU as and ld.bfd 2.28 to generate relocatable object
7 # files with non-zero GP0 value using the following command lines:
9 # as -mips32 -o test.o \
10 # && ld.bfd -m elf32btsmip -r test.o -o mips-gp0-non-zero.o
11 # as -mips64 -o test.o \
12 # && ld.bfd -m elf64btsmip -r test.o -o mips-n64-gp0-non-zero.o
14 # Source code for mips-gp0-non-zero.o:
18 # lw $t0,%call16(__start)($gp)
24 # .section .rodata, "a"
29 # Source code for mips-n64-gp0-non-zero.o and mips-micro-gp0-non-zero.o:
34 # lui $gp,%hi(%neg(%gp_rel(foo)))
36 # RUN: ld.lld -r -o %t-32.r %S/Inputs/mips-gp0-non-zero.o
37 # RUN: llvm-readobj -A %t-32.r | FileCheck --check-prefix=GPVAL %s
38 # RUN: llvm-objdump -s %t-32.r | FileCheck --check-prefix=ADDEND32 %s
40 # RUN: ld.lld -r -o %t-64.r %S/Inputs/mips-n64-gp0-non-zero.o
41 # RUN: llvm-readobj -A %t-64.r | FileCheck --check-prefix=GPVAL %s
42 # RUN: llvm-readobj -r %S/Inputs/mips-n64-gp0-non-zero.o %t-64.r \
43 # RUN: | FileCheck --check-prefix=ADDEND64 %s
47 # ADDEND32: Contents of section .rodata:
48 # ADDEND32-NEXT: 0000 00007ff4 00007ff8
51 # ADDEND64: File: {{.*}}{{/|\\}}mips-n64-gp0-non-zero.o
52 # ADDEND64: .text 0xFFFFFFFFFFFF8011
53 # ADDEND64: File: {{.*}}{{/|\\}}mips-non-zero-gp0.s.tmp-64.r