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

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 10 08:14:22 PST 2016


fatal should only be used if this is actually reachable. Can you write
a testcase that shows that you can reach each of these?

Cheers,
Rafael


On 10 March 2016 at 09:21, George Rimar <grimar at accesssoftek.com> wrote:
> 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
>
>


More information about the llvm-commits mailing list