Skip to content

Instantly share code, notes, and snippets.

@nathanchance
Created December 14, 2018 07:11
Show Gist options
  • Save nathanchance/90b04d2d08d6faff799461d586e6ebcd to your computer and use it in GitHub Desktop.
Save nathanchance/90b04d2d08d6faff799461d586e6ebcd to your computer and use it in GitHub Desktop.
From 93926cb441d2c82c31be82ab4078c6750b88cffb Mon Sep 17 00:00:00 2001
From: Nathan Chancellor <natechancellor@gmail.com>
Date: Sun, 30 Sep 2018 18:35:46 -0700
Subject: [PATCH 1/6] DO-NOT-UPSTREAM: Disable GCOV_KERNEL for Clang
Patches currently in testing, just don't want to add them to my stack.
Link: https://github.com/ClangBuiltLinux/linux/issues/17
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
kernel/gcov/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/gcov/Kconfig b/kernel/gcov/Kconfig
index 1e3823fa799b..8d3dc2303618 100644
--- a/kernel/gcov/Kconfig
+++ b/kernel/gcov/Kconfig
@@ -2,7 +2,7 @@ menu "GCOV-based kernel profiling"
config GCOV_KERNEL
bool "Enable gcov-based kernel profiling"
- depends on DEBUG_FS
+ depends on DEBUG_FS && !CC_IS_CLANG
select CONSTRUCTORS if !UML
default n
---help---
--
2.20.0
From c40b4e71bae925e6358b2a83529933db9547746e Mon Sep 17 00:00:00 2001
From: Nathan Chancellor <natechancellor@gmail.com>
Date: Sun, 30 Sep 2018 18:32:55 -0700
Subject: [PATCH 2/6] DO-NOT-UPSTREAM: Disable CPU_BIG_ENDIAN with Clang
This is currently broken and requires disabling it to build anyways.
Link: https://github.com/ClangBuiltLinux/linux/issues/36
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
arch/arm/mm/Kconfig | 2 +-
arch/arm64/Kconfig | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index b169e580bf82..63fdc70552aa 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -741,7 +741,7 @@ config SWP_EMULATE
config CPU_BIG_ENDIAN
bool "Build big-endian kernel"
- depends on ARCH_SUPPORTS_BIG_ENDIAN
+ depends on ARCH_SUPPORTS_BIG_ENDIAN && !CC_IS_CLANG
help
Say Y if you plan on running a kernel in big-endian mode.
Note that your board must be properly built and your board
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 1f52362f8d99..9c351683ac62 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -773,6 +773,7 @@ config ARM64_PA_BITS
config CPU_BIG_ENDIAN
bool "Build big-endian kernel"
+ depends on !CC_IS_CLANG
help
Say Y if you plan on running a kernel in big-endian mode.
--
2.20.0
From 64567e2870bbbbc204b2843a5fa0301025d8d60d Mon Sep 17 00:00:00 2001
From: Nathan Chancellor <natechancellor@gmail.com>
Date: Mon, 10 Dec 2018 17:59:43 -0700
Subject: [PATCH 3/6] 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 062fa2c9af9539600818f1c40ba5b8fd02648386 Mon Sep 17 00:00:00 2001
From: Nathan Chancellor <natechancellor@gmail.com>
Date: Mon, 10 Dec 2018 18:16:25 -0700
Subject: [PATCH 4/6] 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 c350a1afd9c0cfce7723f097bb5e09f76e79b5e2 Mon Sep 17 00:00:00 2001
From: Nathan Chancellor <natechancellor@gmail.com>
Date: Fri, 30 Nov 2018 22:31:38 -0700
Subject: [PATCH 5/6] 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 c266762c4b3e12a65d2fff831ea9def42327fc19 Mon Sep 17 00:00:00 2001
From: Nathan Chancellor <natechancellor@gmail.com>
Date: Tue, 4 Dec 2018 18:42:13 -0700
Subject: [PATCH 6/6] 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