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

Conversation

sonic011gamer
Copy link

@sonic011gamer sonic011gamer commented Nov 4, 2023

Description

This change was made for fixing DisplayEngineDxe giving a linking error on 32-bit ARM architecture because of sqrt_d in MathLib. It fixes issue #350

  • Impacts functionality?
    • Functionality - Does the change ultimately impact how firmware functions?
    • Examples: Add a new library, publish a new PPI, update an algorithm, ...
  • Impacts security?
    • Security - Does the change have a direct security impact on an application,
      flow, or firmware?
    • Examples: Crypto algorithm change, buffer overflow fix, parameter
      validation improvement, ...
  • Breaking change?
    • Breaking change - Will anyone consuming this change experience a break
      in build or boot behavior?
    • Examples: Add a new library class, move a module to a different repo, call
      a function in a new library class in a pre-existing module, ...
  • Includes tests?
    • Tests - Does the change include any explicit test code?
    • Examples: Unit tests, integration tests, robot tests, ...
  • Includes documentation?
    • Documentation - Does the change contain explicit documentation additions
      outside direct code modifications (and comments)?
    • Examples: Update readme file, add feature readme file, link to documentation
      on an a separate Web page, ...

How This Was Tested

<Please describe the test(s) that were run to verify the changes.>

Integration Instructions

N/A

Make it so it can compile on 32-bit ARM architectures.
@@ -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

Copy link

This PR has been automatically marked as stale because it has not had activity in 60 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions.

@github-actions github-actions bot added the state:stale Has not been updated in a long time label Jan 10, 2024
Copy link

This pull request has been automatically been closed because it did not have any activity in 60 days and no follow up within 7 days after being marked stale. Thank you for your contributions.

@github-actions github-actions bot closed this Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state:stale Has not been updated in a long time
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants