OpenSSL requires _fltused to be defined as a constant anywhere floating point is used. This is to satisfy the linker, however, it is possible to compile a module with multiple definitions of fltused. This causes the MSVC compiler to fail the build. To solve this problem, the FltUsedLib was created that is one spot that the global static can exist.
Created attachment 484 [details] proposed patch
This makes a lot of situations easier (CryptoPkg\Library\IntrinsicLib\MemoryIntrinsics.c for example) as it can be included as a library.
guomin: please check it.
Hi Matthew, Have you encountered this type issue? If define library class, it may conflict with IntrinsicLib library class. If consumer override the IntrinsicLib rather than define new? Thanks
Not sure i follow your question but the reason we moved to a library to define this symbol was to deal with two libraries within the same module. If both libs defined it then there were problems. If they both claimed dependent on the same library then it would only be defined once for the whole module.
Propose the generic null type IntrinsicLib to include the common used intrinsic APIs, such as memcpy, memset. This library can be linked to every module.
Post patch at message https://edk2.groups.io/g/devel/message/56613
Guomin: please discuss the proposal on the generic null type IntrinsicLib first.
Hi Liming, The IntrinsicLib is just for CryptoLib. when you use openssl, it will intrinsic memset() and memcmp() provided by compiler. But in edk2 implement, we have disabled the intrinsic feature from compiler, and it will occur that build error so we add the IntrinsicLib. If we provide the null implement, although it can build pass, but the function will fail when memset() and memcmp() is invoked, so i think it is not a good idea. Thanks.
Guomin: please summary current feedback in edk2 community.
Summarize the current status<br/> Problem: It may occur that _fltused symbol is defined in two library and both are dependent by one module.<br/> Goal: The reporter want to separate the _fltused symbol into single library and all other libraries which need _fltused symbol depend on the library, so it can resolve the problem.<br/> Candidate Proposal 1: Define a NULL library for fltused. Michael D Kinney <michael.d.kinney@intel.com> exhibit that ARM use NULL library class for intrinsic. Sean <sean.brogan=microsoft.com@groups.io> think that it will affect it will affect size, optimization, and suggest that use new library. Michael D Kinney <michael.d.kinney@intel.com> think it will have no effect on size. Candidate Proposal 2: Define FltUsedLib and IntrinsicLib separately. Bret Barkelew <bret.barkelew@microsoft.com> have provide the reviewed-by and seem that he/she agree define FltUsedLib Ard Biesheuvel <ard.biesheuvel@linaro.org> have consider that it affect all platform, and it is a problem. Laszlo Ersek <lersek@redhat.com> suggest that only add file on OpensslLib rather create new library and add limitation only for MSVC and disagree that add new FltusedLib. Matthew Carlson <macarl=microsoft.com@groups.io> point that it is required by MSVC compiler, but this is not just for openssl, for example, OnScreenKeyboard and UiToolKit driver will need this as well. Ard Biesheuvel <ard.biesheuvel@linaro.org> think it should belong to IntrinsicsLib and think can add fltused in a single file and add it to EntryPointLib(PEIMs, DXEs, etc). Laszlo Ersek <lersek@redhat.com> agree with Adr Biesheuvel I <guomin.jiang@intel.com> test add file FloatUsed.c with MSFT, it still fail because it will need /GL-. Ard Biesheuvel <ard.biesheuvel@linaro.org> think it should add EntryPointLib, but it seem that build fail. Michael D Kinney <michael.d.kinney@intel.com> think can use EntryPointLib or NULL
I recently got confirmation from the Microsoft compiler team that fltused doesn't do anything anymore. It is still required (bug filed for next version to remove). I am now aligned with Mike K in that we should just add it to a baselib (both H and C files) for the Microsoft compiler toolchain. We can then remove it from all other libraries. Thoughts? Thanks Sean
Post Patch v2 at https://edk2.groups.io/g/devel/message/57900.
Hi All, When i add FltUsed.c into BaseLib, it have below build error UefiDriverEntryPoint.lib(DriverEntryPoint.obj) : fatal error LNK1237: during code generation, compiler introduced reference to symbol '_fltused' defined in module 'BaseLib.lib(FltUsed.obj)' compiled with /GL Another thing: I will not follow up the bug until Quarter 3 or July, thanks for your patience. Best Regards guomin
I want to drop the request, because it seem that not necessary. I want to get feedback from you, if no comments, i will close it next Friday. Best Regards Guomin
Close it because it seem that no one care it.