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


Groups > linux.kernel > #1623527 > unrolled thread

[PATCH 0/2] kbuild: cleanup asm-offset generation, and make it work with clang

Started byMasahiro Yamada <yamada.masahiro@socionext.com>
First post2017-04-14 08:00 +0200
Last post2017-04-14 19:50 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/2] kbuild: cleanup asm-offset generation, and make it work with clang Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-04-14 08:00 +0200
    [PATCH 2/2] kbuild: fix asm-offset generation to work with clang Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-04-14 08:00 +0200
      Re: [PATCH 2/2] kbuild: fix asm-offset generation to work with clang Matthias Kaehlcke <mka@chromium.org> - 2017-04-14 19:50 +0200

#1623527 — [PATCH 0/2] kbuild: cleanup asm-offset generation, and make it work with clang

FromMasahiro Yamada <yamada.masahiro@socionext.com>
Date2017-04-14 08:00 +0200
Subject[PATCH 0/2] kbuild: cleanup asm-offset generation, and make it work with clang
Message-ID<tw2qZ-5Iz-3@gated-at.bofh.it>
1/2 is a trivial cleanup of sed script
2/2 imports clang work-around from U-Boot.


Jeroen Hofstee (1):
  kbuild: fix asm-offset generation to work with clang

Masahiro Yamada (1):
  kbuild: consolidate redundant sed script ASM offset generation

 include/linux/kbuild.h | 6 +++---
 scripts/Makefile.lib   | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

-- 
2.7.4

[toc] | [next] | [standalone]


#1623528 — [PATCH 2/2] kbuild: fix asm-offset generation to work with clang

FromMasahiro Yamada <yamada.masahiro@socionext.com>
Date2017-04-14 08:00 +0200
Subject[PATCH 2/2] kbuild: fix asm-offset generation to work with clang
Message-ID<tw2qZ-5Iz-5@gated-at.bofh.it>
In reply to#1623527
From: Jeroen Hofstee <jeroen@myspectrum.nl>

KBuild abuses the asm statement to write to a file and
clang chokes about these invalid asm statements. Hack it
even more by fooling this is actual valid asm code.

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
[masahiro:
 Import Jeroen's work for U-Boot:
 http://patchwork.ozlabs.org/patch/375026/
 Tweak sed script a little to drop garbage '#' for GCC case, like
 #define NR_PAGEFLAGS 23 /* __NR_PAGEFLAGS       # */ ]
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

---

 include/linux/kbuild.h | 6 +++---
 scripts/Makefile.lib   | 5 +++--
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/include/linux/kbuild.h b/include/linux/kbuild.h
index 22a7219..4e80f3a 100644
--- a/include/linux/kbuild.h
+++ b/include/linux/kbuild.h
@@ -2,14 +2,14 @@
 #define __LINUX_KBUILD_H
 
 #define DEFINE(sym, val) \
-        asm volatile("\n->" #sym " %0 " #val : : "i" (val))
+	asm volatile("\n.ascii \"->" #sym " %0 " #val "\"" : : "i" (val))
 
-#define BLANK() asm volatile("\n->" : : )
+#define BLANK() asm volatile("\n.ascii \"->\"" : : )
 
 #define OFFSET(sym, str, mem) \
 	DEFINE(sym, offsetof(struct str, mem))
 
 #define COMMENT(x) \
-	asm volatile("\n->#" x)
+	asm volatile("\n.ascii \"->#" x "\"")
 
 #endif
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 9c20690..a050859 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -414,9 +414,10 @@ cmd_xzmisc = (cat $(filter-out FORCE,$^) | \
 
 # Default sed regexp - multiline due to syntax constraints
 define sed-offsets
-	"/^->/{s:->#\(.*\):/* \1 */:; \
+	's:^\.ascii *"\(.*\)".*:\1:; \
+	/^->/{s:->#\(.*\):/* \1 */:; \
 	s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
-	s:->::; p;}"
+	s:->::; p;}'
 endef
 
 # Use filechk to avoid rebuilds when a header changes, but the resulting file
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1623812 — Re: [PATCH 2/2] kbuild: fix asm-offset generation to work with clang

FromMatthias Kaehlcke <mka@chromium.org>
Date2017-04-14 19:50 +0200
SubjectRe: [PATCH 2/2] kbuild: fix asm-offset generation to work with clang
Message-ID<twdw5-404-9@gated-at.bofh.it>
In reply to#1623528
El Fri, Apr 14, 2017 at 02:50:03PM +0900 Masahiro Yamada ha dit:

> From: Jeroen Hofstee <jeroen@myspectrum.nl>
> 
> KBuild abuses the asm statement to write to a file and
> clang chokes about these invalid asm statements. Hack it
> even more by fooling this is actual valid asm code.
> 
> Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
> [masahiro:
>  Import Jeroen's work for U-Boot:
>  http://patchwork.ozlabs.org/patch/375026/
>  Tweak sed script a little to drop garbage '#' for GCC case, like
>  #define NR_PAGEFLAGS 23 /* __NR_PAGEFLAGS       # */ ]
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Tested-by: Matthias Kaehlcke <mka@chromium.org>

I tested with x86 and arm64. Please note that two more changes are
needed to avoid breaking frv and um:

https://patchwork.kernel.org/patch/9660473/
https://patchwork.kernel.org/patch/9660503/

Maybe these should be part of your patch set? I only sent them out
separately to avoid cross posting with my initial patch for this issue
being a RFC.

Cheers

Matthias

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web