From patchwork Mon Aug 8 11:12:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 73432 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp3157870qga; Mon, 8 Aug 2016 04:12:32 -0700 (PDT) X-Received: by 10.66.233.38 with SMTP id tt6mr160241123pac.99.1470654752874; Mon, 08 Aug 2016 04:12:32 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id j10si29869814pao.189.2016.08.08.04.12.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Aug 2016 04:12:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 7651C1A1E1E; Mon, 8 Aug 2016 04:12:32 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org 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 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: [edk2] [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: , Cc: sigmaepsilon92@gmail.com, leif.lindholm@linaro.org, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(+) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel 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)