Skip to content

Commit

Permalink
TCBZ2596: Added FltUsedLib to MdePkg
Browse files Browse the repository at this point in the history
added FltUsedLib, submitted a feature request to TianoCore
  • Loading branch information
Matthew Carlson authored and kenlautner committed Jul 7, 2024
1 parent 378ba56 commit ddf32c3
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 0 deletions.
10 changes: 10 additions & 0 deletions MdePkg/Library/FltUsedLib/FltUsedLib.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/** @file
Lib to include if using floats
Copyright (C) Microsoft Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/

// You need to include this to let the compiler know we are going to use floating point
int _fltused = 0x9875;
31 changes: 31 additions & 0 deletions MdePkg/Library/FltUsedLib/FltUsedLib.inf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## @file
# Lib to include if using floats
#
# Copyright (C) Microsoft Corporation.
# SPDX-License-Identifier: BSD-2-Clause-Patent
##

[Defines]
INF_VERSION = 0x00010005
BASE_NAME = FltUsedLib
FILE_GUID = C004F180-9FE2-4D2B-8318-BADC2A231774
MODULE_TYPE = BASE
VERSION_STRING = 1.0
LIBRARY_CLASS = FltUsedLib

#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32 X64 AARCH64
#

[Sources]
FltUsedLib.c

[Packages]
MdePkg/MdePkg.dec

[BuildOptions]
# Disable GL due to linker error LNK1237
# https://docs.microsoft.com/en-us/cpp/error-messages/tool-errors/linker-tools-error-lnk1237?view=vs-2017
MSFT:*_*_*_CC_FLAGS = /GL-
15 changes: 15 additions & 0 deletions MdePkg/Library/FltUsedLib/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# FltUsedLib

This library provides a global (fltused) that needs to be defined anywhere floating point operations are used.
The C compiler produces the _fltused symbol by default, this is just to satisfy the linker.

## Using

To use FltUsedLib, just include it in the INF of the module that uses floating point.

```inf
[LibraryClasses]
BaseLib
BaseMemoryLib
FltUsedLib
```
1 change: 1 addition & 0 deletions MdePkg/MdePkg.ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
"DscCompleteCheck": {
"IgnoreInf": [
"MdePkg/Library/VsIntrinsicLib/VsIntrinsicLib.inf", # MU_CHANGE - Ignore intrinsics for toolchains that don't support it.
"MdePkg/Library/FltUsedLib/FltUsedLib.inf" # MU_CHANGE this isn't compilable since it has no code
],
"DscPath": "MdePkg.dsc"
},
Expand Down

0 comments on commit ddf32c3

Please sign in to comment.