* include/grub/misc.h (memcmp) [__APPLE__]: Mark as regparm 0.

(memmove) [__APPLE__]: Likewise.
	(memcpy) [__APPLE__]: Likewise.
	(memset) [__APPLE__]: Likewise.
	* grub-core/kern/misc.c (memcmp) [__APPLE__]: Likewise.
	(memmove) [__APPLE__]: Likewise.
	(memcpy) [__APPLE__]: Likewise.
	(memset) [__APPLE__]: Likewise.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-05-28 17:37:18 +02:00
parent 85a730ca9f
commit f7194551c4
3 changed files with 30 additions and 7 deletions

View file

@ -1,3 +1,15 @@
2012-05-28 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/misc.h (memcmp) [__APPLE__]: Mark as regparm 0.
(memmove) [__APPLE__]: Likewise.
(memcpy) [__APPLE__]: Likewise.
(memset) [__APPLE__]: Likewise.
* grub-core/kern/misc.c (memcmp) [__APPLE__]: Likewise.
(memmove) [__APPLE__]: Likewise.
(memcpy) [__APPLE__]: Likewise.
(memset) [__APPLE__]: Likewise.
2012-05-28 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/genmod.sh.in: Fix a bug in Apple part which caused

View file

@ -64,18 +64,20 @@ grub_memmove (void *dest, const void *src, grub_size_t n)
return dest;
}
#ifndef APPLE_CC
#ifndef __APPLE__
void *memmove (void *dest, const void *src, grub_size_t n)
__attribute__ ((alias ("grub_memmove")));
/* GCC emits references to memcpy() for struct copies etc. */
void *memcpy (void *dest, const void *src, grub_size_t n)
__attribute__ ((alias ("grub_memmove")));
#else
void *memcpy (void *dest, const void *src, grub_size_t n)
void * __attribute__ ((regparm(0)))
memcpy (void *dest, const void *src, grub_size_t n)
{
return grub_memmove (dest, src, n);
}
void *memmove (void *dest, const void *src, grub_size_t n)
void * __attribute__ ((regparm(0)))
memmove (void *dest, const void *src, grub_size_t n)
{
return grub_memmove (dest, src, n);
}
@ -230,11 +232,12 @@ grub_memcmp (const void *s1, const void *s2, grub_size_t n)
return 0;
}
#ifndef APPLE_CC
#ifndef __APPLE__
int memcmp (const void *s1, const void *s2, grub_size_t n)
__attribute__ ((alias ("grub_memcmp")));
#else
int memcmp (const void *s1, const void *s2, grub_size_t n)
int __attribute__ ((regparm(0)))
memcmp (const void *s1, const void *s2, grub_size_t n)
{
return grub_memcmp (s1, s2, n);
}
@ -505,11 +508,12 @@ grub_memset (void *s, int c, grub_size_t len)
return s;
}
#ifndef APPLE_CC
#ifndef __APPLE__
void *memset (void *s, int c, grub_size_t n)
__attribute__ ((alias ("grub_memset")));
#else
void *memset (void *s, int c, grub_size_t n)
void * __attribute__ ((regparm(0)))
memset (void *s, int c, grub_size_t n)
{
return grub_memset (s, c, n);
}

View file

@ -113,11 +113,18 @@ grub_strncat (char *dest, const char *src, int c)
/* Prototypes for aliases. */
#ifndef GRUB_UTIL
#ifdef __APPLE__
int __attribute__ ((regparm(0))) EXPORT_FUNC(memcmp) (const void *s1, const void *s2, grub_size_t n);
void *__attribute__ ((regparm(0))) EXPORT_FUNC(memmove) (void *dest, const void *src, grub_size_t n);
void *__attribute__ ((regparm(0))) EXPORT_FUNC(memcpy) (void *dest, const void *src, grub_size_t n);
void *__attribute__ ((regparm(0))) EXPORT_FUNC(memset) (void *s, int c, grub_size_t n);
#else
int EXPORT_FUNC(memcmp) (const void *s1, const void *s2, grub_size_t n);
void *EXPORT_FUNC(memmove) (void *dest, const void *src, grub_size_t n);
void *EXPORT_FUNC(memcpy) (void *dest, const void *src, grub_size_t n);
void *EXPORT_FUNC(memset) (void *s, int c, grub_size_t n);
#endif
#endif
int EXPORT_FUNC(grub_memcmp) (const void *s1, const void *s2, grub_size_t n);
int EXPORT_FUNC(grub_strcmp) (const char *s1, const char *s2);