Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arch/arm/lib/memmove.S:86:3: error: invalid instruction #857

Closed
agners opened this issue Feb 7, 2020 · 8 comments
Closed

arch/arm/lib/memmove.S:86:3: error: invalid instruction #857

agners opened this issue Feb 7, 2020 · 8 comments
Labels
[ARCH] arm32 This bug impacts ARCH=arm [BUG] llvm A bug that should be fixed in upstream LLVM duplicate This issue or pull request already exists Reported upstream This bug was filed on LLVM’s issue tracker, Phabricator, or the kernel mailing list.

Comments

@agners
Copy link

agners commented Feb 7, 2020

Trying to use AS=clang and CONFIG_THUMB2_KERNEL=y leads to the following errors:

arch/arm/lib/memmove.S:86:3: error: invalid instruction
  ldr.w r3, [r1, #-4]!
  ^
...
arch/arm/lib/memmove.S:97:3: error: invalid instruction
  str.w r3, [r0, #-4]!
  ^
@agners agners added [BUG] Untriaged Something isn't working [ARCH] arm32 This bug impacts ARCH=arm labels Feb 7, 2020
@agners agners added [BUG] llvm A bug that should be fixed in upstream LLVM and removed [BUG] Untriaged Something isn't working labels Feb 8, 2020
@agners
Copy link
Author

agners commented Feb 8, 2020

@smithp35 confirmed that this seems to be a bug in LLVM/Clang.

@agners
Copy link
Author

agners commented Feb 9, 2020

A small reproducer:

        .text
        .syntax unified 
        .thumb
        .global _start
_start:
        ldr.w r3, [r1, #-4]!

Test output:

$ arm-none-linux-gnueabihf-as repr-wrong-selection.s
$ llvm-mc -triple=armv7-linux-gnueabi repr-wrong-selection.s
        .text
        .code   16
        .globl  _start
_start:
repr-wrong-selection.s:6:2: error: invalid instruction
        ldr.w r3, [r1, #-4]!
        ^

@agners agners added the Reported upstream This bug was filed on LLVM’s issue tracker, Phabricator, or the kernel mailing list. label Feb 9, 2020
@agners
Copy link
Author

agners commented Feb 9, 2020

Reported upstream: https://llvm.org/pr44858

@jcai19
Copy link
Member

jcai19 commented Feb 9, 2020

Thanks for the reproducer. I'll look into a fix.

@smithp35
Copy link

smithp35 commented Feb 9, 2020

My intuition, not confirmed, is that this could be an attempted match against the unsigned encoding T3 which wouldn't permit signed immediates.

@jcai19
Copy link
Member

jcai19 commented Feb 10, 2020

This issue has been tracked at https://llvm.org/pr43382. LLVM is confused by the ".w" suffix

@agners
Copy link
Author

agners commented Feb 25, 2020

From what I understand it is a combination of the .w suffix and the addressing mode. There has been an attempt to fix this for ldrb.w:
https://reviews.llvm.org/D68916

@nickdesaulniers
Copy link
Member

duping to #1296

@nickdesaulniers nickdesaulniers added the duplicate This issue or pull request already exists label Feb 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[ARCH] arm32 This bug impacts ARCH=arm [BUG] llvm A bug that should be fixed in upstream LLVM duplicate This issue or pull request already exists Reported upstream This bug was filed on LLVM’s issue tracker, Phabricator, or the kernel mailing list.
Projects
None yet
Development

No branches or pull requests

5 participants