[llvm] r329716 - Add missing nullptr check to AArch64MachObjectWriter::recordRelocation

Galina Kistanova via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 10 10:26:35 PDT 2018


Hello Jessica,

This commit broke test step on one of our builders:
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/8984
. . .
Failing Tests (1):
    LLVM :: MC/AArch64/arm64-no-section.ll

Please have a look?

The builder was red already and did not send notifications.

Thanks

Galina

On Tue, Apr 10, 2018 at 8:53 AM, Jessica Paquette via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: paquette
> Date: Tue Apr 10 08:53:28 2018
> New Revision: 329716
>
> URL: http://llvm.org/viewvc/llvm-project?rev=329716&view=rev
> Log:
> Add missing nullptr check to AArch64MachObjectWriter::recordRelocation
>
> There was missing nullptr check before a call to getSection() in
> recordRelocation. This would result in a segfault in code like the attached
> test.
>
> This adds the missing check and a test which makes sure we get the expected
> error output.
>
>
> Added:
>     llvm/trunk/test/MC/AArch64/arm64-no-section.ll
> Modified:
>     llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp
>
> Modified: llvm/trunk/lib/Target/AArch64/MCTargetDesc/
> AArch64MachObjectWriter.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/
> AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp?rev=329716&r1=329715&r2=
> 329716&view=diff
> ============================================================
> ==================
> --- llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp
> (original)
> +++ llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp
> Tue Apr 10 08:53:28 2018
> @@ -305,7 +305,8 @@ void AArch64MachObjectWriter::recordRelo
>
>      bool CanUseLocalRelocation =
>          canUseLocalRelocation(Section, *Symbol, Log2Size);
> -    if (Symbol->isTemporary() && (Value || !CanUseLocalRelocation)) {
> +    if (Symbol->isTemporary() && Symbol->isInSection() &&
> +        (Value || !CanUseLocalRelocation)) {
>        const MCSection &Sec = Symbol->getSection();
>        if (!Asm.getContext().getAsmInfo()->isSectionAtomizableBySymbols(
> Sec))
>          Symbol->setUsedInReloc();
>
> Added: llvm/trunk/test/MC/AArch64/arm64-no-section.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/
> AArch64/arm64-no-section.ll?rev=329716&view=auto
> ============================================================
> ==================
> --- llvm/trunk/test/MC/AArch64/arm64-no-section.ll (added)
> +++ llvm/trunk/test/MC/AArch64/arm64-no-section.ll Tue Apr 10 08:53:28
> 2018
> @@ -0,0 +1,10 @@
> +; RUN: llc -mtriple=aarch64-darwin-- -filetype=obj %s -o -
> +; CHECK: <inline asm>:1:2: error: unsupported relocation of local symbol
> +; CHECK-SAME: 'L_foo_end'. Must have non-local symbol earlier in section.
> +
> +; Make sure that we emit an error when we try to reference something that
> +; doesn't belong to a section.
> +define void @foo() local_unnamed_addr {
> +  tail call void asm sideeffect "b L_foo_end\0A", ""()
> +  ret void
> +}
>
>
> _______________________________________________
> 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/20180410/31d2ad2a/attachment.html>


More information about the llvm-commits mailing list