On Aug 20, 2014, at 4:59 PM, Kinney, Michael D <[email protected]>
wrote:
> Tim,
>
> ARM was a different case. Andrew Fish can provide many of the details.
> Basic issue was that even 32-bit math ops were generating intrinsic calls and
> to apply same technique we have use for 64-bit math ops would have required
> conversion of most =-*/% operations on UINT32 or UINTN values to be converted
> to function calls in all modules. I believe Andrew also provided background
> that the intrinsic calls to support 32-bit math ops were fully documented and
> supported by all ARM compilers.
>
Sorry I was on vacation last week….
The 10,000 foot view was we optimized the coding style of edk2 to not require
intrinsics on IA32 code. So the edk2 math functions that exist solve this
problem for integer math. Not doing assignment operations on structures seemed
to get rid of most of the memset/memcpy issues.
> I get the impression that the real issue here are the obscure linker error
> messages and the extra steps/time required to identify he C source line that
> is introducing the use of the intrinsic call. Another option to consider is
> to improve the tools to help identify the C source line that is generating
> the intrinsic along with a recommended C source change to resolve the issue.
>
> As Daryl said, if there is strong interest in making the intrinsic functions
> in the AppPkg their own lib, he would consider that change. I think that
> would provide a partial solution.
>
My understanding is the math libs are standard for GCC/clang and they follow a
well known naming convention. I’m not sure what VC++ does?
The llvm project has a a set of these intrinsics in the compiler_rt project,
mostly written in C, licensed under MIT and Illinois Open Source License (BDS
compatible).
Random internet search example:
http://opensource.apple.com/source/clang/clang-137/src/projects/compiler-rt/lib/udivmoddi4.c
Thanks,
Andrew Fish
> Best regards,
>
> Mike
>
> From: Tim Lewis [mailto:[email protected]]
> Sent: Wednesday, August 20, 2014 3:39 PM
> To: [email protected]
> Subject: Re: [edk2] [StdLib] Patch for review: Add VC++ helper function for
> 64-bit right shift
>
> Mike –
>
> However, as compilers do require intrinsic functions in order to support
> basic C/C++ operators, and as the ArmPkg has already implemented this sort of
> function for support of ARM tool chains, and as it regularly causes compile
> failures for reasons obscure even to engineers well versed in the art, I
> think it is time to revisit that decision. Raise your hand if you have done a
> search on u
>
> Even a partial solution will be better than no solutions because the net
> result is fewer hard-to-understand linker errors than before. If you miss one
> function, the net result is no worse than today.
>
> Tim
>
> From: Kinney, Michael D [mailto:[email protected]]
> Sent: Wednesday, August 20, 2014 12:30 PM
> To: [email protected]
> Subject: Re: [edk2] [StdLib] Patch for review: Add VC++ helper function for
> 64-bit right shift
>
> Thomas,
>
> A design decision was made early in the EDK II project to not depend on any
> compiler intrinsic functions. The reasons include:
> 1) Linking against OS specific C libs has risks because it can
> potentially introduce OS specific sys calls.
> 2) Linking against OS specific C libs can potentially produce larger
> firmware images.
> 3) Different compilers and each compiler release can choose to
> add/remove/modify intrinsic functions the compiler generates to meet that
> specific compiler’s requirements.
> 4) Not all intrinsic functions generated by all compilers are fully
> documented.
>
> When the AppPkg and support for C lib was added, there was a new requirement
> to support building exiting C application sources “as is”. This meant that
> some intrinsic functions could not be avoided, so the minimum set of
> intrinsic functions were added to the C lib support and the C lib maintainer
> has to handle the issues listed above. As a result, the compiler
> compatibility of the AppPkg may not be the same as the rest of the EDK II
> packages.
>
> I may be a good idea to move the just the intrinsic functions into their own
> lib instances in the AppPkg, so they are available for linking against
> firmware modules to work around porting issues until the intrinsic functions
> are replaced with MdePkg lib calls.
>
> Best regards,
>
> Mike
>
> From: Thomas Rognon [mailto:[email protected]]
> Sent: Wednesday, August 20, 2014 11:34 AM
> To: edk2-devel
> Subject: Re: [edk2] [StdLib] Patch for review: Add VC++ helper function for
> 64-bit right shift
>
> UefiCpuPkg/Library/CompilerIntrinsicsLib would be awesome. I feel like I'm
> always battling the compiler with math and memory intrinsics. I hope this
> happens.
>
>
> On Wed, Aug 20, 2014 at 1:06 PM, Tim Lewis <[email protected]> wrote:
> Daryl –
>
> Do we want to create the equivalent of the
> ArmPkg/Library/CompilerIntrinsicsLib for x86 so that these sorts of
> math-helpers can be used across the whole build? Perhaps
> UefiCpuPkg/Library/CompilerIntrinsicsLib?
>
> Tim
>
>
>
> From: Mcdaniel, Daryl [mailto:[email protected]]
> Sent: Wednesday, August 20, 2014 10:56 AM
> To: [email protected]
> Subject: [edk2] [StdLib] Patch for review: Add VC++ helper function for
> 64-bit right shift
>
> Jaben, Erik, or Lee (or anyone else J),
> Please review the attached patch. llshr.c is a new file, LibC.inf was
> modified.
>
> StdLib: Add a runtime helper function for VC++ 64-bit right shift on Ia32
> target architectures.
>
> Add new file StdLib/LibC/CRT/Ia32/llshr.c
> Add references to the new file to StdLib/LibC/LibC.inf
>
> Contributed-under: TianoCore Contribution Agreement 1.0
>
> Signed-off-by: Daryl McDaniel <[email protected]>
>
> Reviewed-by:
>
>
>
> Daryl McDaniel
>
>
> ------------------------------------------------------------------------------
> Slashdot TV.
> Video for Nerds. Stuff that matters.
> http://tv.slashdot.org/
> _______________________________________________
> edk2-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
>
>
> ------------------------------------------------------------------------------
> Slashdot TV.
> Video for Nerds. Stuff that matters.
> http://tv.slashdot.org/_______________________________________________
> edk2-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds. Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel