Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1601761

[PATCH 1/2] x86, boot: #undef memcpy etc in string.c

Path csiph.com!feeder.erje.net!1.us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!news.unit0.net!news.panservice.it!diesel.cu.mi.it!bofh.it!news.nic.it!robomod
From Michael Davidson <md@google.com>
Newsgroups linux.kernel
Subject [PATCH 1/2] x86, boot: #undef memcpy etc in string.c
Date Wed, 15 Mar 2017 22:50:02 +0100
Message-ID <tloXT-59Y-9@gated-at.bofh.it> (permalink)
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=wqN7HARs9ohC1HJodClsBLIFnMS281O+mzllTvzv4Y0=; b=I8Utcaladkz7FMt/BvZ1FO1Rqkqy2B9ua0sUrZ61Jh9LTan6UNQLoBMFtmpNntYG2i u9Dj22u/RrnihL4EefjI5QuRJyV6Sl6VuCO24kqW/1QJgDuCRvUl3V33nDk+9JJEIVrN XcTPyc5hQ93C4Jio2YlvCvppIRTkL3US6PbzhA1LezS2xDWE7pgQTJgzCKoCvjXrduC+ BfP68y/y+642VIxarOlUSGmrhUs1Tj0WIQdFXtTlemCgH6Z1QAIOzNrMQwaBjk7mbPf1 TYa9qxl9jFI9SLfW4UpIdVp7DLeTXj5UrTfzeuyIaNoBGZVNaDzFAbPdj4olVyNfw2Fb IP4g==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=wqN7HARs9ohC1HJodClsBLIFnMS281O+mzllTvzv4Y0=; b=R5F7NlL9Kcr7XlFUETJ+1pF5MK+llAOQAIIZFSnO1HLcvh5WyqQbdfvUScSXrNg2/+ M3Iy6oAr4TeTxeVwcX1eN+YdoB9fEgBy+J6IGOTRekJUJ0a3mzgQ+cWdxRDOK/URq4T9 /eIYwnu1NiUxw3MNGOgLoqL/CODEeb/3jQMV3/d0pJQ9J/f7KYRV+mOb6lgV//TQJqrT sxhMaSPgd5h77T1CECsJo0PaPP7uNUWA9Xu0UhrR7VU66bIkbsJu9ZtWsWolQvZVOtAp 8dkJfjcvWoQpNcPmGCbDE59gxljndCoc1imvO8nTqeB74kaKO2HqfpMBo6TL9/4HEIkQ SqtA==
X-Gm-Message-State AFeK/H0T9MzFBfrh8y2FS9GU3UJ9JrlBehq6KXXMMGEXbCGBKhGGZZOUR7bB61h93WjejrpR
X-Received by 10.99.109.138 with SMTP id i132mr6053104pgc.11.1489614526823; Wed, 15 Mar 2017 14:48:46 -0700 (PDT)
X-Mailer git-send-email 2.12.0.367.g23dc2f6d3c-goog
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 37
Organization linux.* mail to news gateway
X-Original-Cc Alexander Potapenko <glider@google.com>, Dmitry Vyukov <dvyukov@google.com>, x86@kernel.org, linux-kernel@vger.kernel.org, Michael Davidson <md@google.com>
X-Original-Date Wed, 15 Mar 2017 14:48:20 -0700
X-Original-Message-ID <20170315214821.127170-1-md@google.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1601761

Show key headers only | View raw


undef memcpy and friends in boot/string.c so that the functions
defined here will have the correct names, otherwise we end up
up trying to redefine __builtin_memcpy etc.
Surprisingly, gcc allows this (and, helpfully, discards the
--builtin_ prefix from the function name when compiling it),
but clang does not.

Adding these #undef's appears to preserve what I assume was
the original intent of the code.

Signed-off-by: Michael Davidson <md@google.com>
---
 arch/x86/boot/string.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/x86/boot/string.c b/arch/x86/boot/string.c
index 5457b02fc050..b40266850869 100644
--- a/arch/x86/boot/string.c
+++ b/arch/x86/boot/string.c
@@ -16,6 +16,15 @@
 #include "ctype.h"
 #include "string.h"
 
+/*
+ * Undef these macros so that the functions that we provide
+ * here will have the correct names regardless of how string.h
+ * may have chosen to #define them.
+ */
+#undef memcpy
+#undef memset
+#undef memcmp
+
 int memcmp(const void *s1, const void *s2, size_t len)
 {
 	bool diff;
-- 
2.12.0.367.g23dc2f6d3c-goog

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 1/2] x86, boot: #undef memcpy etc in string.c Michael Davidson <md@google.com> - 2017-03-15 22:50 +0100

csiph-web