tech-toolchain archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
disable gcc's __builtin_*() functions on _STANDALONE
If no one objects, I'll commit the following patch
(disabling gcc's __builtin_*() functions in _STANDALONE programs)
shortly.
-freestanding disables those builtins, but
libkern.h (which is also required by standalone programs)
explicitly re-enable them for kernels.
In article <090320000621.M0104643%mirage.ceres.dti.ne.jp@localhost> on
source-changes-d
I wrote:
> he%NetBSD.org@localhost wrote:
>
> > Module Name: src
> > Committed By: he
> > Date: Thu Mar 19 14:11:21 UTC 2009
> >
> > Modified Files:
> > src/sys/arch/vax/boot/xxboot: bootxx.c
> >
> > Log Message:
> > It seems gcc is unhappy about a literal 0 as a pointer argument
> > to memcpy(). Work around that by using a local variable instead.
> > (This looks a bit dubious, but who am I to judge the restrictions
> > in the standalone environment on the vax -- this should not change
> > the semantics of what was here before.)
>
> Ah, maybe that's one of the reason why some standalone programs
> still use b*() functions, i.e. <lib/libkern/libkern.h> replaces
> mem*() functions with __builtin_mem*() ones which could be larger.
>
> How about this patch?
>
> ---
> Index: libkern/libkern.h
> ===================================================================
> RCS file: /cvsroot/src/sys/lib/libkern/libkern.h,v
> retrieving revision 1.87
> diff -u -r1.87 libkern.h
> --- libkern/libkern.h 18 Mar 2009 12:25:06 -0000 1.87
> +++ libkern/libkern.h 19 Mar 2009 15:03:48 -0000
> @@ -257,11 +257,12 @@
> void *memcpy(void *, const void *, size_t);
> int memcmp(const void *, const void *, size_t);
> void *memset(void *, int, size_t);
> -#if __GNUC_PREREQ__(2, 95) && (__GNUC_PREREQ__(4, 0) || !defined(__vax__))
> +#if __GNUC_PREREQ__(2, 95) && (__GNUC_PREREQ__(4, 0) || !defined(__vax__))
> && \
> + !defined(_STANDALONE)
> #define memcpy(d, s, l) __builtin_memcpy(d, s, l)
> #define memcmp(a, b, l) __builtin_memcmp(a, b, l)
> #endif
> -#if __GNUC_PREREQ__(2, 95) && !defined(__vax__)
> +#if __GNUC_PREREQ__(2, 95) && !defined(__vax__) && !defined(_STANDALONE)
> #define memset(d, v, l) __builtin_memset(d, v, l)
> #endif
>
> @@ -269,7 +270,7 @@
> int strcmp(const char *, const char *);
> size_t strlen(const char *);
> char *strsep(char **, const char *);
> -#if __GNUC_PREREQ__(2, 95)
> +#if __GNUC_PREREQ__(2, 95) && !defined(_STANDALONE)
> #define strcpy(d, s) __builtin_strcpy(d, s)
> #define strcmp(a, b) __builtin_strcmp(a, b)
> #define strlen(a) __builtin_strlen(a)
>
> ---
Home |
Main Index |
Thread Index |
Old Index