From 91641d9947ad062f431582b2efe0dd4d9d561129 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Tue, 12 Apr 2016 22:08:23 +0000 Subject: [PATCH] Add a few more cases to this test. It now documents how we currently handle relocations for alloc/non-alloc. llvm-svn: 266141 --- lld/test/ELF/relocation-non-alloc.s | 43 ++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/lld/test/ELF/relocation-non-alloc.s b/lld/test/ELF/relocation-non-alloc.s index 4ca4183b9c66..da6041db46a4 100644 --- a/lld/test/ELF/relocation-non-alloc.s +++ b/lld/test/ELF/relocation-non-alloc.s @@ -1,8 +1,25 @@ // REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t -// RUN: ld.lld %t -o %t2 -// RUN: llvm-readobj -s -section-data %t2 | FileCheck %s +// RUN: ld.lld %t -o %t2 -shared +// RUN: llvm-readobj -s -section-data -r %t2 | FileCheck %s + +// CHECK: Name: .text +// CHECK-NEXT: Type: SHT_PROGBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: SHF_EXECINSTR +// CHECK-NEXT: ] +// CHECK-NEXT: Address: 0x1000 +// CHECK-NEXT: Offset: 0x1000 +// CHECK-NEXT: Size: 16 +// CHECK-NEXT: Link: 0 +// CHECK-NEXT: Info: 0 +// CHECK-NEXT: AddressAlignment: 4 +// CHECK-NEXT: EntrySize: 0 +// CHECK-NEXT: SectionData ( +// CHECK-NEXT: 0000: 00100000 00000000 00000000 00000000 +// CHECK-NEXT: ) // CHECK: Name: foo // CHECK-NEXT: Type: SHT_PROGBITS @@ -10,16 +27,28 @@ // CHECK-NEXT: ] // CHECK-NEXT: Address: 0x0 // CHECK-NEXT: Offset: -// CHECK-NEXT: Size: 4 +// CHECK-NEXT: Size: 16 // CHECK-NEXT: Link: 0 // CHECK-NEXT: Info: 0 // CHECK-NEXT: AddressAlignment: 1 // CHECK-NEXT: EntrySize: 0 // CHECK-NEXT: SectionData ( -// CHECK-NEXT: 0000: 00100100 +// CHECK-NEXT: 0000: 00100000 00000000 00000000 00000000 // CHECK-NEXT: ) - .global _start -_start: +// CHECK: Relocations [ +// CHECK-NEXT: Section ({{.}}) .rela.dyn { +// CHECK-NEXT: 0x1000 R_X86_64_RELATIVE - 0x1000 +// CHECK-NEXT: 0x1008 R_X86_64_64 zed 0x0 +// CHECK-NEXT: } +// CHECK-NEXT: ] + + .global zed +zed: +bar: + .quad bar + .quad zed + .section foo - .long _start + .quad bar + .quad zed