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

How to support thumb2 #79

Open
yujack008 opened this issue Oct 29, 2020 · 2 comments
Open

How to support thumb2 #79

yujack008 opened this issue Oct 29, 2020 · 2 comments
Labels
additional info request Further information is requested ARM Relates to raising ARM binaries

Comments

@yujack008
Copy link

In order to support thumb2,i change Triple::arm to Triple::thumb in ARMModuleRaiser.h file.
the output below:

Generated CFG
# Machine code for function add: TracksLiveness

bb.0:
  $sp = tSUBspi $sp(tied-def 0), 2, 14, $noreg, <0x55934479e8b8>
  tSTRspi $r0, $sp, 1, 14, $noreg, <0x55934479ebc8>
  tSTRspi $r1, $sp, 0, 14, $noreg, <0x55934479ece8>
  $r0 = tLDRspi $sp, 1, 14, $noreg, <0x55934479ee08>
  $r1 = tLDRspi $sp, 0, 14, $noreg, <0x55934479ef28>
  $r0 = tADDhirr $r0(tied-def 0), $r1, 14, $noreg, <0x55934479f048>
  $sp = tADDspi $sp(tied-def 0), 2, 14, $noreg, <0x55934479f168>
  tBX $lr, 14, $noreg, <0x55934479f288>

# End machine code for function add.

how can i fix the problem with "tied-def".

my source file main.c is:

#include <stdio.h>
int add(int a,int b)
{
    return a + b;
}
int main(int argc,char **argv)
{
    printf("1 + 2 = %d\r\n",add(1,2));
    return 0;
}

./bin/clang main.c -target armv7-none-linux-androideabi14 -mfloat-abi=softfp -mfpu=vfpv3-d16 -fno-exceptions -fno-rtti -mthumb -O0 -c -o main_thumb.o
./bin/llvm-mctoll main_thumb.o -print-after-all -triple=thumbv7-none-linux-android14

@bharadwajy
Copy link
Contributor

Thanks for your interest in the project.

I am not sure I understand the problem you are referring to. An operand that is used and defined is annotated as tied-def. See here.

What is the problem you wish to fix?

@bharadwajy bharadwajy added the additional info request Further information is requested label Oct 29, 2020
@shijiameng
Copy link

@yujack008
Did you solve the issues in Thumb2? I also want it works for thumb2 but have the same problem of yours.
Thanks.

@bharadwajy bharadwajy added the ARM Relates to raising ARM binaries label Jul 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
additional info request Further information is requested ARM Relates to raising ARM binaries
Projects
None yet
Development

No branches or pull requests

3 participants