diff mbox

[U-Boot,RFC] kbuild.h: workaround for llvm IAS

Message ID 1402609254-14078-1-git-send-email-jeroen@myspectrum.nl
State Superseded
Delegated to: Tom Rini
Headers show

Commit Message

Jeroen Hofstee June 12, 2014, 9:40 p.m. UTC
KBuild (ab)uses the asm statement to write to a file and
llvm integrated as chokes about these invalid asm statements.
Workaround it by making it look like valid asm code.

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
---
 Kbuild                 | 3 ++-
 include/linux/kbuild.h | 6 +++---
 2 files changed, 5 insertions(+), 4 deletions(-)

Does someone have a better solution?
Is this valid for all archs?

Comments

Masahiro Yamada June 24, 2014, 12:53 p.m. UTC | #1
Hi Jeroen,


On Thu, 12 Jun 2014 23:40:54 +0200
Jeroen Hofstee <jeroen@myspectrum.nl> wrote:

> KBuild (ab)uses the asm statement to write to a file and
> llvm integrated as chokes about these invalid asm statements.
> Workaround it by making it look like valid asm code.
> 
> Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

I think Linux has the same problem.

Are you willing to this patch to linux-kbuild ML?
Or fixing U-Boot only?

Best Regards
Masahiro Yamada
diff mbox

Patch

diff --git a/Kbuild b/Kbuild
index 6e1698c..ef97787 100644
--- a/Kbuild
+++ b/Kbuild
@@ -53,7 +53,8 @@  targets += arch/$(ARCH)/lib/asm-offsets.s
 
 # Default sed regexp - multiline due to syntax constraints
 define sed-y
-	"/^->/{s:->#\(.*\):/* \1 */:; \
+	"s:[[:space:]]*\.ascii[[:space:]]*\"\(.*\)\":\1:; \
+	/^->/{s:->#\(.*\):/* \1 */:; \
 	s:^->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \
 	s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
 	s:->::; p;}"
diff --git a/include/linux/kbuild.h b/include/linux/kbuild.h
index ab7805a..8a9f645 100644
--- a/include/linux/kbuild.h
+++ b/include/linux/kbuild.h
@@ -7,14 +7,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