diff options
| author | Jeroen Hofstee <jeroen@myspectrum.nl> | 2017-04-21 02:21:11 -0400 |
|---|---|---|
| committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2017-04-23 02:51:26 -0400 |
| commit | cf0c3e68aa81f992b0301f62e341b710d385bf68 (patch) | |
| tree | 7645f9967cf133854eefd270ee84264cc3d614da /scripts | |
| parent | 7dd47b95b0f54f2057d40af6e66d477e3fe95d13 (diff) | |
kbuild: fix asm-offset generation to work with clang
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.
[masahiro:
Import Jeroen's work for U-Boot:
http://patchwork.ozlabs.org/patch/375026/
Tweak sed script a little to avoid garbage '#' for GCC case, like
#define NR_PAGEFLAGS 23 /* __NR_PAGEFLAGS # */ ]
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Tested-by: Matthias Kaehlcke <mka@chromium.org>
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/Makefile.lib | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 8109c133887d..2209ed696fb4 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib | |||
| @@ -413,10 +413,14 @@ cmd_xzmisc = (cat $(filter-out FORCE,$^) | \ | |||
| 413 | # --------------------------------------------------------------------------- | 413 | # --------------------------------------------------------------------------- |
| 414 | 414 | ||
| 415 | # Default sed regexp - multiline due to syntax constraints | 415 | # Default sed regexp - multiline due to syntax constraints |
| 416 | # | ||
| 417 | # Use [:space:] because LLVM's integrated assembler inserts <tab> around | ||
| 418 | # the .ascii directive whereas GCC keeps the <space> as-is. | ||
| 416 | define sed-offsets | 419 | define sed-offsets |
| 417 | "/^->/{s:->#\(.*\):/* \1 */:; \ | 420 | 's:^[[:space:]]*\.ascii[[:space:]]*"\(.*\)".*:\1:; \ |
| 421 | /^->/{s:->#\(.*\):/* \1 */:; \ | ||
| 418 | s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \ | 422 | s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \ |
| 419 | s:->::; p;}" | 423 | s:->::; p;}' |
| 420 | endef | 424 | endef |
| 421 | 425 | ||
| 422 | # Use filechk to avoid rebuilds when a header changes, but the resulting file | 426 | # Use filechk to avoid rebuilds when a header changes, but the resulting file |
