[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
memset/memcmp/memmove aliases
From: |
Hollis Blanchard |
Subject: |
memset/memcmp/memmove aliases |
Date: |
Sun, 29 Aug 2004 18:10:09 -0500 |
I just tried to build grub2 from cvs on PPC and got this error:
grubof-fs_hfs.o(.text+0xbc4): In function `grub_hfs_iterate_dir':
fs/hfs.c:588: undefined reference to `memset'
grubof-fs_hfs.o(.text+0xe74): In function `dir_hook':
fs/hfs.c:728: undefined reference to `memset'
The lines in question are these:
588: struct grub_hfs_catalog_key key = {0, grub_cpu_to_be32 (dir), 0,
""};
728: char fname[32] = { 0 };
gcc is turning these into memset calls, despite the fact that this
object was built with -fno-builtin.
http://gcc.gnu.org/onlinedocs/gcc-3.3.1/gcc/Standards.html#Standards
says "Most of the compiler support routines used by GCC are present in
libgcc, but there are a few exceptions. GCC requires the freestanding
environment provide memcpy, memmove, memset and memcmp."
memcpy has already been aliased to grub_memmove; this patch adds
aliases for the other three.
-Hollis
2004-08-29 Hollis Blanchard <address@hidden>
* kern/misc.c: add aliases for memmove, memcmp, and memset to meet
gcc "freestanding environment" requirements.
Index: kern/misc.c
===================================================================
RCS file: /cvsroot/grub/grub2/kern/misc.c,v
retrieving revision 1.14
diff -u -r1.14 misc.c
--- kern/misc.c 28 Aug 2004 13:14:29 -0000 1.14
+++ kern/misc.c 29 Aug 2004 22:48:11 -0000
@@ -45,6 +45,8 @@
return dest;
}
+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")));
@@ -134,6 +136,8 @@
return 0;
}
+void *memcmp (const void *s1, const void *s2, grub_size_t n)
+ __attribute__ ((alias ("grub_memcmp")));
int
grub_strcmp (const char *s1, const char *s2)
@@ -359,6 +363,9 @@
return s;
}
+/* GCC emits references to memset() for struct initialization etc. */
+void *memset (void *s, int c, grub_size_t n)
+ __attribute__ ((alias ("grub_memset")));
grub_size_t
grub_strlen (const char *s)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- memset/memcmp/memmove aliases,
Hollis Blanchard <=