f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync/* $Id$ */
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync/** @file
5b281ba489ca18f0380d7efc7a5108b606cce449vboxsync * IPRT - No-CRT memmove() alias for gcc.
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync */
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync/*
c58f1213e628a545081c70e26c6b67a841cff880vboxsync * Copyright (C) 2006-2010 Oracle Corporation
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync *
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync * available from http://www.virtualbox.org. This file is free software;
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync * you can redistribute it and/or modify it under the terms of the GNU
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync * General Public License (GPL) as published by the Free Software
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync *
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync * The contents of this file may alternatively be used under the terms
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync * of the Common Development and Distribution License Version 1.0
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync * VirtualBox OSE distribution, in which case the provisions of the
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync * CDDL are applicable instead of those of the GPL.
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync *
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync * You may elect to license modified versions of this file under the
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync * terms and conditions of either the GPL or the CDDL or both.
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync */
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync/*******************************************************************************
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync* Header Files *
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync*******************************************************************************/
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync#include <iprt/nocrt/string.h>
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync#undef memmove
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync#if defined(RT_OS_DARWIN) || defined(RT_OS_WINDOWS)
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync# ifndef __MINGW32__
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync# pragma weak memmove
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync# endif
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync/* No alias support here (yet in the ming case). */
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsyncextern void *(memmove)(void *pvDst, const void *pvSrc, size_t cb)
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync{
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync return RT_NOCRT(memmove)(pvDst, pvSrc, cb);
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync}
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync#elif __GNUC__ >= 4
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync/* create a weak alias. */
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync__asm__(".weak memmove\t\n"
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync " .set memmove," RT_NOCRT_STR(memmove) "\t\n");
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync#else
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync/* create a weak alias. */
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsyncextern __typeof(RT_NOCRT(memmove)) memmove __attribute__((weak, alias(RT_NOCRT_STR(memmove))));
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync#endif
f212e1f2b6bb160f9b7539562599a4604ca44cd2vboxsync