[lld] r291962 - COFF: include relocation type in unsupported relocation message

Bob Haarman via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 13 14:05:22 PST 2017


Author: inglorion
Date: Fri Jan 13 16:05:22 2017
New Revision: 291962

URL: http://llvm.org/viewvc/llvm-project?rev=291962&view=rev
Log:
COFF: include relocation type in unsupported relocation message

Summary: When we encouter a relocation type we don't know how to handle, this change causes us to print out the hexadecimal value of the relocation type. This makes troubleshooting a little easier.

Reviewers: ruiu, zturner

Differential Revision: https://reviews.llvm.org/D28576


Modified:
    lld/trunk/COFF/Chunks.cpp

Modified: lld/trunk/COFF/Chunks.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Chunks.cpp?rev=291962&r1=291961&r2=291962&view=diff
==============================================================================
--- lld/trunk/COFF/Chunks.cpp (original)
+++ lld/trunk/COFF/Chunks.cpp Fri Jan 13 16:05:22 2017
@@ -11,6 +11,7 @@
 #include "Error.h"
 #include "InputFiles.h"
 #include "Symbols.h"
+#include "llvm/ADT/Twine.h"
 #include "llvm/Object/COFF.h"
 #include "llvm/Support/COFF.h"
 #include "llvm/Support/Debug.h"
@@ -61,7 +62,7 @@ void SectionChunk::applyRelX64(uint8_t *
   case IMAGE_REL_AMD64_SECTION:  add16(Off, Sym->getSectionIndex()); break;
   case IMAGE_REL_AMD64_SECREL:   add32(Off, Sym->getSecrel()); break;
   default:
-    fatal("unsupported relocation type");
+    fatal("unsupported relocation type 0x" + Twine::utohexstr(Type));
   }
 }
 
@@ -76,7 +77,7 @@ void SectionChunk::applyRelX86(uint8_t *
   case IMAGE_REL_I386_SECTION:  add16(Off, Sym->getSectionIndex()); break;
   case IMAGE_REL_I386_SECREL:   add32(Off, Sym->getSecrel()); break;
   default:
-    fatal("unsupported relocation type");
+    fatal("unsupported relocation type 0x" + Twine::utohexstr(Type));
   }
 }
 
@@ -136,7 +137,7 @@ void SectionChunk::applyRelARM(uint8_t *
   case IMAGE_REL_ARM_BLX23T:    applyBranch24T(Off, S - P - 4); break;
   case IMAGE_REL_ARM_SECREL:    add32(Off, Sym->getSecrel()); break;
   default:
-    fatal("unsupported relocation type");
+    fatal("unsupported relocation type 0x" + Twine::utohexstr(Type));
   }
 }
 




More information about the llvm-commits mailing list