[PATCH] [lld] ELF: Support detection of relocation errors during processing

Will Newton will.newton at linaro.org
Fri Jan 9 04:13:35 PST 2015


On 8 January 2015 at 23:04, Rui Ueyama <ruiu at google.com> wrote:
> REPOSITORY
>   rL LLVM
>
> ================
> Comment at: lib/Core/Error.cpp:123
> @@ -100,1 +122,3 @@
> +}
> +
>
> ----------------
> Instead of adding a new error category for your purpose, I think it would be better to just use make_dynamic_error_code(). It's simpler to use.

Thanks for the suggestion. As I understand it using a dynamic error we
get to remove the error category machinery which is a win in terms of
code size and complexity but it would involve replacing all uses of
say RelocationError::out_of_range with something like
make_dynamic_error_code(Twine("out of range")) which seems a bit
uglier and repetitious. I would expect that the majority of relocation
processing functions should be capable of returning an error code so
that code could be repeated possibly hundreds of times.

How do you see the pros and cons of each approach?

> ================
> Comment at: lib/ReaderWriter/ELF/SectionChunks.h:285
> @@ +284,3 @@
> +
> +    std::string errStr = Twine(errorStr + " in file " +
> +                               atom._atom->file().path() +
> ----------------
> This doesn't seems a correct way to use Twine. This should be
>
>   (Twine(errorStr) + "in file " ...).str()
>
> instead of
>
>   Twine(errorStr + "in file " ...).str()

Thanks, I'll update the patch to do that.

> http://reviews.llvm.org/D6827
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
>



-- 
Will Newton
Toolchain Working Group, Linaro



More information about the llvm-commits mailing list