All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Do not mess with libc's prototypes
@ 2008-08-07 20:42 lkundrak
  2008-08-08  6:52 ` lkundrak
  0 siblings, 1 reply; 3+ messages in thread
From: lkundrak @ 2008-08-07 20:42 UTC (permalink / raw)
  To: grub-devel

According to POSIX memmove and memcpy can actually be macros or whatever
(IIRC). We'd better not play with those in code that uses libc's headers
and is to be linked with libc.

2008-08-07  Lubomir Rintel  <lkundrak@v3.sk>

        * include/grub/misc.h: Surround memmove and memcpy prototypes with
#ifndef GRUB_UTIL

Index: include/grub/misc.h
===================================================================
--- include/grub/misc.h (revision 1791)
+++ include/grub/misc.h (working copy)
@@ -39,8 +39,10 @@
 char *EXPORT_FUNC(grub_strncat) (char *dest, const char *src, int c);

 /* Prototypes for aliases.  */
+#ifndef GRUB_UTIL
 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);
+#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);




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Do not mess with libc's prototypes
  2008-08-07 20:42 [PATCH] Do not mess with libc's prototypes lkundrak
@ 2008-08-08  6:52 ` lkundrak
  2008-08-13 10:21   ` Marco Gerards
  0 siblings, 1 reply; 3+ messages in thread
From: lkundrak @ 2008-08-08  6:52 UTC (permalink / raw)
  To: The development of GRUB 2

Due to some more breakage, here's some more patch:

According to POSIX memmove and memcpy can actually be macros or whatever
(IIRC). We'd better not play with those in code that uses libc's headers
and is to be linked with libc.

2008-08-08  Lubomir Rintel  <lkundrak@fedoraproject.org>

        * include/grub/misc.h: Surround memmove and memcpy prototypes with
        #ifndef GRUB_UTIL
        * kern/misc.c: Surround memmove, memcpy and memset prototypes with
        #ifndef GRUB_UTIL

Index: kern/misc.c
===================================================================
--- kern/misc.c (revision 1797)
+++ kern/misc.c (working copy)
@@ -44,11 +44,15 @@

   return dest;
 }
+#ifdef GRUB_UTIL
+#include <string.h>
+#else
 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")));
+#endif

 char *
 grub_strcpy (char *dest, const char *src)
@@ -514,8 +518,10 @@

   return s;
 }
+#ifndef GRUB_UTIL
 void *memset (void *s, int c, grub_size_t n)
   __attribute__ ((alias ("grub_memset")));
+#endif

 grub_size_t
 grub_strlen (const char *s)
Index: include/grub/misc.h
===================================================================
--- include/grub/misc.h (revision 1797)
+++ include/grub/misc.h (working copy)
@@ -39,8 +39,12 @@
 char *EXPORT_FUNC(grub_strncat) (char *dest, const char *src, int c);

 /* Prototypes for aliases.  */
+#ifdef GRUB_UTIL
+#include <string.h>
+#else
 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);
+#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);




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Do not mess with libc's prototypes
  2008-08-08  6:52 ` lkundrak
@ 2008-08-13 10:21   ` Marco Gerards
  0 siblings, 0 replies; 3+ messages in thread
From: Marco Gerards @ 2008-08-13 10:21 UTC (permalink / raw)
  To: The development of GRUB 2

lkundrak@v3.sk writes:

> Due to some more breakage, here's some more patch:
>
> According to POSIX memmove and memcpy can actually be macros or whatever
> (IIRC). We'd better not play with those in code that uses libc's headers
> and is to be linked with libc.
>
> 2008-08-08  Lubomir Rintel  <lkundrak@fedoraproject.org>
>
>         * include/grub/misc.h: Surround memmove and memcpy prototypes with
>         #ifndef GRUB_UTIL
>         * kern/misc.c: Surround memmove, memcpy and memset prototypes with
>         #ifndef GRUB_UTIL

This is not for GRUB_UTIL, so please don't do this.  Perhaps your
problem can be fixed in another way.  IIRC, this was added because on
the PPC, memcpy was required by libgcc, which is used there...

--
Marco




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-08-13 10:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-07 20:42 [PATCH] Do not mess with libc's prototypes lkundrak
2008-08-08  6:52 ` lkundrak
2008-08-13 10:21   ` Marco Gerards

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.