From fba9f749325275c4633c829dbc78c07020b37ed5 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Mon, 18 Oct 2010 20:47:21 +0000 Subject: [PATCH] Implement R_386_GOT32. llvm-svn: 116744 --- llvm/lib/MC/ELFObjectWriter.cpp | 3 +++ llvm/test/MC/ELF/relocation-386.s | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp index b5943ec717b8..adaecc0c025b 100644 --- a/llvm/lib/MC/ELFObjectWriter.cpp +++ b/llvm/lib/MC/ELFObjectWriter.cpp @@ -706,6 +706,9 @@ void ELFObjectWriterImpl::RecordRelocation(const MCAssembler &Asm, 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; diff --git a/llvm/test/MC/ELF/relocation-386.s b/llvm/test/MC/ELF/relocation-386.s index a29db542a8e3..43a9befcecbb 100644 --- a/llvm/test/MC/ELF/relocation-386.s +++ b/llvm/test/MC/ELF/relocation-386.s @@ -36,11 +36,18 @@ // CHECK-NEXT: ('r_type', 10) // CHECK-NEXT: ), -// Relocation 3 (bar3@GOTOFF) is done symbol 6 (bss) +// Relocation 3 (bar3@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@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 @@ -57,6 +64,8 @@ bar2: .local bar3 .comm bar3,1,1 + movl bar2j@GOT(%eax), %eax + .section .rodata.str1.16,"aMS",@progbits,1 .Lfoo: .asciz "bool llvm::llvm_start_multithreaded()"