summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2010-11-11 16:48:11 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2010-11-11 16:48:11 +0000
commit03f1b74aed795110f040b7588c8921c5de4bf1ea (patch)
tree606796e930946576ef55947018695e1c0bf7fc0b /test
parent17e8078ae14ed71f657d59c77efa3bedf171161a (diff)
downloadllvm-03f1b74aed795110f040b7588c8921c5de4bf1ea.tar.gz
llvm-03f1b74aed795110f040b7588c8921c5de4bf1ea.tar.bz2
llvm-03f1b74aed795110f040b7588c8921c5de4bf1ea.tar.xz
Fix the symbol index of weak references. Also make RecordRelocation a bit
easier to read by having const references to the symbol, aliased symbol and renamed symbol. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118793 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/MC/ELF/weakref-reloc.s49
1 files changed, 49 insertions, 0 deletions
diff --git a/test/MC/ELF/weakref-reloc.s b/test/MC/ELF/weakref-reloc.s
new file mode 100644
index 0000000000..580d754bc6
--- /dev/null
+++ b/test/MC/ELF/weakref-reloc.s
@@ -0,0 +1,49 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+// Test that the relocations point to the correct symbols. We used to get the
+// symbol index wrong for weakrefs when creating _GLOBAL_OFFSET_TABLE_.
+
+ .weakref bar,foo
+ call zed@PLT
+ call bar
+
+// CHECK: # Symbol 0x00000004
+// CHECK-NEXT: (('st_name', 0x00000009) # '_GLOBAL_OFFSET_TABLE_'
+// CHECK-NEXT: ('st_bind', 0x00000001)
+// CHECK-NEXT: ('st_type', 0x00000000)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000000)
+// CHECK-NEXT: ('st_value', 0x00000000)
+// CHECK-NEXT: ('st_size', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x00000005
+// CHECK-NEXT: (('st_name', 0x00000001) # 'foo'
+// CHECK-NEXT: ('st_bind', 0x00000002)
+// CHECK-NEXT: ('st_type', 0x00000000)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000000)
+// CHECK-NEXT: ('st_value', 0x00000000)
+// CHECK-NEXT: ('st_size', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x00000006
+// CHECK-NEXT: (('st_name', 0x00000005) # 'zed'
+// CHECK-NEXT: ('st_bind', 0x00000001)
+// CHECK-NEXT: ('st_type', 0x00000000)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000000)
+// CHECK-NEXT: ('st_value', 0x00000000)
+// CHECK-NEXT: ('st_size', 0x00000000)
+// CHECK-NEXT: ),
+
+// CHECK: # Relocation 0x00000000
+// CHECK-NEXT: (('r_offset', 0x00000001)
+// CHECK-NEXT: ('r_sym', 0x00000006)
+// CHECK-NEXT: ('r_type', 0x00000004)
+// CHECK-NEXT: ('r_addend', 0xfffffffc)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000001
+// CHECK-NEXT: (('r_offset', 0x00000006)
+// CHECK-NEXT: ('r_sym', 0x00000005)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0xfffffffc)
+// CHECK-NEXT: ),