Skip to content

hard float ABI passed to arm32 android compilations, which require softfp ABI #21488

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

Closed
Beyley opened this issue Sep 22, 2024 · 2 comments · Fixed by #21504
Closed

hard float ABI passed to arm32 android compilations, which require softfp ABI #21488

Beyley opened this issue Sep 22, 2024 · 2 comments · Fixed by #21504
Labels
bug Observed behavior contradicts documented or intended behavior

Comments

@Beyley
Copy link

Beyley commented Sep 22, 2024

Zig Version

0.14.0-dev.1632+d83a3f174

Steps to Reproduce and Observed Behavior

Clone the 1ed2bd6b00604eceeb4cc28937eec4e962e2ea30 commit of this repo.

install the android NDK version 21

uncomment these lines
https://github.com/LittleBigRefresh/scetool/blob/1ed2bd6b00604eceeb4cc28937eec4e962e2ea30/build.zig#L72

receive this error

error: sub-compilation of libunwind failed
    /home/beyley/zig-versions/master/lib/libunwind/src/UnwindRegistersRestore.S:1:1: note: clang exited with code 1
    :1:1: note: unsupported option '-mfloat-abi=hard' for target 'armv4t-unknown-linux-android'
    :1:1: note: '-mfloat-abi=hard': selected processor lacks floating point registers

Expected Behavior

Compilation succeeds

@Beyley Beyley added the bug Observed behavior contradicts documented or intended behavior label Sep 22, 2024
@alexrp
Copy link
Member

alexrp commented Sep 22, 2024

#21269 regressed this case inadvertently because std.Target.Abi.floatAbi() is not aware of Android ABIs; it's incorrectly considering these to be hard float.

However, it's a bit more complicated because Abi.android is not enough information to go on; it would be incorrect to report soft float for Abi.android for aarch64 and x86. It needs to be split into android (for aarch64, x86, and x86_64), androideabi (for arm, soft float), and androideabihf (for arm, hard float). Or, alternatively, floatAbi() needs to be changed to also take the Cpu.Arch value. I think I like the former approach more because it's in line with what we've done for other targets.

I'll fix this as part of my follow-up work on float ABI stuff.

@Beyley
Copy link
Author

Beyley commented Sep 22, 2024

#21269 regressed this case inadvertently because std.Target.Abi.floatAbi() is not aware of Android ABIs; it's incorrectly considering these to be hard float.

However, it's a bit more complicated because Abi.android is not enough information to go on; it would be incorrect to report soft float for Abi.android for aarch64 and x86. It needs to be split into android (for aarch64, x86, and x86_64), androideabi (for arm, soft float), and androideabihf (for arm, hard float). Or, alternatively, floatAbi() needs to be changed to also take the Cpu.Arch value. I think I like the former approach more because it's in line with what we've done for other targets.

I'll fix this as part of my follow-up work on float ABI stuff.

For reference, the docs seem to say that hardfloat ABI is never used on ARM32 android

@alexrp alexrp closed this as completed in ebbc50d Oct 2, 2024
richerfu pushed a commit to richerfu/zig that referenced this issue Oct 28, 2024
…ase.

Abi.android on its own is not enough to know whether soft float or hard float
should be used. In the C world, androideabi is typically used for the soft float
case, so let's go with that.

Note that Android doesn't have a hard float ABI, so no androideabihf.

Closes ziglang#21488.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants