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

Fix compilation of C++ code for armv7-unknown-linux-gnueabihf #1298

Merged
merged 1 commit into from
Nov 22, 2024

Conversation

tronical
Copy link
Contributor

Inclusion of features.h for armv7-unknown-linux-gnueabihf will, in stubs-32.h, try to include stubs for hard or soft fp:

#if !defined __ARM_PCS_VFP
# include <gnu/stubs-soft.h>
#endif
#if defined __ARM_PCS_VFP
# include <gnu/stubs-hard.h>
#endif

gcc 13.3.0 as built by Yocto does not set __ARM_PCS_VFP unless -mfloat-abi=hard is set. The build will fail as stubs-soft.h may not be present.

Therefore, enable -mfloat-abi=hard when possible. gcc accepts it when an FPU is selected (-mfpu=vfpv3-d16 in this case).

Inclusion of features.h for armv7-unknown-linux-gnueabihf will, in
stubs-32.h, try to include stubs for hard or soft fp:

    #if !defined __ARM_PCS_VFP
    # include <gnu/stubs-soft.h>
    #endif
    #if defined __ARM_PCS_VFP
    # include <gnu/stubs-hard.h>
    #endif

gcc 13.3.0 as built by Yocto does not set __ARM_PCS_VFP unless
-mfloat-abi=hard is set. The build will fail as stubs-soft.h may not be
present.

Therefore, enable -mfloat-abi=hard when possible. gcc accepts it when an
FPU is selected (-mfpu=vfpv3-d16 in this case).
Copy link
Contributor

@madsmtm madsmtm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eabihf corresponds to -mfloat-abi=hard, so I'm pretty sure this is correct

Copy link
Collaborator

@NobodyXu NobodyXu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@NobodyXu NobodyXu merged commit 5e3c257 into rust-lang:main Nov 22, 2024
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants