[PATCH] D29282: [ELF] - Report filename for unknown relocation error.

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 31 07:46:27 PST 2017


LGTM. We can always make the error even fancier afterwards.

George Rimar via Phabricator <reviews at reviews.llvm.org> writes:

> grimar updated this revision to Diff 86429.
> grimar added a comment.
>
> - Addressed review comment.
>
>
> https://reviews.llvm.org/D29282
>
> Files:
>   ELF/Target.cpp
>   test/ELF/invalid/invalid-relocation-x64.test
>
>
> Index: test/ELF/invalid/invalid-relocation-x64.test
> ===================================================================
> --- test/ELF/invalid/invalid-relocation-x64.test
> +++ test/ELF/invalid/invalid-relocation-x64.test
> @@ -26,5 +26,5 @@
>          Type:            R_X86_64_NONE
>  
>  # RUN: not ld.lld %p/Inputs/invalid-relocation-x64.elf -o %t2 2>&1 | FileCheck %s
> -# CHECK: unknown relocation type: Unknown (152)
> -# CHECK: unknown relocation type: Unknown (153)
> +# CHECK: {{.*}}invalid-relocation-x64.elf: unknown relocation type: Unknown (152)
> +# CHECK: {{.*}}invalid-relocation-x64.elf: unknown relocation type: Unknown (153)
> Index: ELF/Target.cpp
> ===================================================================
> --- ELF/Target.cpp
> +++ ELF/Target.cpp
> @@ -393,7 +393,7 @@
>    case R_386_NONE:
>      return R_HINT;
>    default:
> -    error("unknown relocation type: " + toString(Type));
> +    error(toString(S.File) + ": unknown relocation type: " + toString(Type));
>      return R_HINT;
>    }
>  }
> @@ -674,7 +674,7 @@
>    case R_X86_64_NONE:
>      return R_HINT;
>    default:
> -    error("unknown relocation type: " + toString(Type));
> +    error(toString(S.File) + ": unknown relocation type: " + toString(Type));
>      return R_HINT;
>    }
>  }
> @@ -1627,7 +1627,7 @@
>    case R_AMDGPU_GOTPCREL32_HI:
>      return R_GOT_PC;
>    default:
> -    error("unknown relocation type: " + toString(Type));
> +    error(toString(S.File) + ": unknown relocation type: " + toString(Type));
>      return R_HINT;
>    }
>  }
>
>
> Index: test/ELF/invalid/invalid-relocation-x64.test
> ===================================================================
> --- test/ELF/invalid/invalid-relocation-x64.test
> +++ test/ELF/invalid/invalid-relocation-x64.test
> @@ -26,5 +26,5 @@
>          Type:            R_X86_64_NONE
>  
>  # RUN: not ld.lld %p/Inputs/invalid-relocation-x64.elf -o %t2 2>&1 | FileCheck %s
> -# CHECK: unknown relocation type: Unknown (152)
> -# CHECK: unknown relocation type: Unknown (153)
> +# CHECK: {{.*}}invalid-relocation-x64.elf: unknown relocation type: Unknown (152)
> +# CHECK: {{.*}}invalid-relocation-x64.elf: unknown relocation type: Unknown (153)
> Index: ELF/Target.cpp
> ===================================================================
> --- ELF/Target.cpp
> +++ ELF/Target.cpp
> @@ -393,7 +393,7 @@
>    case R_386_NONE:
>      return R_HINT;
>    default:
> -    error("unknown relocation type: " + toString(Type));
> +    error(toString(S.File) + ": unknown relocation type: " + toString(Type));
>      return R_HINT;
>    }
>  }
> @@ -674,7 +674,7 @@
>    case R_X86_64_NONE:
>      return R_HINT;
>    default:
> -    error("unknown relocation type: " + toString(Type));
> +    error(toString(S.File) + ": unknown relocation type: " + toString(Type));
>      return R_HINT;
>    }
>  }
> @@ -1627,7 +1627,7 @@
>    case R_AMDGPU_GOTPCREL32_HI:
>      return R_GOT_PC;
>    default:
> -    error("unknown relocation type: " + toString(Type));
> +    error(toString(S.File) + ": unknown relocation type: " + toString(Type));
>      return R_HINT;
>    }
>  }


More information about the llvm-commits mailing list