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

Update MathLib.c to fix DisplayEngineDxe not compiling on ARM #351

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MsCorePkg/Library/MathLib/MathLib.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ sqrt_d (
IN CONST double input
)
{
UINT64 firstGuess = (UINT64)input;
UINT32 firstGuess = (UINT32)input;
Copy link
Contributor

Choose a reason for hiding this comment

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

I might be missing something on this, but wouldn't this cast cause the upper 32 bit getting truncated as a double should be 64bit in width?

Copy link
Author

Choose a reason for hiding this comment

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

This is exactly why I asked for a review, while this fixed building, it's not the best solution, hence I need someone with experience to look at this

Copy link
Member

Choose a reason for hiding this comment

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

@sonic011gamer, looking at your build log __aeabi_ul2d looks like a compiler built-in function that is not defined. We define those for Arm an AARCH64 in https://github.com/microsoft/mu_basecore/tree/release/202302/MdePkg/Library/CompilerIntrinsicsLib.

That usually gets linked to every module by applying it like this in a DSC:
NULL|MdePkg/Library/CompilerIntrinsicsLib/ArmCompilerIntrinsicsLib.inf

Could you try defining that function there?

Copy link
Member

Choose a reason for hiding this comment

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

It looks like there is a definition in ArmSoftFloatLib in https://github.com/microsoft/mu_silicon_arm_tiano/tree/release/202302/ArmPkg/Library/ArmSoftFloatLib. Are you linking that against this module?

Copy link
Author

Choose a reason for hiding this comment

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

It looks like there is a definition in ArmSoftFloatLib in https://github.com/microsoft/mu_silicon_arm_tiano/tree/release/202302/ArmPkg/Library/ArmSoftFloatLib. Are you linking that against this module?

yes, I am building with this module and the one above mentioned included in the .dsc

double x = 0;
double prevX = -1;

Expand Down