mirror of https://github.com/acidanthera/audk.git
The GCC compiler’s behavior is different than the Microsoft compilers for statically linked vararg functions. The GCC compilers do provide __builtin_ functions for accessing varargs. we should use these intrinsic functions with GCC
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8260 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
7c9d25ae76
commit
130a2eecc4
|
@ -332,7 +332,20 @@ struct _LIST_ENTRY {
|
||||||
// return Result
|
// return Result
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
//
|
||||||
|
// In GCC compiler, its behavior for statically linked varargs is different with MSFT tool chain.
|
||||||
|
// Should use __builtin_* intrinsic functions provided by GCC compiler to access varargs.
|
||||||
|
//
|
||||||
|
typedef __builtin_va_list VA_LIST;
|
||||||
|
|
||||||
|
#define VA_START(Marker, Parameter) __builtin_va_start(Marker, Parameter)
|
||||||
|
|
||||||
|
#define VA_ARG(Marker, TYPE) __builtin_va_arg(Marker, TYPE)
|
||||||
|
|
||||||
|
#define VA_END(Marker) __builtin_va_end(Marker)
|
||||||
|
|
||||||
|
#else
|
||||||
/**
|
/**
|
||||||
Return the size of argument that has been aligned to sizeof (UINTN).
|
Return the size of argument that has been aligned to sizeof (UINTN).
|
||||||
|
|
||||||
|
@ -394,6 +407,8 @@ typedef CHAR8 *VA_LIST;
|
||||||
**/
|
**/
|
||||||
#define VA_END(Marker) (Marker = (VA_LIST) 0)
|
#define VA_END(Marker) (Marker = (VA_LIST) 0)
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Macro that returns the byte offset of a field in a data structure.
|
Macro that returns the byte offset of a field in a data structure.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue