[PATCH] D18041: [ELF] use fatal() instead of llvm_unreachable when performing relaxations.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 10 06:21:22 PST 2016


grimar created this revision.
grimar added reviewers: ruiu, rafael.
grimar added subscribers: llvm-commits, grimar.

http://reviews.llvm.org/D18039 showed that we need some additional diagnostic.
At least it is good to output relocation type and it seems that fatal() is more appropriate
as we still can meet such critical situations at any time.

http://reviews.llvm.org/D18041

Files:
  ELF/Target.cpp

Index: ELF/Target.cpp
===================================================================
--- ELF/Target.cpp
+++ ELF/Target.cpp
@@ -566,7 +566,7 @@
     relocateOne(Loc, BufEnd, R_386_TLS_LE, P, SA);
     return 0;
   }
-  llvm_unreachable("Unknown TLS optimization");
+  fatal("Unknown TLS optimization for relocation: " + Twine(Type));
 }
 
 // "Ulrich Drepper, ELF Handling For Thread-Local Storage" (5.1
@@ -911,7 +911,7 @@
     // The next relocation should be against __tls_get_addr, so skip it
     return 1;
   }
-  llvm_unreachable("Unknown TLS optimization");
+  fatal("Unknown TLS optimization for relocation: " + Twine(Type));
 }
 
 void X86_64TargetInfo::relocateOne(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type,
@@ -1467,7 +1467,7 @@
   case R_AARCH64_TLSDESC_ADD_LO12_NC:
   case R_AARCH64_TLSDESC_CALL: {
     if (canBePreempted(S))
-      fatal("Unsupported TLS optimization");
+      fatal("Unsupported TLS optimization for relocation: " + Twine(Type));
     uint64_t X = S ? S->getVA<ELF64LE>() : SA;
     relocateTlsGdToLe(Type, Loc, BufEnd, P, X);
     return 0;
@@ -1477,7 +1477,7 @@
     relocateTlsIeToLe(Type, Loc, BufEnd, P, S->getVA<ELF64LE>());
     return 0;
   }
-  llvm_unreachable("Unknown TLS optimization");
+  fatal("Unknown TLS optimization for relocation: " + Twine(Type));
 }
 
 // Global-Dynamic relocations can be relaxed to Local-Exec if both binary is


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18041.50270.patch
Type: text/x-patch
Size: 1426 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160310/eb9826c8/attachment.bin>


More information about the llvm-commits mailing list