[llvm] r347476 - Reland test/MC/Mips/reloc-directive-label-offset.s

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 22 11:30:05 PST 2018


On Thu, Nov 22, 2018 at 10:24 PM Vladimir Stefanovic
<vladimir.stefanovic at rt-rk.com> wrote:
>
> Hi Roman,
>
> maybe I should have mentioned it in the commit message - I added this
> test yesterday as part of
> '[MC] Support labels as offsets in .reloc directive'
> (https://reviews.llvm.org/D53990).
Yes, i saw that.

> It's only meant to check that relocations are present in the relocation
> table with the properly resolved offset, their order in the table is not
> this test's concern.
But since no other test is failing, this is the first test to expose
the issue, no?
I can't tell whether that is a pre-existing bug, or it is only now
being introduced though.

> (It's legal to have more relocations at the same offset.)
Which means it is the non-determinism that is the problem.

> Regards,
> Vladimir
Roman.

> On 22.11.18. 19:27, Roman Lebedev wrote:
> > On Thu, Nov 22, 2018 at 9:21 PM Vladimir Stefanovic via llvm-commits
> > <llvm-commits at lists.llvm.org> wrote:
> >> Author: vstefanovic
> >> Date: Thu Nov 22 10:18:58 2018
> >> New Revision: 347476
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=347476&view=rev
> >> Log:
> >> Reland test/MC/Mips/reloc-directive-label-offset.s
> >>
> >> The test was reverted because it failed on
> >> llvm-clang-x86_64-expensive-checks-win builder, and that was because
> >> -DEXPENSIVE_CHECKS adds randomness to llvm::sort(), affecting the order of
> >> relocation table entries.
> >> Modified the test to not have two relocations at the same offset.
> > I don't know what i'm talking about, but i'm not sure this is the correct fix.
> >
> > Is it *legal* to have two relocations at the same offset?
> > If no, then shouldn't such situation result in an error?
> > If yes, then that bot exposed the issue it was designed to expose, and
> > hardening the test simply hides it.
> > I would have guessed that somewhere, the relocation should be stable_sort'ed?
> >
> > Or maybe i'm just wrong.
> >
> >> Added:
> >>      llvm/trunk/test/MC/Mips/reloc-directive-label-offset.s
> >>
> >> Added: llvm/trunk/test/MC/Mips/reloc-directive-label-offset.s
> >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/reloc-directive-label-offset.s?rev=347476&view=auto
> >> ==============================================================================
> >> --- llvm/trunk/test/MC/Mips/reloc-directive-label-offset.s (added)
> >> +++ llvm/trunk/test/MC/Mips/reloc-directive-label-offset.s Thu Nov 22 10:18:58 2018
> >> @@ -0,0 +1,75 @@
> >> +# RUN: llvm-mc -triple mips-unknown-linux %s -show-encoding -target-abi=o32 \
> >> +# RUN:     | FileCheck --check-prefixes=ASM,ASM-32 %s
> >> +# RUN: llvm-mc -triple mips64-unknown-linux %s -show-encoding -target-abi=n32 \
> >> +# RUN:     | FileCheck --check-prefixes=ASM,ASM-64 %s
> >> +# RUN: llvm-mc -triple mips64-unknown-linux %s -show-encoding -target-abi=n64 \
> >> +# RUN:     | FileCheck --check-prefixes=ASM,ASM-64 %s
> >> +# RUN: llvm-mc -triple mips-unknown-linux %s -show-encoding -target-abi=o32 \
> >> +# RUN:     -filetype=obj | llvm-readobj -r | FileCheck -check-prefix=OBJ-O32 %s
> >> +# RUN: llvm-mc -triple mips64-unknown-linux %s -show-encoding -target-abi=n32 \
> >> +# RUN:     -filetype=obj | llvm-readobj -r | FileCheck -check-prefix=OBJ-N32 %s
> >> +# RUN: llvm-mc -triple mips64-unknown-linux %s -show-encoding -target-abi=n64 \
> >> +# RUN:     -filetype=obj | llvm-readobj -r | FileCheck -check-prefix=OBJ-N64 %s
> >> +
> >> +  .text
> >> +foo: # ASM-LABEL: foo:
> >> +  nop
> >> +1:
> >> +  nop
> >> +  .reloc 1b, R_MIPS_NONE, foo       # ASM-32: .reloc ($tmp0), R_MIPS_NONE, foo
> >> +                                    # ASM-64: .reloc .Ltmp0, R_MIPS_NONE, foo
> >> +  nop
> >> +  .reloc 1f, R_MIPS_32, foo         # ASM-32: .reloc ($tmp1), R_MIPS_32, foo
> >> +                                    # ASM-64: .reloc .Ltmp1, R_MIPS_32, foo
> >> +1:
> >> +  nop
> >> +  .reloc 1f, R_MIPS_CALL16, foo     # ASM-32: .reloc ($tmp2), R_MIPS_CALL16, foo
> >> +                                    # ASM-64: .reloc .Ltmp2, R_MIPS_CALL16, foo
> >> +1:
> >> +  nop
> >> +  .reloc 2f, R_MIPS_GOT_DISP, foo   # ASM-32: .reloc ($tmp3), R_MIPS_GOT_DISP, foo
> >> +                                    # ASM-64: .reloc .Ltmp3, R_MIPS_GOT_DISP, foo
> >> +  nop
> >> +
> >> +  .reloc 3f, R_MIPS_GOT_PAGE, foo   # ASM-32: .reloc ($tmp4), R_MIPS_GOT_PAGE, foo
> >> +                                    # ASM-64: .reloc .Ltmp4, R_MIPS_GOT_PAGE, foo
> >> +  nop
> >> +bar:
> >> +  nop
> >> +2:
> >> +  nop
> >> +3:
> >> +  nop
> >> +  .reloc bar, R_MIPS_GOT_OFST, foo  # ASM: .reloc bar, R_MIPS_GOT_OFST, foo
> >> +  nop
> >> +  .reloc foo, R_MIPS_32, foo        # ASM: .reloc foo, R_MIPS_32, foo
> >> +  nop
> >> +1:
> >> +  nop
> >> +
> >> +# OBJ-O32-LABEL: Relocations [
> >> +# OBJ-O32:           0x0 R_MIPS_32 .text 0x0
> >> +# OBJ-O32-NEXT:      0x4 R_MIPS_NONE .text 0x0
> >> +# OBJ-O32-NEXT:      0xC R_MIPS_32 .text 0x0
> >> +# OBJ-O32-NEXT:      0x10 R_MIPS_CALL16 foo 0x0
> >> +# OBJ-O32-NEXT:      0x1C R_MIPS_GOT_OFST .text 0x0
> >> +# OBJ-O32-NEXT:      0x20 R_MIPS_GOT_DISP foo 0x0
> >> +# OBJ-O32-NEXT:      0x24 R_MIPS_GOT_PAGE .text 0x0
> >> +
> >> +# OBJ-N32-LABEL: Relocations [
> >> +# OBJ-N32:           0x4 R_MIPS_NONE .text 0x0
> >> +# OBJ-N32-NEXT:      0x1C R_MIPS_GOT_OFST .text 0x0
> >> +# OBJ-N32-NEXT:      0x0 R_MIPS_32 .text 0x0
> >> +# OBJ-N32-NEXT:      0xC R_MIPS_32 .text 0x0
> >> +# OBJ-N32-NEXT:      0x10 R_MIPS_CALL16 foo 0x0
> >> +# OBJ-N32-NEXT:      0x20 R_MIPS_GOT_DISP foo 0x0
> >> +# OBJ-N32-NEXT:      0x24 R_MIPS_GOT_PAGE .text 0x0
> >> +
> >> +# OBJ-N64-LABEL: Relocations [
> >> +# OBJ-N64:           0x4 R_MIPS_NONE/R_MIPS_NONE/R_MIPS_NONE .text 0x0
> >> +# OBJ-N64-NEXT:      0x1C R_MIPS_GOT_OFST/R_MIPS_NONE/R_MIPS_NONE .text 0x0
> >> +# OBJ-N64-NEXT:      0x0 R_MIPS_32/R_MIPS_NONE/R_MIPS_NONE .text 0x0
> >> +# OBJ-N64-NEXT:      0xC R_MIPS_32/R_MIPS_NONE/R_MIPS_NONE .text 0x0
> >> +# OBJ-N64-NEXT:      0x10 R_MIPS_CALL16/R_MIPS_NONE/R_MIPS_NONE foo 0x0
> >> +# OBJ-N64-NEXT:      0x20 R_MIPS_GOT_DISP/R_MIPS_NONE/R_MIPS_NONE foo 0x0
> >> +# OBJ-N64-NEXT:      0x24 R_MIPS_GOT_PAGE/R_MIPS_NONE/R_MIPS_NONE .text 0x0
> > Roman.
> >
> >> _______________________________________________
> >> llvm-commits mailing list
> >> llvm-commits at lists.llvm.org
> >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list