[lld] r248071 - [elf2] Improve relocation-undefined-weak.s test.

Michael J. Spencer via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 18 17:15:38 PDT 2015


Author: mspencer
Date: Fri Sep 18 19:15:38 2015
New Revision: 248071

URL: http://llvm.org/viewvc/llvm-project?rev=248071&view=rev
Log:
[elf2] Improve relocation-undefined-weak.s test.

Modified:
    lld/trunk/test/elf2/relocation-undefined-weak.s

Modified: lld/trunk/test/elf2/relocation-undefined-weak.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/relocation-undefined-weak.s?rev=248071&r1=248070&r2=248071&view=diff
==============================================================================
--- lld/trunk/test/elf2/relocation-undefined-weak.s (original)
+++ lld/trunk/test/elf2/relocation-undefined-weak.s Fri Sep 18 19:15:38 2015
@@ -1,12 +1,27 @@
 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
 // RUN: lld -flavor gnu2 %t -o %tout
-// RUN: llvm-objdump -d %tout | FileCheck %s
+// RUN: llvm-readobj -sections %tout | FileCheck %s
+// RUN: llvm-objdump -d %tout | FileCheck %s --check-prefix DISASM
 // REQUIRES: x86
 
+// Check that undefined weak symbols are treated as having a VA of 0.
+
 .global _start
 _start:
   movl $1, sym1(%rip)
 
 .weak sym1
 
-// CHECK: movl    $1, -69642(%rip)
+// CHECK:      Name: .text
+// CHECK-NEXT: Type: SHT_PROGBITS
+// CHECK-NEXT: Flags [
+// CHECK-NEXT:   SHF_ALLOC
+// CHECK-NEXT:   SHF_EXECINSTR
+// CHECK-NEXT: ]
+// CHECK-NEXT: Address: 0x11000
+
+// Unfortunately FileCheck can't do math, so we have to check for explicit
+// values:
+// R_86_64_PC32 = 0 + (-8 - (0x11000 + 2)) = -69642
+
+// DISASM: movl    $1, -69642(%rip)




More information about the llvm-commits mailing list