Udivsi3 for arm target

I have created a static library for target=armv7r-none-eabihf which should be called from C to a target-cpu Cortex-R5. When compiling the C-code with the library I get the following error:

"/StateEstimation/source/libavg.a<udivsi3.o>" has a Tag_ABI_VFP_args attribute value of
"0" that is different than one previously seen ("1"); combining incompatible files"

To be clear I do not use udivsi3 anywhere in my code.

Due to the error message I have checked my abi and vfp flags multiple times but the library and the C-code should be compatible. I also checked my binary file for usage of udivsi3 and this is the only time it is mentioned

image

I saw here GitHub - rust-lang/compiler-builtins: Porting compiler-rt intrinsics to Rust that apparently udivsi3 does not have a arm-specific implementation but a generic one. Could this be the problem? Otherwise, what could be the reason for the error?

This means that libavg.a is compiled to pass floating point arguments in regular non-FP registers (0 for the tag), but the other code you are including is compiled to pass them in VFP registers. If you are using an eabihf build target then all code should be doing the latter.

Is libavg.a a precompiled library that you got from somewhere, or is it something you built? If it's precompiled, then you need to get a different version of it that's compiled for the eabihf variant. If you're building it yourself then you should double check how you are building it.

Try compiling for target=armv7r-none-eabi (non-hf) and see if that links correctly.

Thanks for the reply!

The library was built by me and used the following compilation flags:

-C target-cpu=cortex-r5 -C target-feature=+vfp3d16,+strict-align,-hwdiv-arm,+r5,-soft-float,+nonpipelined-vfp,+loop-align -C opt-level=1 -C soft-float=no -C strip=symbols -C split-debuginfo=off

The udivsi3.o file comes from here ~\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\armv7r-none-eabihf\lib\libcompiler_builtins-d0b3e83e69d385de.rlib

Using the readelf -A *o command I made the following file where you can see that some (most) of the files have a Tag_ABI_VFP_args: VFP registers while the last three (udivmodsi4.o, udivsi3.o and umodsi3.o) all lack this tag.

When comparing to the link I posted in the question above we can see that all these functions have only a generic implementation. Is there something wrong with my flags or should I try and do these functions and tags by myself?

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.