[lld] 2bbd32f - [ELF] Allow getErrPlace() to work before Out::bufferStart is set
Vlad Tsyrklevich via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 13 09:45:37 PST 2019
I've reverted this change as it introduced UBSan failures, like this
<http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/37344>
one.
On Fri, Dec 13, 2019 at 4:23 AM Alex Richardson via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
>
> Author: Alex Richardson
> Date: 2019-12-13T12:19:55Z
> New Revision: 2bbd32f5e8f0f62d895966e2623d9bdb9778b50b
>
> URL:
> https://github.com/llvm/llvm-project/commit/2bbd32f5e8f0f62d895966e2623d9bdb9778b50b
> DIFF:
> https://github.com/llvm/llvm-project/commit/2bbd32f5e8f0f62d895966e2623d9bdb9778b50b.diff
>
> LOG: [ELF] Allow getErrPlace() to work before Out::bufferStart is set
>
> Summary:
> So far it seems like the only test affected by this change is the one I
> recently added for R_MIPS_JALR relocations since the other test cases that
> use this function early (unknown-relocation-*) do not have a valid input
> section for the relocation offset.
>
> Reviewers: ruiu, grimar, MaskRay, espindola
>
> Reviewed By: ruiu, MaskRay
>
> Subscribers: emaste, sdardis, jrtc27, atanasyan, llvm-commits
>
> Tags: #llvm
>
> Differential Revision: https://reviews.llvm.org/D70659
>
> Added:
>
>
> Modified:
> lld/ELF/Target.cpp
> lld/test/ELF/mips-jalr-non-functions.s
>
> Removed:
>
>
>
>
> ################################################################################
> diff --git a/lld/ELF/Target.cpp b/lld/ELF/Target.cpp
> index e1e99556ec7b..3d1e8e8a7f5b 100644
> --- a/lld/ELF/Target.cpp
> +++ b/lld/ELF/Target.cpp
> @@ -91,15 +91,15 @@ TargetInfo *getTarget() {
> }
>
> template <class ELFT> static ErrorPlace getErrPlace(const uint8_t *loc) {
> - if (!Out::bufferStart)
> - return {};
> -
> for (InputSectionBase *d : inputSections) {
> auto *isec = cast<InputSection>(d);
> if (!isec->getParent())
> continue;
>
> - uint8_t *isecLoc = Out::bufferStart + isec->getParent()->offset +
> isec->outSecOff;
> + const uint8_t *isecLoc =
> + Out::bufferStart
> + ? (Out::bufferStart + isec->getParent()->offset +
> isec->outSecOff)
> + : isec->data().data();
> if (isecLoc <= loc && loc < isecLoc + isec->getSize())
> return {isec, isec->template getLocation<ELFT>(loc - isecLoc) + ":
> "};
> }
>
> diff --git a/lld/test/ELF/mips-jalr-non-functions.s
> b/lld/test/ELF/mips-jalr-non-functions.s
> index 410b742c3e6f..cdb60cd39e83 100644
> --- a/lld/test/ELF/mips-jalr-non-functions.s
> +++ b/lld/test/ELF/mips-jalr-non-functions.s
> @@ -15,13 +15,13 @@ test:
> .Ltmp1:
> jr $t9
> nop
> -# WARNING-MESSAGE: warning: found R_MIPS_JALR relocation against
> non-function symbol tls_obj. This is invalid and most likely a compiler bug.
> +# WARNING-MESSAGE: warning: {{.+}}.tmp.o:(.text+0x0): found R_MIPS_JALR
> relocation against non-function symbol tls_obj. This is invalid and most
> likely a compiler bug.
>
> .reloc .Ltmp2, R_MIPS_JALR, reg_obj
> .Ltmp2:
> jr $t9
> nop
> -# WARNING-MESSAGE: warning: found R_MIPS_JALR relocation against
> non-function symbol reg_obj. This is invalid and most likely a compiler bug.
> +# WARNING-MESSAGE: warning: {{.+}}.tmp.o:(.text+0x8): found R_MIPS_JALR
> relocation against non-function symbol reg_obj. This is invalid and most
> likely a compiler bug.
>
> .reloc .Ltmp3, R_MIPS_JALR, untyped
> .Ltmp3:
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://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/20191213/e4c0d36b/attachment.html>
More information about the llvm-commits
mailing list