1# REQUIRES: x86, zlib 2# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o 3# RUN: ld.lld -r -o %t %t.o %t.o 4# RUN: llvm-readelf -r -x .data -x .bar -x .debug_line %t | FileCheck --check-prefix=RELA %s 5 6# RELA: Offset Info Type Symbol's Value Symbol's Name + Addend 7# RELA-NEXT: 0000000000000000 {{.*}} R_X86_64_32 0000000000000000 .text + 1 8# RELA-NEXT: 0000000000000004 {{.*}} R_X86_64_32 0000000000000000 .text + 5 9# RELA-EMPTY: 10# RELA: Offset Info Type Symbol's Value Symbol's Name + Addend 11# RELA-NEXT: 0000000000000000 {{.*}} R_X86_64_64 0000000000000000 .foo + 1 12# RELA-NEXT: 0000000000000008 {{.*}} R_X86_64_32 0000000000000000 .text + 0 13# RELA-NEXT: 000000000000000c {{.*}} R_X86_64_64 0000000000000000 .foo + 2 14# RELA-NEXT: 0000000000000014 {{.*}} R_X86_64_32 0000000000000000 .text + 4 15# RELA-EMPTY: 16# RELA: Offset Info Type Symbol's Value Symbol's Name + Addend 17# RELA-NEXT: 0000000000000000 {{.*}} R_X86_64_64 0000000000000000 .foo + 1 18# RELA-NEXT: 0000000000000008 {{.*}} R_X86_64_32 0000000000000000 .text + 0 19# RELA-NEXT: 000000000000000c {{.*}} R_X86_64_64 0000000000000000 .foo + 2 20# RELA-NEXT: 0000000000000014 {{.*}} R_X86_64_32 0000000000000000 .text + 4 21 22# RELA: Hex dump of section '.data': 23# RELA-NEXT: 0x00000000 00000000 00000000 ........ 24# RELA: Hex dump of section '.bar': 25# RELA-NEXT: 0x00000000 00000000 00000000 00000000 00000000 ................ 26# RELA-NEXT: 0x00000010 00000000 00000000 ........ 27# RELA: Hex dump of section '.debug_line': 28# RELA-NEXT: 0x00000000 00000000 00000000 00000000 00000000 ................ 29# RELA-NEXT: 0x00000010 00000000 00000000 ........ 30 31# RUN: llvm-mc -filetype=obj -triple=i686 %s -o %t1.o 32# RUN: ld.lld -r -o %t1 %t1.o %t1.o 33# RUN: llvm-readelf -r -x .data -x .bar -x .debug_line %t1 | FileCheck %s --check-prefix=REL 34## https://github.com/llvm/llvm-project/issues/66738 Update implicit addends for -r and --compress-debug-sections 35# RUN: ld.lld -r --compress-debug-sections=zlib -o %t1.zlib %t1.o %t1.o 36# RUN: llvm-objcopy --decompress-debug-sections %t1.zlib %t1.zlib.de 37# RUN: llvm-readelf -r -x .data -x .bar -x .debug_line %t1.zlib.de | FileCheck %s --check-prefix=REL 38 39# REL: Offset Info Type Sym. Value Symbol's Name 40# REL-NEXT: 00000000 {{.*}} R_386_32 00000000 .text 41# REL-NEXT: 00000004 {{.*}} R_386_32 00000000 .text 42# REL-EMPTY: 43# REL: Offset Info Type Sym. Value Symbol's Name 44# REL-NEXT: 00000000 {{.*}} R_386_32 00000000 .foo 45# REL-NEXT: 00000004 {{.*}} R_386_32 00000000 .text 46# REL-NEXT: 00000008 {{.*}} R_386_32 00000000 .foo 47# REL-NEXT: 0000000c {{.*}} R_386_32 00000000 .text 48# REL-EMPTY: 49# REL: Offset Info Type Sym. Value Symbol's Name 50# REL-NEXT: 00000000 {{.*}} R_386_32 00000000 .foo 51# REL-NEXT: 00000004 {{.*}} R_386_32 00000000 .text 52# REL-NEXT: 00000008 {{.*}} R_386_32 00000000 .foo 53# REL-NEXT: 0000000c {{.*}} R_386_32 00000000 .text 54 55# REL: Hex dump of section '.data': 56# REL-NEXT: 0x00000000 01000000 05000000 ........ 57# REL: Hex dump of section '.bar': 58# REL-NEXT: 0x00000000 01000000 00000000 02000000 04000000 ................ 59# REL: Hex dump of section '.debug_line': 60# REL-NEXT: 0x00000000 01000000 00000000 02000000 04000000 ................ 61 62.long 42 63.data 64.long .text + 1 65 66.section .foo 67.byte 0 68 69.section .bar 70.dc.a .foo + 1 71.dc.l .text 72 73.section .debug_line 74.dc.a .foo + 1 75.dc.l .text 76