Skip to content

Instantly share code, notes, and snippets.

@nathanchance
Created December 14, 2018 07:08
Show Gist options
  • Save nathanchance/6fc0e3f23ac86f2c88c6671cc9ee830d to your computer and use it in GitHub Desktop.
Save nathanchance/6fc0e3f23ac86f2c88c6671cc9ee830d to your computer and use it in GitHub Desktop.
From 8c16eb5d852c426449c35f5c638fa0241de59900 Mon Sep 17 00:00:00 2001
From: Nathan Chancellor <natechancellor@gmail.com>
Date: Mon, 10 Dec 2018 17:59:43 -0700
Subject: [PATCH 1/4] DO-NOT-UPSTREAM: arm: Don't select HAVE_FUNCTION_TRACER
with Clang
Link: https://github.com/ClangBuiltLinux/linux/issues/35
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
arch/arm/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 0839905593a8..bc614b715361 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -71,7 +71,7 @@ config ARM
select HAVE_EXIT_THREAD
select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL
- select HAVE_FUNCTION_TRACER if !XIP_KERNEL
+ select HAVE_FUNCTION_TRACER if !XIP_KERNEL && !CC_IS_CLANG
select HAVE_GCC_PLUGINS
select HAVE_GENERIC_DMA_COHERENT
select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7)
--
2.20.0
From 72ce7b51e427cf3e910eaf8bee2d10dc9670c22b Mon Sep 17 00:00:00 2001
From: Nathan Chancellor <natechancellor@gmail.com>
Date: Mon, 10 Dec 2018 18:16:25 -0700
Subject: [PATCH 2/4] DO-NOT-UPSTREAM: arm hax for neon
Link: https://github.com/ClangBuiltLinux/linux/issues/287
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
arch/arm/lib/xor-neon.c | 4 ----
lib/raid6/neon.uc | 3 +++
lib/raid6/recov_neon_inner.c | 3 +++
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/arch/arm/lib/xor-neon.c b/arch/arm/lib/xor-neon.c
index 2c40aeab3eaa..9e0a03f308b4 100644
--- a/arch/arm/lib/xor-neon.c
+++ b/arch/arm/lib/xor-neon.c
@@ -13,10 +13,6 @@
MODULE_LICENSE("GPL");
-#ifndef __ARM_NEON__
-#error You should compile this file with '-mfloat-abi=softfp -mfpu=neon'
-#endif
-
/*
* Pull in the reference implementations while instructing GCC (through
* -ftree-vectorize) to attempt to exploit implicit parallelism and emit
diff --git a/lib/raid6/neon.uc b/lib/raid6/neon.uc
index d5242f544551..caa0b56923f9 100644
--- a/lib/raid6/neon.uc
+++ b/lib/raid6/neon.uc
@@ -24,6 +24,9 @@
* This file is postprocessed using unroll.awk
*/
+#ifdef CONFIG_ARM
+#define __ARM_NEON 1
+#endif
#include <arm_neon.h>
typedef uint8x16_t unative_t;
diff --git a/lib/raid6/recov_neon_inner.c b/lib/raid6/recov_neon_inner.c
index 8cd20c9f834a..b733d1e68a61 100644
--- a/lib/raid6/recov_neon_inner.c
+++ b/lib/raid6/recov_neon_inner.c
@@ -8,6 +8,9 @@
* of the License.
*/
+#ifdef CONFIG_ARM
+#define __ARM_NEON 1
+#endif
#include <arm_neon.h>
static const uint8x16_t x0f = {
--
2.20.0
From 751e5656d0e41e584b3e2c2aa0d63a2ea4ae4cd3 Mon Sep 17 00:00:00 2001
From: Nathan Chancellor <natechancellor@gmail.com>
Date: Fri, 30 Nov 2018 22:31:38 -0700
Subject: [PATCH 3/4] ARM: Remove '-p' from LDFLAGS
This option is not supported by lld:
ld.lld: error: unknown argument: -p
This has been a no-op in binutils since 2004 (see commit dea514f51da1 in
that tree). Given that the lowest officially supported of binutils for
the kernel is 2.20, which was released in 2009, nobody needs this flag
around so just remove it. Commit 1a381d4a0a9a ("arm64: remove no-op -p
linker flag") did the same for arm64.
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
arch/arm/Makefile | 2 +-
arch/arm/boot/compressed/Makefile | 2 --
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 0436002d5091..1d48c8ed5f89 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -10,7 +10,7 @@
#
# Copyright (C) 1995-2001 by Russell King
-LDFLAGS_vmlinux :=-p --no-undefined -X --pic-veneer
+LDFLAGS_vmlinux := --no-undefined -X --pic-veneer
ifeq ($(CONFIG_CPU_ENDIAN_BE8),y)
LDFLAGS_vmlinux += --be8
KBUILD_LDFLAGS_MODULE += --be8
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index 01bf2585a0fa..ecfa4ca320a7 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -132,8 +132,6 @@ endif
ifeq ($(CONFIG_CPU_ENDIAN_BE8),y)
LDFLAGS_vmlinux += --be8
endif
-# ?
-LDFLAGS_vmlinux += -p
# Report unresolved symbol references
LDFLAGS_vmlinux += --no-undefined
# Delete all temporary local symbols
--
2.20.0
From 51f52bdf293273f1c4eb6c11fe16040c86430d49 Mon Sep 17 00:00:00 2001
From: Nathan Chancellor <natechancellor@gmail.com>
Date: Tue, 4 Dec 2018 18:42:13 -0700
Subject: [PATCH 4/4] ARM: Wrap '--pic-veneer' with ld-option
This flag is not supported by lld:
ld.lld: error: unknown argument: --pic-veneer
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
arch/arm/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 1d48c8ed5f89..f22f46183cd1 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -10,7 +10,7 @@
#
# Copyright (C) 1995-2001 by Russell King
-LDFLAGS_vmlinux := --no-undefined -X --pic-veneer
+LDFLAGS_vmlinux := --no-undefined -X $(call ld-option,--pic-veneer)
ifeq ($(CONFIG_CPU_ENDIAN_BE8),y)
LDFLAGS_vmlinux += --be8
KBUILD_LDFLAGS_MODULE += --be8
--
2.20.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment