[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200326123841.134068-1-courbet@google.com>
Date: Thu, 26 Mar 2020 13:38:39 +0100
From: Clement Courbet <courbet@...gle.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Nathan Chancellor <natechancellor@...il.com>,
Kees Cook <keescook@...omium.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Joe Perches <joe@...ches.com>,
Bernd Petrovitsch <bernd@...rovitsch.priv.at>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
Michael Ellerman <mpe@...erman.id.au>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
Segher Boessenkool <segher@...nel.crashing.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Allison Randal <allison@...utok.net>,
Clement Courbet <courbet@...gle.com>,
linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org,
clang-built-linux@...glegroups.com
Subject: [PATCH] x86: Alias memset to __builtin_memset.
I discussed with the original authors who added freestanding to our
build. It turns out that it was added globally but this was just to
to workaround powerpc not compiling under clang, but they felt the
fix was appropriate globally.
Now Nick has dug up https://lkml.org/lkml/2019/8/29/1300, which
advises against freestanding. Also, I've did some research and
discovered that the original reason for using freestanding for
powerpc has been fixed here:
https://lore.kernel.org/linuxppc-dev/20191119045712.39633-3-natechancellor@gmail.com/
I'm going to remove -ffreestanding from downstream, so we don't really need
this anymore, sorry for waisting people's time.
I wonder if the freestanding fix from the aforementioned patch is really needed
though. I think that clang is actually right to point out the issue.
I don't see any reason why setjmp()/longjmp() are declared as taking longs
rather than ints. The implementation looks like it only ever propagates the
value (in longjmp) or sets it to 1 (in setjmp), and we only ever call longjmp
with integer parameters. But I'm not a PowerPC expert, so I might
be misreading the code.
So it seems that we could just remove freestanding altogether and rewrite the
code to:
diff --git a/arch/powerpc/include/asm/setjmp.h b/arch/powerpc/include/asm/setjmp.h
index 279d03a1eec6..7941ae68fe21 100644
--- a/arch/powerpc/include/asm/setjmp.h
+++ b/arch/powerpc/include/asm/setjmp.h
@@ -12,7 +12,9 @@
#define JMP_BUF_LEN 23
-extern long setjmp(long *);
-extern void longjmp(long *, long);
+typedef long * jmp_buf;
+
+extern int setjmp(jmp_buf);
+extern void longjmp(jmp_buf, int);
I'm happy to send a patch for this, and get rid of more -ffreestanding.
Opinions ?
Powered by blists - more mailing lists