[lld] r272034 - Define a helper function to get a relocation name. NFC.
Rafael EspĂndola via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 7 13:43:11 PDT 2016
Thanks!
On Jun 7, 2016 2:16 PM, "Rui Ueyama via llvm-commits" <
llvm-commits at lists.llvm.org> wrote:
> Author: ruiu
> Date: Tue Jun 7 13:10:12 2016
> New Revision: 272034
>
> URL: http://llvm.org/viewvc/llvm-project?rev=272034&view=rev
> Log:
> Define a helper function to get a relocation name. NFC.
>
> Modified:
> lld/trunk/ELF/Target.cpp
>
> Modified: lld/trunk/ELF/Target.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=272034&r1=272033&r2=272034&view=diff
>
> ==============================================================================
> --- lld/trunk/ELF/Target.cpp (original)
> +++ lld/trunk/ELF/Target.cpp Tue Jun 7 13:10:12 2016
> @@ -47,36 +47,36 @@ TargetInfo *Target;
>
> static void or32le(uint8_t *P, int32_t V) { write32le(P, read32le(P) |
> V); }
>
> +static StringRef getRelName(uint32_t Type) {
> + return getELFRelocationTypeName(Config->EMachine, Type);
> +}
> +
> template <unsigned N> static void checkInt(int64_t V, uint32_t Type) {
> if (isInt<N>(V))
> return;
> - StringRef S = getELFRelocationTypeName(Config->EMachine, Type);
> - error("relocation " + S + " out of range");
> + error("relocation " + getRelName(Type) + " out of range");
> }
>
> template <unsigned N> static void checkUInt(uint64_t V, uint32_t Type) {
> if (isUInt<N>(V))
> return;
> - StringRef S = getELFRelocationTypeName(Config->EMachine, Type);
> - error("relocation " + S + " out of range");
> + error("relocation " + getRelName(Type) + " out of range");
> }
>
> template <unsigned N> static void checkIntUInt(uint64_t V, uint32_t Type)
> {
> if (isInt<N>(V) || isUInt<N>(V))
> return;
> - StringRef S = getELFRelocationTypeName(Config->EMachine, Type);
> - error("relocation " + S + " out of range");
> + error("relocation " + getRelName(Type) + " out of range");
> }
>
> template <unsigned N> static void checkAlignment(uint64_t V, uint32_t
> Type) {
> if ((V & (N - 1)) == 0)
> return;
> - StringRef S = getELFRelocationTypeName(Config->EMachine, Type);
> - error("improper alignment for relocation " + S);
> + error("improper alignment for relocation " + getRelName(Type));
> }
>
> static void warnDynRel(uint32_t Type) {
> - error("relocation " + getELFRelocationTypeName(Config->EMachine, Type) +
> + error("relocation " + getRelName(Type) +
> " cannot be used when making a shared object; recompile with
> -fPIC.");
> }
>
> @@ -617,10 +617,8 @@ void X86_64TargetInfo::writePlt(uint8_t
> }
>
> uint32_t X86_64TargetInfo::getDynRel(uint32_t Type) const {
> - if (Type == R_X86_64_PC32 || Type == R_X86_64_32)
> - if (Config->Shared)
> - error(getELFRelocationTypeName(EM_X86_64, Type) +
> - " cannot be a dynamic relocation");
> + if (Config->Shared && (Type == R_X86_64_PC32 || Type == R_X86_64_32))
> + error(getRelName(Type) + " cannot be a dynamic relocation");
> return Type;
> }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160607/f786397f/attachment.html>
More information about the llvm-commits
mailing list