Skip to content

Commit

Permalink
Revert "[JITLink] Add anonymous symbols in LinkGraph for unnamed temp…
Browse files Browse the repository at this point in the history
…orary symbols"

This reverts commit de87238.

Buildbot check error
  • Loading branch information
luxufan committed Jan 22, 2022
1 parent de87238 commit fdb6578
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 45 deletions.
8 changes: 1 addition & 7 deletions llvm/include/llvm/ExecutionEngine/JITLink/riscv.h
Expand Up @@ -79,12 +79,6 @@ enum EdgeKind_riscv : Edge::Kind {
/// Fixup <- (Target - Fixup + Addend)
R_RISCV_CALL,

/// 32 bits PC relative relocation
///
/// Fixup expression:
/// Fixup <- (Target - Fixup + Addend)
R_RISCV_32_PCREL,

/// PC relative GOT offset
///
/// Fixup expression:
Expand Down Expand Up @@ -143,7 +137,7 @@ enum EdgeKind_riscv : Edge::Kind {
///
/// Fixup expression
/// Fixup <- (Target - *{1}Fixup - Addend)
R_RISCV_SUB8,
R_RISCV_SUB8
};

/// Returns a string name for the given riscv edge. For debugging purposes
Expand Down
12 changes: 4 additions & 8 deletions llvm/lib/ExecutionEngine/JITLink/ELFLinkGraphBuilder.h
Expand Up @@ -441,15 +441,11 @@ template <typename ELFT> Error ELFLinkGraphBuilder<ELFT>::graphifySymbols() {
<< "\"\n";
});

// In RISCV, temporary symbols (Used to generate dwarf, eh_frame
// sections...) will appear in object code's symbol table, and LLVM does
// not use names on these temporary symbols (RISCV gnu toolchain uses
// names on these temporary symbols). If the symbol is unnamed, add an
// anonymous symbol.
// Model the section symbols as anonymous symbol.
auto &GSym =
Name->empty()
? G->addAnonymousSymbol(*B, Sym.getValue(), Sym.st_size,
false, false)
Sym.getType() == ELF::STT_SECTION
? G->addAnonymousSymbol(*B, Sym.getValue(), Sym.st_size, false,
false)
: G->addDefinedSymbol(*B, Sym.getValue(), *Name, Sym.st_size, L,
S, Sym.getType() == ELF::STT_FUNC, false);
setGraphSymbol(SymIndex, GSym);
Expand Down
8 changes: 0 additions & 8 deletions llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp
Expand Up @@ -359,12 +359,6 @@ class ELFJITLinker_riscv : public JITLinker<ELFJITLinker_riscv> {
*FixupPtr = static_cast<uint8_t>(Value);
break;
}
case R_RISCV_32_PCREL: {
// FIXME: It seems that R_RISCV_32_PCREL relocation will only appear in debug sections
// like eh_frame section. Currently, because of eh_frame will not be processed in JITLink's RISCV
// backend, test this relocation is difficult, so here report error if needs to fixup this relocation
return make_error<JITLinkError>("Fixup of relocation type R_RISCV_32_PCREL is not supportted");
}
}
return Error::success();
}
Expand Down Expand Up @@ -415,8 +409,6 @@ class ELFLinkGraphBuilder_riscv : public ELFLinkGraphBuilder<ELFT> {
return EdgeKind_riscv::R_RISCV_SUB16;
case ELF::R_RISCV_SUB8:
return EdgeKind_riscv::R_RISCV_SUB8;
case ELF::R_RISCV_32_PCREL:
return EdgeKind_riscv::R_RISCV_32_PCREL;
}

return make_error<JITLinkError>("Unsupported riscv relocation:" +
Expand Down
2 changes: 0 additions & 2 deletions llvm/lib/ExecutionEngine/JITLink/riscv.cpp
Expand Up @@ -38,8 +38,6 @@ const char *getEdgeKindName(Edge::Kind K) {
return "R_RISCV_PCREL_LO12_S";
case R_RISCV_CALL:
return "R_RISCV_CALL";
case R_RISCV_32_PCREL:
return "R_RISCV_32_PCREL";
case R_RISCV_ADD64:
return "R_RISCV_ADD64";
case R_RISCV_ADD32:
Expand Down
20 changes: 0 additions & 20 deletions llvm/test/ExecutionEngine/JITLink/RISCV/anonymous_symbol.s

This file was deleted.

0 comments on commit fdb6578

Please sign in to comment.