aboutsummaryrefslogtreecommitdiffstats
path: root/test/MC/ELF/rename.s
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2010-10-28 19:08:03 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2010-10-28 19:08:03 +0000
commit29129728f1d4febe44792d1481077cc47fe83a08 (patch)
tree438d58c99ea41adb171887f6ef0d9415173f23b2 /test/MC/ELF/rename.s
parent57ca3ccd455160e30e727ef53122c82edf3c6b50 (diff)
downloadexternal_llvm-29129728f1d4febe44792d1481077cc47fe83a08.zip
external_llvm-29129728f1d4febe44792d1481077cc47fe83a08.tar.gz
external_llvm-29129728f1d4febe44792d1481077cc47fe83a08.tar.bz2
Fix relocations with renamed symbols.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117575 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/MC/ELF/rename.s')
-rw-r--r--test/MC/ELF/rename.s46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/MC/ELF/rename.s b/test/MC/ELF/rename.s
new file mode 100644
index 0000000..290fff6
--- /dev/null
+++ b/test/MC/ELF/rename.s
@@ -0,0 +1,46 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+// When doing a rename, all the checks for where the relocation should go
+// should be performed with the original symbol. Only if we decide to relocate
+// with the symbol we should then use the renamed one.
+
+// This is a regression test for a bug where we used bar5@@@zed when deciding
+// if we should relocate with the symbol or with the section and we would then
+// not produce a relocation with .text.
+
+defined1:
+defined3:
+ .symver defined3, bar5@@@zed
+ .long defined3
+
+ .global defined1
+
+// Section 1 is .text
+// CHECK: # Section 0x00000001
+// CHECK-NEXT: (('sh_name', 0x00000001) # '.text'
+// CHECK-NEXT: ('sh_type', 0x00000001)
+// CHECK-NEXT: ('sh_flags', 0x00000006)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000040)
+// CHECK-NEXT: ('sh_size', 0x00000004)
+// CHECK-NEXT: ('sh_link', 0x00000000)
+// CHECK-NEXT: ('sh_info', 0x00000000)
+// CHECK-NEXT: ('sh_addralign', 0x00000004)
+// CHECK-NEXT: ('sh_entsize', 0x00000000)
+
+// Symbol 2 is section 1
+// CHECK: # Symbol 0x00000002
+// CHECK-NEXT: (('st_name', 0x00000000) # ''
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000003)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000001)
+// CHECK-NEXT: ('st_value', 0x00000000)
+// CHECK-NEXT: ('st_size', 0x00000000)
+
+// The relocation uses symbol 2
+// CHECK: # Relocation 0x00000000
+// CHECK-NEXT: (('r_offset', 0x00000000)
+// CHECK-NEXT: ('r_sym', 0x00000002)
+// CHECK-NEXT: ('r_type', 0x0000000a)
+// CHECK-NEXT: ('r_addend', 0x00000000)