<div dir="ltr">Forgot to fix the commit message before pushing the button: the commit being reverted is r218388.</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 24, 2014 at 10:49 AM, Kaelyn Takata <span dir="ltr"><<a href="mailto:rikka@google.com" target="_blank">rikka@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: rikka<br>
Date: Wed Sep 24 12:49:07 2014<br>
New Revision: 218393<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=218393&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=218393&view=rev</a><br>
Log:<br>
Revert "Refactor the RelocVisitor::visit method"<br>
<br>
This reverts commit faac033f7364bb4226e22c8079c221c96af10d02.<br>
<br>
The test depends on all targets to be enabled in llc in order to pass,<br>
and needs to be rewritten/refactored to not have that dependency.<br>
<br>
Removed:<br>
llvm/trunk/test/DebugInfo/processes-relocations.ll<br>
Modified:<br>
llvm/trunk/include/llvm/Object/ELFObjectFile.h<br>
llvm/trunk/include/llvm/Object/RelocVisitor.h<br>
llvm/trunk/lib/DebugInfo/DWARFContext.cpp<br>
<br>
Modified: llvm/trunk/include/llvm/Object/ELFObjectFile.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ELFObjectFile.h?rev=218393&r1=218392&r2=218393&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ELFObjectFile.h?rev=218393&r1=218392&r2=218393&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/Object/ELFObjectFile.h (original)<br>
+++ llvm/trunk/include/llvm/Object/ELFObjectFile.h Wed Sep 24 12:49:07 2014<br>
@@ -925,8 +925,6 @@ unsigned ELFObjectFile<ELFT>::getArch()<br>
default:<br>
report_fatal_error("Invalid ELFCLASS!");<br>
}<br>
- case ELF::EM_PPC:<br>
- return Triple::ppc;<br>
case ELF::EM_PPC64:<br>
return IsLittleEndian ? Triple::ppc64le : Triple::ppc64;<br>
case ELF::EM_S390:<br>
<br>
Modified: llvm/trunk/include/llvm/Object/RelocVisitor.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/RelocVisitor.h?rev=218393&r1=218392&r2=218393&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/RelocVisitor.h?rev=218393&r1=218392&r2=218393&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/Object/RelocVisitor.h (original)<br>
+++ llvm/trunk/include/llvm/Object/RelocVisitor.h Wed Sep 24 12:49:07 2014<br>
@@ -40,18 +40,16 @@ struct RelocToApply {<br>
/// @brief Base class for object file relocation visitors.<br>
class RelocVisitor {<br>
public:<br>
- explicit RelocVisitor(ObjectFile &Obj)<br>
- : ObjToVisit(Obj), HasError(false) {}<br>
+ explicit RelocVisitor(StringRef FileFormat)<br>
+ : FileFormat(FileFormat), HasError(false) {}<br>
<br>
// TODO: Should handle multiple applied relocations via either passing in the<br>
// previously computed value or just count paired relocations as a single<br>
// visit.<br>
RelocToApply visit(uint32_t RelocType, RelocationRef R, uint64_t SecAddr = 0,<br>
uint64_t Value = 0) {<br>
- if (ObjToVisit.getBytesInAddress() == 8) { // 64-bit object file<br>
- switch (ObjToVisit.getArch()) {<br>
- case Triple::x86_64:<br>
- switch (RelocType) {<br>
+ if (FileFormat == "ELF64-x86-64") {<br>
+ switch (RelocType) {<br>
case llvm::ELF::R_X86_64_NONE:<br>
return visitELF_X86_64_NONE(R);<br>
case llvm::ELF::R_X86_64_64:<br>
@@ -65,129 +63,113 @@ public:<br>
default:<br>
HasError = true;<br>
return RelocToApply();<br>
- }<br>
- case Triple::aarch64:<br>
- switch (RelocType) {<br>
- case llvm::ELF::R_AARCH64_ABS32:<br>
- return visitELF_AARCH64_ABS32(R, Value);<br>
- case llvm::ELF::R_AARCH64_ABS64:<br>
- return visitELF_AARCH64_ABS64(R, Value);<br>
- default:<br>
- HasError = true;<br>
- return RelocToApply();<br>
- }<br>
- case Triple::mips64el:<br>
- case Triple::mips64:<br>
- switch (RelocType) {<br>
- case llvm::ELF::R_MIPS_32:<br>
- return visitELF_MIPS_32(R, Value);<br>
- case llvm::ELF::R_MIPS_64:<br>
- return visitELF_MIPS_64(R, Value);<br>
- default:<br>
- HasError = true;<br>
- return RelocToApply();<br>
- }<br>
- case Triple::ppc64le:<br>
- case Triple::ppc64:<br>
- switch (RelocType) {<br>
- case llvm::ELF::R_PPC64_ADDR32:<br>
- return visitELF_PPC64_ADDR32(R, Value);<br>
- case llvm::ELF::R_PPC64_ADDR64:<br>
- return visitELF_PPC64_ADDR64(R, Value);<br>
- default:<br>
- HasError = true;<br>
- return RelocToApply();<br>
- }<br>
- case Triple::systemz:<br>
- switch (RelocType) {<br>
- case llvm::ELF::R_390_32:<br>
- return visitELF_390_32(R, Value);<br>
- case llvm::ELF::R_390_64:<br>
- return visitELF_390_64(R, Value);<br>
- default:<br>
- HasError = true;<br>
- return RelocToApply();<br>
- }<br>
- case Triple::sparcv9:<br>
- switch (RelocType) {<br>
- case llvm::ELF::R_SPARC_32:<br>
- case llvm::ELF::R_SPARC_UA32:<br>
- return visitELF_SPARCV9_32(R, Value);<br>
- case llvm::ELF::R_SPARC_64:<br>
- case llvm::ELF::R_SPARC_UA64:<br>
- return visitELF_SPARCV9_64(R, Value);<br>
- default:<br>
- HasError = true;<br>
- return RelocToApply();<br>
- }<br>
+ }<br>
+ } else if (FileFormat == "ELF32-i386") {<br>
+ switch (RelocType) {<br>
+ case llvm::ELF::R_386_NONE:<br>
+ return visitELF_386_NONE(R);<br>
+ case llvm::ELF::R_386_32:<br>
+ return visitELF_386_32(R, Value);<br>
+ case llvm::ELF::R_386_PC32:<br>
+ return visitELF_386_PC32(R, Value, SecAddr);<br>
default:<br>
HasError = true;<br>
return RelocToApply();<br>
}<br>
- } else if (ObjToVisit.getBytesInAddress() == 4) { // 32-bit object file<br>
- switch (ObjToVisit.getArch()) {<br>
- case Triple::x86:<br>
- switch (RelocType) {<br>
- case llvm::ELF::R_386_NONE:<br>
- return visitELF_386_NONE(R);<br>
- case llvm::ELF::R_386_32:<br>
- return visitELF_386_32(R, Value);<br>
- case llvm::ELF::R_386_PC32:<br>
- return visitELF_386_PC32(R, Value, SecAddr);<br>
- default:<br>
- HasError = true;<br>
- return RelocToApply();<br>
- }<br>
- case Triple::ppc:<br>
- switch (RelocType) {<br>
- case llvm::ELF::R_PPC_ADDR32:<br>
- return visitELF_PPC_ADDR32(R, Value);<br>
- default:<br>
- HasError = true;<br>
- return RelocToApply();<br>
- }<br>
- case Triple::arm:<br>
- case Triple::armeb:<br>
- switch (RelocType) {<br>
- default:<br>
- HasError = true;<br>
- return RelocToApply();<br>
- case llvm::ELF::R_ARM_ABS32:<br>
- return visitELF_ARM_ABS32(R, Value);<br>
- }<br>
- case Triple::hexagon:<br>
- llvm_unreachable("Unimplemented");<br>
- case Triple::mipsel:<br>
- case Triple::mips:<br>
- switch (RelocType) {<br>
- case llvm::ELF::R_MIPS_32:<br>
- return visitELF_MIPS_32(R, Value);<br>
- default:<br>
- HasError = true;<br>
- return RelocToApply();<br>
- }<br>
- case Triple::sparc:<br>
- switch (RelocType) {<br>
- case llvm::ELF::R_SPARC_32:<br>
- case llvm::ELF::R_SPARC_UA32:<br>
- return visitELF_SPARC_32(R, Value);<br>
- default:<br>
- HasError = true;<br>
- return RelocToApply();<br>
- }<br>
+ } else if (FileFormat == "ELF64-ppc64") {<br>
+ switch (RelocType) {<br>
+ case llvm::ELF::R_PPC64_ADDR32:<br>
+ return visitELF_PPC64_ADDR32(R, Value);<br>
+ case llvm::ELF::R_PPC64_ADDR64:<br>
+ return visitELF_PPC64_ADDR64(R, Value);<br>
+ default:<br>
+ HasError = true;<br>
+ return RelocToApply();<br>
+ }<br>
+ } else if (FileFormat == "ELF32-ppc") {<br>
+ switch (RelocType) {<br>
+ case llvm::ELF::R_PPC_ADDR32:<br>
+ return visitELF_PPC_ADDR32(R, Value);<br>
+ default:<br>
+ HasError = true;<br>
+ return RelocToApply();<br>
+ }<br>
+ } else if (FileFormat == "ELF32-mips") {<br>
+ switch (RelocType) {<br>
+ case llvm::ELF::R_MIPS_32:<br>
+ return visitELF_MIPS_32(R, Value);<br>
+ default:<br>
+ HasError = true;<br>
+ return RelocToApply();<br>
+ }<br>
+ } else if (FileFormat == "ELF64-mips") {<br>
+ switch (RelocType) {<br>
+ case llvm::ELF::R_MIPS_32:<br>
+ return visitELF_MIPS_32(R, Value);<br>
+ case llvm::ELF::R_MIPS_64:<br>
+ return visitELF_MIPS_64(R, Value);<br>
+ default:<br>
+ HasError = true;<br>
+ return RelocToApply();<br>
+ }<br>
+ } else if (FileFormat == "ELF64-aarch64") {<br>
+ switch (RelocType) {<br>
+ case llvm::ELF::R_AARCH64_ABS32:<br>
+ return visitELF_AARCH64_ABS32(R, Value);<br>
+ case llvm::ELF::R_AARCH64_ABS64:<br>
+ return visitELF_AARCH64_ABS64(R, Value);<br>
+ default:<br>
+ HasError = true;<br>
+ return RelocToApply();<br>
+ }<br>
+ } else if (FileFormat == "ELF64-s390") {<br>
+ switch (RelocType) {<br>
+ case llvm::ELF::R_390_32:<br>
+ return visitELF_390_32(R, Value);<br>
+ case llvm::ELF::R_390_64:<br>
+ return visitELF_390_64(R, Value);<br>
+ default:<br>
+ HasError = true;<br>
+ return RelocToApply();<br>
+ }<br>
+ } else if (FileFormat == "ELF32-sparc") {<br>
+ switch (RelocType) {<br>
+ case llvm::ELF::R_SPARC_32:<br>
+ case llvm::ELF::R_SPARC_UA32:<br>
+ return visitELF_SPARC_32(R, Value);<br>
+ default:<br>
+ HasError = true;<br>
+ return RelocToApply();<br>
+ }<br>
+ } else if (FileFormat == "ELF64-sparc") {<br>
+ switch (RelocType) {<br>
+ case llvm::ELF::R_SPARC_32:<br>
+ case llvm::ELF::R_SPARC_UA32:<br>
+ return visitELF_SPARCV9_32(R, Value);<br>
+ case llvm::ELF::R_SPARC_64:<br>
+ case llvm::ELF::R_SPARC_UA64:<br>
+ return visitELF_SPARCV9_64(R, Value);<br>
+ default:<br>
+ HasError = true;<br>
+ return RelocToApply();<br>
+ }<br>
+ } else if (FileFormat == "ELF32-arm") {<br>
+ switch (RelocType) {<br>
default:<br>
HasError = true;<br>
return RelocToApply();<br>
+ case llvm::ELF::R_ARM_ABS32:<br>
+ return visitELF_ARM_ABS32(R, Value);<br>
}<br>
- } else {<br>
- report_fatal_error("Invalid word size in object file");<br>
}<br>
+ HasError = true;<br>
+ return RelocToApply();<br>
}<br>
<br>
bool error() { return HasError; }<br>
<br>
private:<br>
- ObjectFile &ObjToVisit;<br>
+ StringRef FileFormat;<br>
bool HasError;<br>
<br>
int64_t getAddend32LE(RelocationRef R) {<br>
<br>
Modified: llvm/trunk/lib/DebugInfo/DWARFContext.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFContext.cpp?rev=218393&r1=218392&r2=218393&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFContext.cpp?rev=218393&r1=218392&r2=218393&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/DebugInfo/DWARFContext.cpp (original)<br>
+++ llvm/trunk/lib/DebugInfo/DWARFContext.cpp Wed Sep 24 12:49:07 2014<br>
@@ -667,7 +667,7 @@ DWARFContextInMemory::DWARFContextInMemo<br>
Sym->getAddress(SymAddr);<br>
}<br>
<br>
- object::RelocVisitor V(Obj);<br>
+ object::RelocVisitor V(Obj.getFileFormatName());<br>
// The section address is always 0 for debug sections.<br>
object::RelocToApply R(V.visit(Type, Reloc, 0, SymAddr));<br>
if (V.error()) {<br>
<br>
Removed: llvm/trunk/test/DebugInfo/processes-relocations.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/processes-relocations.ll?rev=218392&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/processes-relocations.ll?rev=218392&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/DebugInfo/processes-relocations.ll (original)<br>
+++ llvm/trunk/test/DebugInfo/processes-relocations.ll (removed)<br>
@@ -1,26 +0,0 @@<br>
-; Make sure that for each supported architecture in RelocVisitor::visit,<br>
-; the visitor does compute the relocation.<br>
-; RUN: llc -filetype=obj -O0 < %s -mtriple x86_64-none-linux-eabi | llvm-dwarfdump - 2>&1 | FileCheck %s<br>
-; RUN: llc -filetype=obj -O0 < %s -mtriple i386-none-linux-eabi | llvm-dwarfdump - 2>&1 | FileCheck %s<br>
-; RUN: llc -filetype=obj -O0 < %s -mtriple powerpc64-unknown-linux-eabi | llvm-dwarfdump - 2>&1 | FileCheck %s<br>
-; RUN: llc -filetype=obj -O0 < %s -mtriple powerpc-unknown-linux-eabi | llvm-dwarfdump - 2>&1 | FileCheck %s<br>
-; RUN: llc -filetype=obj -O0 < %s -mtriple mips-unknown-linux-eabi | llvm-dwarfdump - 2>&1 | FileCheck %s<br>
-; RUN: llc -filetype=obj -O0 < %s -mtriple mips64-unknown-linux-eabi | llvm-dwarfdump - 2>&1 | FileCheck %s<br>
-; RUN: llc -filetype=obj -O0 < %s -mtriple arm-unknown-linux-eabi | llvm-dwarfdump - 2>&1 | FileCheck %s<br>
-; RUN: llc -filetype=obj -O0 < %s -mtriple aarch64-unknown-linux-eabi | llvm-dwarfdump - 2>&1 | FileCheck %s<br>
-; RUN: llc -filetype=obj -O0 < %s -mtriple s390x-unknown-linux-eabi | llvm-dwarfdump - 2>&1 | FileCheck %s<br>
-; RUN: llc -filetype=obj -O0 < %s -mtriple sparc-unknown-linux-eabi | llvm-dwarfdump - 2>&1 | FileCheck %s<br>
-; RUN: llc -filetype=obj -O0 < %s -mtriple sparcv9-unknown-linux-eabi | llvm-dwarfdump - 2>&1 | FileCheck %s<br>
-<br>
-; CHECK-NOT: failed to compute relocation<br>
-<br>
-!<a href="http://llvm.dbg.cu" target="_blank">llvm.dbg.cu</a> = !{!0}<br>
-!llvm.module.flags = !{!3, !4}<br>
-!llvm.ident = !{!5}<br>
-<br>
-!0 = metadata !{i32 786449, metadata !1, i32 12, metadata !"clang version 3.6.0 ", i1 false, metadata !"", i32 0, metadata !2, metadata !2, metadata !2, metadata !2, metadata !2, metadata !"", i32 1} ; [ DW_TAG_compile_unit ] [/a/empty.c] [DW_LANG_C99]<br>
-!1 = metadata !{metadata !"empty.c", metadata !"/a"}<br>
-!2 = metadata !{}<br>
-!3 = metadata !{i32 2, metadata !"Dwarf Version", i32 4}<br>
-!4 = metadata !{i32 2, metadata !"Debug Info Version", i32 1}<br>
-!5 = metadata !{metadata !"clang version 3.6.0 "}<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>