[if gte mso 9]>

Re: [edk2] [StdLib] Patch for review: Add VC++ helper function for 64-bit right shift

Subject: Re: [edk2] [StdLib] Patch for review: Add VC++ helper function for 64-bit right shift

From: Tim Lewis <tim.lewis@insyde.com>

To: "edk2-devel@lists.sourceforge.net" <edk2-devel@lists.sourceforge.net>

Date: 2014-08-21 09:02:35

Mike,

 

It is obvious that someone has discovered the interfaces for some, since Daryl is able to create one for the StdLib. That is one error that we can remove from everyones collective experience going forward. So why not start with documenting what we know?

 

Tim

 

From: Kinney, Michael D [mailto:michael.d.kinney@intel.com]
Sent: Wednesday, August 20, 2014 5:31 PM
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] [StdLib] Patch for review: Add VC++ helper function for 64-bit right shift

 

Tim,

 

For background, can you please provide a links to the public specification of all intrinsic function calls that may be generated for all the compilers supported by the EDK II open source project. 

 

Thanks,

 

Mike

 

From: Tim Lewis [mailto:tim.lewis@insyde.com]
Sent: Wednesday, August 20, 2014 5:09 PM
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] [StdLib] Patch for review: Add VC++ helper function for 64-bit right shift

 

Mike

 

The linker errors are the side effect of not putting full support for the compilers in the tree. I dont want a better error message. I dont want an error message at all. And there is no real reason why EDK2 cannot provide that. It is not an app thing. It is an EDK2 thing. 

 

What is the rationale for maintaining the status quo?  Does that really outweigh fully support the C language on Visual Studio compilers? Or do we really want to leave Visual Studio for x86 at a disadvantage?

 

Tim

 

From: Kinney, Michael D [mailto:michael.d.kinney@intel.com]
Sent: Wednesday, August 20, 2014 4:59 PM
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] [StdLib] Patch for review: Add VC++ helper function for 64-bit right shift

 

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.

 

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.

 

Best regards,

 

Mike

 

From: Tim Lewis [mailto:tim.lewis@insyde.com]
Sent: Wednesday, August 20, 2014 3:39 PM
To: edk2-devel@lists.sourceforge.net
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:michael.d.kinney@intel.com]
Sent: Wednesday, August 20, 2014 12:30 PM
To: edk2-devel@lists.sourceforge.net
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 compilers 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:tcrognon@gmail.com]
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 <tim.lewis@insyde.com> 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:daryl.mcdaniel@intel.com]

Sent: Wednesday, August 20, 2014 10:56 AM
To: edk2-devel@lists.sourceforge.net

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 <daryl.mcdaniel@intel.com>

Reviewed-by:

 

 

Daryl McDaniel

 


------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel