[JITLink][i386] Get rid of EdgeKind_i386::None.
R_386_NONE ELF edges should be handled by skipping the relocation, rather than
adding no-op edges to the LinkGraph.
diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/i386.h b/llvm/include/llvm/ExecutionEngine/JITLink/i386.h
index efe8182..629e0d8 100644
--- a/llvm/include/llvm/ExecutionEngine/JITLink/i386.h
+++ b/llvm/include/llvm/ExecutionEngine/JITLink/i386.h
@@ -20,9 +20,6 @@
/// Represets i386 fixups
enum EdgeKind_i386 : Edge::Kind {
- /// None
- None = Edge::FirstRelocation,
-
/// A plain 32-bit pointer value relocation.
///
/// Fixup expression:
@@ -32,7 +29,7 @@
/// - The target must reside in the low 32-bits of the address space,
/// otherwise an out-of-range error will be returned.
///
- Pointer32,
+ Pointer32 = Edge::FirstRelocation,
/// A 32-bit PC-relative relocation.
///
@@ -192,10 +189,6 @@
auto FixupAddress = B.getAddress() + E.getOffset();
switch (E.getKind()) {
- case i386::None: {
- break;
- }
-
case i386::Pointer32: {
uint32_t Value = E.getTarget().getAddress().getValue() + E.getAddend();
*(ulittle32_t *)FixupPtr = Value;
diff --git a/llvm/lib/ExecutionEngine/JITLink/ELF_i386.cpp b/llvm/lib/ExecutionEngine/JITLink/ELF_i386.cpp
index 6e9f6ed..b14b872 100644
--- a/llvm/lib/ExecutionEngine/JITLink/ELF_i386.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/ELF_i386.cpp
@@ -117,8 +117,6 @@
Expected<i386::EdgeKind_i386> getRelocationKind(const uint32_t Type) {
using namespace i386;
switch (Type) {
- case ELF::R_386_NONE:
- return EdgeKind_i386::None;
case ELF::R_386_32:
return EdgeKind_i386::Pointer32;
case ELF::R_386_PC32:
@@ -170,6 +168,12 @@
Block &BlockToFix) {
using Base = ELFLinkGraphBuilder<ELFT>;
+ auto ELFReloc = Rel.getType(false);
+
+ // R_386_NONE is a no-op.
+ if (LLVM_UNLIKELY(ELFReloc == ELF::R_386_NONE))
+ return Error::success();
+
uint32_t SymbolIndex = Rel.getSymbol(false);
auto ObjSymbol = Base::Obj.getRelocationSymbol(Rel, Base::SymTabSec);
if (!ObjSymbol)
@@ -184,7 +188,7 @@
Base::GraphSymbols.size()),
inconvertibleErrorCode());
- Expected<i386::EdgeKind_i386> Kind = getRelocationKind(Rel.getType(false));
+ Expected<i386::EdgeKind_i386> Kind = getRelocationKind(ELFReloc);
if (!Kind)
return Kind.takeError();
@@ -192,8 +196,6 @@
int64_t Addend = 0;
switch (*Kind) {
- case i386::EdgeKind_i386::None:
- break;
case i386::EdgeKind_i386::Pointer32:
case i386::EdgeKind_i386::PCRel32:
case i386::EdgeKind_i386::RequestGOTAndTransformToDelta32FromGOT:
diff --git a/llvm/lib/ExecutionEngine/JITLink/i386.cpp b/llvm/lib/ExecutionEngine/JITLink/i386.cpp
index e984bb1..f714716 100644
--- a/llvm/lib/ExecutionEngine/JITLink/i386.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/i386.cpp
@@ -18,8 +18,6 @@
const char *getEdgeKindName(Edge::Kind K) {
switch (K) {
- case None:
- return "None";
case Pointer32:
return "Pointer32";
case PCRel32: