From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-x22c.google.com (mail-wm0-x22c.google.com [IPv6:2a00:1450:400c:c09::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 49D341A1E1E for ; Mon, 8 Aug 2016 04:12:29 -0700 (PDT) Received: by mail-wm0-x22c.google.com with SMTP id i5so131405515wmg.0 for ; Mon, 08 Aug 2016 04:12:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9FZCF8s+LEo8sKACGfFxnEJqkfYTxFZnlm5CByZmbMI=; b=Rk4sdRpP8/uQSXSEITHr/fmrXKZ0r3qGpLsxkaEMnanLoMQvgnlC977orivOFjMScC DsuFVnjCJ2TG1gThPgzlxxG+KCGpcSLAq9vGNllGTDuMDyx+REaPENXb9kNwZ2c9ewyN lsn9msSfCCGR9T5CyphqioXxORXlCAoyEE69E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9FZCF8s+LEo8sKACGfFxnEJqkfYTxFZnlm5CByZmbMI=; b=GsNfsV99Vq4o9LrzK31Q52qQd2JTLhc2EVYSzl7M8dq+lVH4yaHJoMpq/nEXi2559H 9dIrcMzVvsuDEH9gifK0C9irzcHo62IfOBRMZz6Szwofp/KDM7XrMDhqGpxtABHkJOsU 3m3UNOY+BH9nsgvbxaXWO+FGjjGlqEmhDy+vs/CDfnNgIKw9xspAE565wKIlIN8AWxar pC6VjVVUTQXBIoKVUjUvkPZktVcxqpmnCC74KUrI1GtjMYE55j6CqdQv0JdVCpKQp1jN GGqw3urBhZTVetrOO45TW7h7jgkIEYq4jhht1en5UtYY4YVx1GPqJwCFjAx8Vnt84fFh QK/w== X-Gm-Message-State: AEkooutGjRd4gQIlwxNiaQDaFoxaVcSsiFleYhSV4p6/MCN6MCXXcNuOLgKNIFLp+KfqcTkH X-Received: by 10.194.104.197 with SMTP id gg5mr82618674wjb.6.1470654747837; Mon, 08 Aug 2016 04:12:27 -0700 (PDT) Received: from localhost.localdomain (222.red-88-1-55.dynamicip.rima-tde.net. [88.1.55.222]) by smtp.gmail.com with ESMTPSA id v203sm23149488wmv.2.2016.08.08.04.12.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 08 Aug 2016 04:12:27 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, edk2-lists@mc2research.org, jaben.carsey@intel.com Cc: sigmaepsilon92@gmail.com, leif.lindholm@linaro.org, Ard Biesheuvel Date: Mon, 8 Aug 2016 13:12:21 +0200 Message-Id: <1470654741-24203-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1470654741-24203-1-git-send-email-ard.biesheuvel@linaro.org> References: <1470654741-24203-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [PATCH 2/2] StdLib/LibC ARM AARCH64: do not redefine compiler intrinsics X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2016 11:12:29 -0000 The memset() function is a compiler intrinsics on AARCH64 and ARM, and so is memmove() on ARM. Usually, redefining them as LibC currently does is not a problem since only one version will be selected at link time from the various static libraries that provide implementations. However, under LTO, this is slightly different, since explicit references (in the C code) and implicit references (emitted by the compiler backend) may resolve to different versions (LTO vs non-LTO), causing conflicts. So simply omit them for ARM/AARCH64 resp. ARM. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- StdLib/LibC/String/Copying.c | 2 ++ StdLib/LibC/String/Misc.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/StdLib/LibC/String/Copying.c b/StdLib/LibC/String/Copying.c index 96be24b9a9bd..3234eccf0808 100644 --- a/StdLib/LibC/String/Copying.c +++ b/StdLib/LibC/String/Copying.c @@ -39,6 +39,7 @@ memcpy(void * __restrict s1, const void * __restrict s2, size_t n) } #endif /* !(defined(MDE_CPU_IPF) && defined(__GCC)) */ +#if !(defined(MDE_CPU_ARM) && defined(__GNUC__)) /** The memmove function copies n characters from the object pointed to by s2 into the object pointed to by s1. Copying takes place as if the n characters from the object pointed to by s2 are first copied into a @@ -57,6 +58,7 @@ memmove(void *s1, const void *s2, size_t n) { return CopyMem( s1, s2, n); } +#endif /** The strcpy function copies the string pointed to by s2 (including the terminating null character) into the array pointed to by s1. If copying diff --git a/StdLib/LibC/String/Misc.c b/StdLib/LibC/String/Misc.c index 99328252ed50..f024136446e7 100644 --- a/StdLib/LibC/String/Misc.c +++ b/StdLib/LibC/String/Misc.c @@ -26,6 +26,7 @@ extern char *sys_errlist[]; +#if !((defined(MDE_CPU_ARM) || defined(MDE_CPU_AARCH64)) && defined(__GNUC__)) /** The memset function copies the value of c (converted to an unsigned char) into each of the first n characters of the object pointed to by s. @@ -36,6 +37,7 @@ memset(void *s, int c, size_t n) { return SetMem( s, (UINTN)n, (UINT8)c); } +#endif int strerror_r(int errnum, char *buf, size_t buflen) -- 2.7.4