[llvm-commits] [llvm] r116744 - in /llvm/trunk: lib/MC/ELFObjectWriter.cpp test/MC/ELF/relocation-386.s

Rafael Espindola rafael.espindola at gmail.com
Mon Oct 18 13:47:21 PDT 2010


Author: rafael
Date: Mon Oct 18 15:47:21 2010
New Revision: 116744

URL: http://llvm.org/viewvc/llvm-project?rev=116744&view=rev
Log:
Implement R_386_GOT32.

Modified:
    llvm/trunk/lib/MC/ELFObjectWriter.cpp
    llvm/trunk/test/MC/ELF/relocation-386.s

Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=116744&r1=116743&r2=116744&view=diff
==============================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Mon Oct 18 15:47:21 2010
@@ -706,6 +706,9 @@
         switch (Modifier) {
         default:
           llvm_unreachable("Unimplemented");
+        case MCSymbolRefExpr::VK_GOT:
+          Type = ELF::R_386_GOT32;
+          break;
         case MCSymbolRefExpr::VK_GOTOFF:
           Type = ELF::R_386_GOTOFF;
           break;

Modified: llvm/trunk/test/MC/ELF/relocation-386.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/relocation-386.s?rev=116744&r1=116743&r2=116744&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/relocation-386.s (original)
+++ llvm/trunk/test/MC/ELF/relocation-386.s Mon Oct 18 15:47:21 2010
@@ -36,13 +36,20 @@
 // CHECK-NEXT:  ('r_type', 10)
 // CHECK-NEXT: ),
 
-// Relocation 3 (bar3 at GOTOFF) is done symbol 6 (bss)
+// Relocation 3 (bar3 at GOTOFF) is done with symbol 6 (bss)
 // CHECK-NEXT:  # Relocation 3
 // CHECK-NEXT: (('r_offset',
 // CHECK-NEXT:  ('r_sym', 6
 // CHECK-NEXT:  ('r_type',
 // CHECK-NEXT: ),
 
+// Relocation 4 (bar2 at GOT) is of type R_386_GOT32
+// CHECK-NEXT:  # Relocation 4
+// CHECK-NEXT: (('r_offset',
+// CHECK-NEXT:  ('r_sym',
+// CHECK-NEXT:  ('r_type', 3
+// CHECK-NEXT: ),
+
         .text
 bar:
 	leal	.Lfoo at GOTOFF(%ebx), %eax
@@ -57,6 +64,8 @@
 	.local	bar3
 	.comm	bar3,1,1
 
+        movl	bar2j at GOT(%eax), %eax
+
         .section	.rodata.str1.16,"aMS", at progbits,1
 .Lfoo:
 	.asciz	 "bool llvm::llvm_start_multithreaded()"





More information about the llvm-commits mailing list