Make sure stdint.h is always used with MSVC on ARM/ARM64, since all

the versions of Visual Studio that support ARM or ARM64 have that
header. Without this, uint64_t would be defined to unsigned long,
which is 32-bits in the Microsoft world.

Also fix aarch64/initplat.c so that memset/memcpy only apply
to gcc. Otherwise MSVC throws an error for __SIZE_TYPE__.

Updating this patch to v2, since it turns out MSVC will also emit
memset and memcpy intrinsics that we can use an implementation for.
This is true for both ARM and ARM64.
To make this work, I'm defining __SIZE_TYPE__ to UINTN if not
already defined.

Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
This commit is contained in:
Nigel Croxon 2017-11-06 09:26:05 -05:00
parent 15bcddc996
commit 39ce220cb6
4 changed files with 11 additions and 3 deletions

View File

@ -15,7 +15,7 @@
* either version 2 of the License, or (at your option) any later version.
*/
#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L )
#if !defined(_MSC_VER) && (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L ))
// ANSI C 1999/2000 stdint.h integer width declarations

View File

@ -15,7 +15,7 @@
* either version 2 of the License, or (at your option) any later version.
*/
#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L )
#if !defined(_MSC_VER) && (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L ))
// ANSI C 1999/2000 stdint.h integer width declarations

View File

@ -25,6 +25,10 @@ InitializeLibPlatform (
{
}
#ifndef __SIZE_TYPE__
#define __SIZE_TYPE__ UINTN
#endif
/*
* Calls to these functions may be emitted implicitly by GCC even when
* -ffreestanding is in effect.

View File

@ -25,7 +25,10 @@ InitializeLibPlatform (
{
}
#ifdef __GNUC__
#ifndef __SIZE_TYPE__
#define __SIZE_TYPE__ UINTN
#endif
/*
* Calls to these functions may be emitted implicitly by GCC even when
* -ffreestanding is in effect.
@ -51,6 +54,7 @@ void *memcpy(void *dest, const void *src, __SIZE_TYPE__ n)
return dest;
}
#ifdef __GNUC__
void __div0(void)
{
// TODO handle divide by zero fault