Support @PLT loads on 32bit x86.
authorJoerg Sonnenberger <joerg@bec.de>
Thu, 15 Jan 2015 17:59:02 +0000 (17:59 +0000)
committerJoerg Sonnenberger <joerg@bec.de>
Thu, 15 Jan 2015 17:59:02 +0000 (17:59 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226182 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp
test/MC/ELF/relocation-386.s

index be6a8e4a43ebc6c0797bef06bf930350cb404515..e8b0b4c5826f52f77b0d60113b7d7bbffc1c7d46 100644 (file)
@@ -222,6 +222,9 @@ unsigned X86ELFObjectWriter::GetRelocType(const MCValue &Target,
         case MCSymbolRefExpr::VK_GOT:
           Type = ELF::R_386_GOT32;
           break;
+        case MCSymbolRefExpr::VK_PLT:
+          Type = ELF::R_386_PLT32;
+          break;
         case MCSymbolRefExpr::VK_GOTOFF:
           Type = ELF::R_386_GOTOFF;
           break;
index ba12df0d3b63f94d8ab5917462d16176c635675c..83c524b9d07bbec7eddac3fb525368f4f7ec57d5 100644 (file)
@@ -63,6 +63,8 @@
 // Relocation 28 (und_symbol-bar2) is of type R_386_PC8
 // CHECK-NEXT:     0xA0         R_386_PC8        und_symbol 0x0
 // CHECK-NEXT:     0xA3         R_386_GOTOFF     und_symbol 0x0
+// Relocation 29 (zed@PLT) is of type R_386_PLT32 and uses the symbol
+// CHECK-NEXT:     0xA9         R_386_PLT32      zed 0x0
 // CHECK-NEXT:   }
 // CHECK-NEXT: ]
 
@@ -129,6 +131,7 @@ bar2:
         .byte und_symbol-bar2
 
         leal 1 + und_symbol@GOTOFF, %edi
+        movl zed@PLT(%eax), %eax
 
         .section        zedsec,"awT",@progbits
 zed: