* [PATCH 0/2] kbuild: cleanup asm-offset generation, and make it work with clang
@ 2017-04-14 5:50 Masahiro Yamada
2017-04-14 5:50 ` [PATCH 1/2] kbuild: consolidate redundant sed script ASM offset generation Masahiro Yamada
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Masahiro Yamada @ 2017-04-14 5:50 UTC (permalink / raw)
To: linux-kbuild
Cc: Matthias Kaehlcke, David Howells, Michael Davidson, Michal Marek,
Jan Beulich, Alexander van Heukelum, Masahiro Yamada,
Jeroen Hofstee, linux-kernel
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/2] kbuild: consolidate redundant sed script ASM offset generation
2017-04-14 5:50 [PATCH 0/2] kbuild: cleanup asm-offset generation, and make it work with clang Masahiro Yamada
@ 2017-04-14 5:50 ` Masahiro Yamada
2017-04-14 16:51 ` Matthias Kaehlcke
2017-04-14 5:50 ` [PATCH 2/2] kbuild: fix asm-offset generation to work with clang Masahiro Yamada
2017-04-18 9:57 ` [PATCH 1/2] kbuild: consolidate redundant sed script ASM offset generation David Howells
2 siblings, 1 reply; 9+ messages in thread
From: Masahiro Yamada @ 2017-04-14 5:50 UTC (permalink / raw)
To: linux-kbuild
Cc: Matthias Kaehlcke, David Howells, Michael Davidson, Michal Marek,
Jan Beulich, Alexander van Heukelum, Masahiro Yamada,
linux-kernel
This part ended up in redundant code after touched by multiple
people.
[1] Commit 3234282f33b2 ("x86, asm: Fix CFI macro invocations to
deal with shortcomings in gas") added parentheses for defined
expressions to support old gas for x86.
[2] Commit a22dcdb0032c ("x86, asm: Fix ancient-GAS workaround")
split the pattern into two to avoid parentheses for non-numeric
expressions.
[3] Commit 95a2f6f72d37 ("Partially revert patch that encloses
asm-offset.h numbers in brackets") removed parentheses from numeric
expressions as well because parentheses in MN10300 assembly have a
special meaning (pointer access).
Apparently, there is a conflict between [1] and [3]. After all,
[3] took precedence, and a long time has passed since then.
Now, merge the two patterns again because the first one is covered
by the other.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---
scripts/Makefile.lib | 1 -
1 file changed, 1 deletion(-)
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index e36427a..9c20690 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -415,7 +415,6 @@ cmd_xzmisc = (cat $(filter-out FORCE,$^) | \
# Default sed regexp - multiline due to syntax constraints
define sed-offsets
"/^->/{s:->#\(.*\):/* \1 */:; \
- s:^->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \
s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
s:->::; p;}"
endef
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/2] kbuild: fix asm-offset generation to work with clang
2017-04-14 5:50 [PATCH 0/2] kbuild: cleanup asm-offset generation, and make it work with clang Masahiro Yamada
2017-04-14 5:50 ` [PATCH 1/2] kbuild: consolidate redundant sed script ASM offset generation Masahiro Yamada
@ 2017-04-14 5:50 ` Masahiro Yamada
2017-04-14 17:44 ` Matthias Kaehlcke
2017-04-18 9:57 ` [PATCH 1/2] kbuild: consolidate redundant sed script ASM offset generation David Howells
2 siblings, 1 reply; 9+ messages in thread
From: Masahiro Yamada @ 2017-04-14 5:50 UTC (permalink / raw)
To: linux-kbuild
Cc: Matthias Kaehlcke, David Howells, Michael Davidson, Michal Marek,
Jan Beulich, Alexander van Heukelum, Jeroen Hofstee,
Masahiro Yamada, linux-kernel
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
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] kbuild: consolidate redundant sed script ASM offset generation
2017-04-14 5:50 ` [PATCH 1/2] kbuild: consolidate redundant sed script ASM offset generation Masahiro Yamada
@ 2017-04-14 16:51 ` Matthias Kaehlcke
0 siblings, 0 replies; 9+ messages in thread
From: Matthias Kaehlcke @ 2017-04-14 16:51 UTC (permalink / raw)
To: Masahiro Yamada
Cc: linux-kbuild, David Howells, Michael Davidson, Michal Marek,
Jan Beulich, Alexander van Heukelum, linux-kernel
El Fri, Apr 14, 2017 at 02:50:02PM +0900 Masahiro Yamada ha dit:
> This part ended up in redundant code after touched by multiple
> people.
>
> [1] Commit 3234282f33b2 ("x86, asm: Fix CFI macro invocations to
> deal with shortcomings in gas") added parentheses for defined
> expressions to support old gas for x86.
>
> [2] Commit a22dcdb0032c ("x86, asm: Fix ancient-GAS workaround")
> split the pattern into two to avoid parentheses for non-numeric
> expressions.
>
> [3] Commit 95a2f6f72d37 ("Partially revert patch that encloses
> asm-offset.h numbers in brackets") removed parentheses from numeric
> expressions as well because parentheses in MN10300 assembly have a
> special meaning (pointer access).
>
> Apparently, there is a conflict between [1] and [3]. After all,
> [3] took precedence, and a long time has passed since then.
>
> Now, merge the two patterns again because the first one is covered
> by the other.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Thanks
Matthias
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] kbuild: fix asm-offset generation to work with clang
2017-04-14 5:50 ` [PATCH 2/2] kbuild: fix asm-offset generation to work with clang Masahiro Yamada
@ 2017-04-14 17:44 ` Matthias Kaehlcke
0 siblings, 0 replies; 9+ messages in thread
From: Matthias Kaehlcke @ 2017-04-14 17:44 UTC (permalink / raw)
To: Masahiro Yamada
Cc: linux-kbuild, David Howells, Michael Davidson, Michal Marek,
Jan Beulich, Alexander van Heukelum, Jeroen Hofstee,
linux-kernel
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] kbuild: consolidate redundant sed script ASM offset generation
2017-04-14 5:50 [PATCH 0/2] kbuild: cleanup asm-offset generation, and make it work with clang Masahiro Yamada
2017-04-14 5:50 ` [PATCH 1/2] kbuild: consolidate redundant sed script ASM offset generation Masahiro Yamada
2017-04-14 5:50 ` [PATCH 2/2] kbuild: fix asm-offset generation to work with clang Masahiro Yamada
@ 2017-04-18 9:57 ` David Howells
2017-04-18 10:20 ` Masahiro Yamada
2017-04-18 13:15 ` David Howells
2 siblings, 2 replies; 9+ messages in thread
From: David Howells @ 2017-04-18 9:57 UTC (permalink / raw)
To: Masahiro Yamada
Cc: dhowells, linux-kbuild, Matthias Kaehlcke, Michael Davidson,
Michal Marek, Jan Beulich, Alexander van Heukelum, linux-kernel
Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
> This part ended up in redundant code after touched by multiple
> people.
>
> [1] Commit 3234282f33b2 ("x86, asm: Fix CFI macro invocations to
> deal with shortcomings in gas") added parentheses for defined
> expressions to support old gas for x86.
>
> [2] Commit a22dcdb0032c ("x86, asm: Fix ancient-GAS workaround")
> split the pattern into two to avoid parentheses for non-numeric
> expressions.
>
> [3] Commit 95a2f6f72d37 ("Partially revert patch that encloses
> asm-offset.h numbers in brackets") removed parentheses from numeric
> expressions as well because parentheses in MN10300 assembly have a
> special meaning (pointer access).
>
> Apparently, there is a conflict between [1] and [3]. After all,
> [3] took precedence, and a long time has passed since then.
There's a conflict between [1] and various assembly code formats. Some
formats define, say,
mov 4,r1
to move the number 4 into register r1, and:
mov (4),r1
to move the contents of the memory at address 4 into r1. Therefore, you
cannot simply wrap numeric operands in brackets. What might work is adding a
'+' on the front, e.g.:
mov +(4),r1
David
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] kbuild: consolidate redundant sed script ASM offset generation
2017-04-18 9:57 ` [PATCH 1/2] kbuild: consolidate redundant sed script ASM offset generation David Howells
@ 2017-04-18 10:20 ` Masahiro Yamada
2017-04-18 13:15 ` David Howells
1 sibling, 0 replies; 9+ messages in thread
From: Masahiro Yamada @ 2017-04-18 10:20 UTC (permalink / raw)
To: David Howells
Cc: Linux Kbuild mailing list, Matthias Kaehlcke, Michael Davidson,
Michal Marek, Jan Beulich, Alexander van Heukelum,
Linux Kernel Mailing List
Hi David,
2017-04-18 18:57 GMT+09:00 David Howells <dhowells@redhat.com>:
> Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
>
>> This part ended up in redundant code after touched by multiple
>> people.
>>
>> [1] Commit 3234282f33b2 ("x86, asm: Fix CFI macro invocations to
>> deal with shortcomings in gas") added parentheses for defined
>> expressions to support old gas for x86.
>>
>> [2] Commit a22dcdb0032c ("x86, asm: Fix ancient-GAS workaround")
>> split the pattern into two to avoid parentheses for non-numeric
>> expressions.
>>
>> [3] Commit 95a2f6f72d37 ("Partially revert patch that encloses
>> asm-offset.h numbers in brackets") removed parentheses from numeric
>> expressions as well because parentheses in MN10300 assembly have a
>> special meaning (pointer access).
>>
>> Apparently, there is a conflict between [1] and [3]. After all,
>> [3] took precedence, and a long time has passed since then.
>
> There's a conflict between [1] and various assembly code formats. Some
> formats define, say,
>
> mov 4,r1
>
> to move the number 4 into register r1, and:
>
> mov (4),r1
>
> to move the contents of the memory at address 4 into r1. Therefore, you
> cannot simply wrap numeric operands in brackets. What might work is adding a
> '+' on the front, e.g.:
>
> mov +(4),r1
>
> David
OK, thanks for this info.
But, nobody has raised a flag about the reverted [1].
(perhaps, nobody cares about the old gas any more?)
So, I think this patch will be OK.
BTW, do you still maintain mn10300?
(Before, I worked for Panasonic, i.e. former Matsushita)
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] kbuild: consolidate redundant sed script ASM offset generation
2017-04-18 9:57 ` [PATCH 1/2] kbuild: consolidate redundant sed script ASM offset generation David Howells
2017-04-18 10:20 ` Masahiro Yamada
@ 2017-04-18 13:15 ` David Howells
2017-04-18 14:03 ` Masahiro Yamada
1 sibling, 1 reply; 9+ messages in thread
From: David Howells @ 2017-04-18 13:15 UTC (permalink / raw)
To: Masahiro Yamada
Cc: dhowells, Linux Kbuild mailing list, Matthias Kaehlcke,
Michael Davidson, Michal Marek, Jan Beulich,
Alexander van Heukelum, Linux Kernel Mailing List
Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
> BTW, do you still maintain mn10300?
Kind of. I don't really have working hardware any more, though.
David
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] kbuild: consolidate redundant sed script ASM offset generation
2017-04-18 13:15 ` David Howells
@ 2017-04-18 14:03 ` Masahiro Yamada
0 siblings, 0 replies; 9+ messages in thread
From: Masahiro Yamada @ 2017-04-18 14:03 UTC (permalink / raw)
To: David Howells
Cc: Linux Kbuild mailing list, Matthias Kaehlcke, Michael Davidson,
Michal Marek, Jan Beulich, Alexander van Heukelum,
Linux Kernel Mailing List
Hi David,
2017-04-18 22:15 GMT+09:00 David Howells <dhowells@redhat.com>:
> Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
>
>> BTW, do you still maintain mn10300?
>
> Kind of. I don't really have working hardware any more, though.
>
> David
Thanks for maintaining this.
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2017-04-18 14:03 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-14 5:50 [PATCH 0/2] kbuild: cleanup asm-offset generation, and make it work with clang Masahiro Yamada
2017-04-14 5:50 ` [PATCH 1/2] kbuild: consolidate redundant sed script ASM offset generation Masahiro Yamada
2017-04-14 16:51 ` Matthias Kaehlcke
2017-04-14 5:50 ` [PATCH 2/2] kbuild: fix asm-offset generation to work with clang Masahiro Yamada
2017-04-14 17:44 ` Matthias Kaehlcke
2017-04-18 9:57 ` [PATCH 1/2] kbuild: consolidate redundant sed script ASM offset generation David Howells
2017-04-18 10:20 ` Masahiro Yamada
2017-04-18 13:15 ` David Howells
2017-04-18 14:03 ` Masahiro Yamada
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.