-
Notifications
You must be signed in to change notification settings - Fork 183
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
Toolchain for ARM 32 bit fails on android host with exit code 159 #71
Comments
I know that there's been a user who ran the toolchain on armhf host, they've reported a real issue in the compiler, but after it was fixed they were happy, so presumably it worked for them. I guess it doesn't happen with arbitrary
That would be helpful, thank you. Please provide the version of ct-ng and configuration used to build the toolchan as well as the toolchain invocation commands that lead to the crash. |
Here is how the extensa toolchain is built. Commongit clone https://github.com/jcmvbkbc/crosstool-NG.git ARM64 (works fine)sudo apt install g++-aarch64-linux-gnu mkdir overlays Grab the files from ~/x-tools/HOST-aarch64-linux-gnu ARM32 (bad instructions)sudo apt install gcc-arm-linux-gnueabihf edit .config and set CT_HOST=arm-linux-gnueabihf Grab the files from ~/x-tools/HOST-arm-linux-gnueabihf. The filesCompiled toolchain for ARM, SDK distrib (including compiled toolchain), screenshot and build .b files for xtensa in: Compilation log (how to reproduce):
|
@jcmvbkbc Let me know if you need anything else to repro. Meanwhile i'll try to refine it to have minimum reproducible example |
Yup, just compile any |
@jcmvbkbc Is there anything i can assist you with? Probably try with/without some arguments, compare with file compiled with ARM64 version of toolchain, anything? |
I don't have easy access to old ARM hardware, I tried your instructions in qemu linux-user, it worked for me. Looking through the emulated instructions trace I've noticed that the following VFP/NEON instructions were used:
@4ntoine does you hardware support these instructions? Do you have any way to check whether ar crash on your hardware happens on one of these instructions? Maybe run your reproducer in the debugger or under |
OTOH this seems to correspond to termination by SIGSYS. In any case running reproducer on hardware under
|
@jcmvbkbc Thanks for looking into it.
jic i've tried on 2 arm32 devices and both did not work (different CPUs) - Redmi 7a and Huawei Honor 9s. BTW i have a couple of really old devices, i can double check..
At the moment i have only Honor 9s device, can you find the specs? I'm afraid I will try to get the stacktrace. BTW i can see the binaries are stripped (in ~/x-tools/..). Any chance to get them unstripped (probably from ct-ng build dir)? Will it help if you check ARM64 sys calls and compare them (i can provide distrib similar to what i've already uploaded for arm32)? |
We can approach it from the other side: could you use |
Yup, will do that and return back to you soon. Upd: nope, it will take few hours.. |
Can you try running |
What I find says that's based on ARM cortex-a53, which is 64-bit ARMv8. Is there a reason to tun 32-bit code on it? |
Nope, it's detected as 32 bit by Android: It's armv8l, not armv8a. I'm not an expert here but it seems it makes a difference.
will do that
I believe it's just absent on "regular android device". Doesn't it require root too? |
can't access it without rooting |
No stacktrace/addressed in the logcat, will try not hard float toolchain |
try |
|
@jcmvbkbc |
@jcmvbkbc Nope, i've just tried without symlinking and targeting Android 28 same issue. |
@jcmvbkbc anything i can try locally just to have more info to decide on? step-by-step for non-rooted device guide appreciated |
@jcmvbkbc Any progress on it? Is there anything i can help with? |
I'm setting things up for debugging on android. Expecting to get to it this weekend. |
@jcmvbkbc Great! Thank you |
I just tried How do you set up permissions and security context for the toolchain? |
@jcmvbkbc I don't do it and it works with regular apps permissions on arm 64 bit (armv8a). |
Ok, after disabling selinux with |
@jcmvbkbc Do i understand you correctly that it will work with just disabling selinux (i guess it requires root anyway)? sure i will do my best, please provide set-by-step guide on how to do it. My main concern is that even if it works, there is some difference between 32 and 84 toolchain that makes a difference (and requires some additional configuration on 32 but doe snot on 64) |
Maybe. My suggestion is to try to run the reproducer under the strace to see where exactly it fails. |
I've put xtensa-lx106-elf-ar to /data/local/tmp and |
I'm not sure how it works but on Android 10 the app can't execute the executables even in it's own app sandbox ( Please provide step-by-step guide what should i try? |
My understanding is that's because it is specifically designated to the user |
@jcmvbkbc That surprisingly worked (on a real production device):
What does it mean? Why does it work for 64 bit out of box? (from app dir)? Can it be done to work the same way on 32 bit (working only in the app sandbox dir)? |
That the toolchain binaries that you have are capable of working correctly on your system. My interpretation is that the original issue is in the permissions/selinux setup.
These questions are about the android and its application permissions of which I don't know much. I would expect that there might be a tool for debugging this kind of issues. |
@jcmvbkbc Well, regular android app on Android 10 can't put files to |
@jcmvbkbc Ok, so what's the plan? I can prepare a simple app that extracts the sdk and compiles the final binary for the testing, if it helps. |
I don't have any further plan. Specifically I'm not planning to debug android application permissions/selinux configuration. You may want to find out specific syscall that gets SIGSYS and figure out why that happens. Like I said I don't know android well enough to give you any guidance on this, the only thing that comes to my mind is that perhaps generic selinux policy debug techniques could be useful. When you know which syscall fails and for what reason you may be able to find a fix or workaround for it. |
When compiled for ARM 32bit
CT_HOST=arm-linux-gnueabihf
archiever fails to put.o
files into.a
with return code 159. If not archiving .o into .a and pass to linker linker fails to link with the same return code.I will provide the details later.
Is it a known issue?
100% the same command-lines that use toolchain compiled for arm64 (
CT_HOST=aarch64-linux-gnu
) works just fine.The text was updated successfully, but these errors were encountered: