[llvm-commits] [llvm] r147252 - in /llvm/trunk: include/llvm/MC/MCFixup.h lib/MC/MCAsmBackend.cpp lib/MC/WinCOFFStreamer.cpp lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp lib/Target/X86/MCTargetDesc/X86FixupKinds.h lib/Target/X86/MCTargetDesc/X86WinCOFFObjectWriter.cpp
Rafael Espindola
rafael.espindola at gmail.com
Sat Dec 24 06:47:52 PST 2011
Author: rafael
Date: Sat Dec 24 08:47:52 2011
New Revision: 147252
URL: http://llvm.org/viewvc/llvm-project?rev=147252&view=rev
Log:
Section relative fixups are a coff concept, not a x86 one. Replace the
x86 specific reloc_coff_secrel32 with a generic FK_SecRel_4.
Modified:
llvm/trunk/include/llvm/MC/MCFixup.h
llvm/trunk/lib/MC/MCAsmBackend.cpp
llvm/trunk/lib/MC/WinCOFFStreamer.cpp
llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
llvm/trunk/lib/Target/X86/MCTargetDesc/X86FixupKinds.h
llvm/trunk/lib/Target/X86/MCTargetDesc/X86WinCOFFObjectWriter.cpp
Modified: llvm/trunk/include/llvm/MC/MCFixup.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCFixup.h?rev=147252&r1=147251&r2=147252&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCFixup.h (original)
+++ llvm/trunk/include/llvm/MC/MCFixup.h Sat Dec 24 08:47:52 2011
@@ -30,6 +30,10 @@
FK_GPRel_2, ///< A two-byte gp relative fixup.
FK_GPRel_4, ///< A four-byte gp relative fixup.
FK_GPRel_8, ///< A eight-byte gp relative fixup.
+ FK_SecRel_1, ///< A one-byte section relative fixup.
+ FK_SecRel_2, ///< A two-byte section relative fixup.
+ FK_SecRel_4, ///< A four-byte section relative fixup.
+ FK_SecRel_8, ///< A eight-byte section relative fixup.
FirstTargetFixupKind = 128,
Modified: llvm/trunk/lib/MC/MCAsmBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmBackend.cpp?rev=147252&r1=147251&r2=147252&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAsmBackend.cpp (original)
+++ llvm/trunk/lib/MC/MCAsmBackend.cpp Sat Dec 24 08:47:52 2011
@@ -32,7 +32,11 @@
{ "FK_GPRel_1", 0, 8, 0 },
{ "FK_GPRel_2", 0, 16, 0 },
{ "FK_GPRel_4", 0, 32, 0 },
- { "FK_GPRel_8", 0, 64, 0 }
+ { "FK_GPRel_8", 0, 64, 0 },
+ { "FK_SecRel_1", 0, 8, 0 },
+ { "FK_SecRel_2", 0, 16, 0 },
+ { "FK_SecRel_4", 0, 32, 0 },
+ { "FK_SecRel_8", 0, 64, 0 }
};
assert((size_t)Kind <= sizeof(Builtins) / sizeof(Builtins[0]) &&
Modified: llvm/trunk/lib/MC/WinCOFFStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WinCOFFStreamer.cpp?rev=147252&r1=147251&r2=147252&view=diff
==============================================================================
--- llvm/trunk/lib/MC/WinCOFFStreamer.cpp (original)
+++ llvm/trunk/lib/MC/WinCOFFStreamer.cpp Sat Dec 24 08:47:52 2011
@@ -33,8 +33,6 @@
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/raw_ostream.h"
-#include "../Target/X86/MCTargetDesc/X86FixupKinds.h"
-
using namespace llvm;
namespace {
@@ -303,7 +301,7 @@
DF->addFixup(MCFixup::Create(DF->getContents().size(),
MCSymbolRefExpr::Create (Symbol, getContext ()),
- (MCFixupKind)X86::reloc_coff_secrel32));
+ FK_SecRel_4));
DF->getContents().resize(DF->getContents().size() + 4, 0);
}
Modified: llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp?rev=147252&r1=147251&r2=147252&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp (original)
+++ llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp Sat Dec 24 08:47:52 2011
@@ -39,17 +39,20 @@
switch (Kind) {
default: assert(0 && "invalid fixup kind!");
case FK_PCRel_1:
+ case FK_SecRel_1:
case FK_Data_1: return 0;
case FK_PCRel_2:
+ case FK_SecRel_2:
case FK_Data_2: return 1;
case FK_PCRel_4:
case X86::reloc_riprel_4byte:
case X86::reloc_riprel_4byte_movq_load:
case X86::reloc_signed_4byte:
case X86::reloc_global_offset_table:
- case X86::reloc_coff_secrel32:
+ case FK_SecRel_4:
case FK_Data_4: return 2;
case FK_PCRel_8:
+ case FK_SecRel_8:
case FK_Data_8: return 3;
}
}
@@ -77,8 +80,7 @@
{ "reloc_riprel_4byte", 0, 4 * 8, MCFixupKindInfo::FKF_IsPCRel },
{ "reloc_riprel_4byte_movq_load", 0, 4 * 8, MCFixupKindInfo::FKF_IsPCRel},
{ "reloc_signed_4byte", 0, 4 * 8, 0},
- { "reloc_global_offset_table", 0, 4 * 8, 0},
- { "reloc_coff_secrel32", 0, 4 * 8, 0}
+ { "reloc_global_offset_table", 0, 4 * 8, 0}
};
if (Kind < FirstTargetFixupKind)
Modified: llvm/trunk/lib/Target/X86/MCTargetDesc/X86FixupKinds.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/MCTargetDesc/X86FixupKinds.h?rev=147252&r1=147251&r2=147252&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/MCTargetDesc/X86FixupKinds.h (original)
+++ llvm/trunk/lib/Target/X86/MCTargetDesc/X86FixupKinds.h Sat Dec 24 08:47:52 2011
@@ -23,8 +23,6 @@
reloc_global_offset_table, // 32-bit, relative to the start
// of the instruction. Used only
// for _GLOBAL_OFFSET_TABLE_.
- reloc_coff_secrel32, // PE-COFF section relative 32
- // (only valid for win32 COFF)
// Marker
LastTargetFixupKind,
NumTargetFixupKinds = LastTargetFixupKind - FirstTargetFixupKind
Modified: llvm/trunk/lib/Target/X86/MCTargetDesc/X86WinCOFFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/MCTargetDesc/X86WinCOFFObjectWriter.cpp?rev=147252&r1=147251&r2=147252&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/MCTargetDesc/X86WinCOFFObjectWriter.cpp (original)
+++ llvm/trunk/lib/Target/X86/MCTargetDesc/X86WinCOFFObjectWriter.cpp Sat Dec 24 08:47:52 2011
@@ -55,7 +55,7 @@
else
llvm_unreachable("unsupported relocation type");
break;
- case X86::reloc_coff_secrel32:
+ case FK_SecRel_4:
return Is64Bit ? COFF::IMAGE_REL_AMD64_SREL32 : COFF::IMAGE_REL_I386_SECREL;
break;
default:
More information about the llvm-commits
mailing list