[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1253484855-8067-2-git-send-email-tabbott@ksplice.com>
Date: Sun, 20 Sep 2009 18:14:12 -0400
From: Tim Abbott <tabbott@...lice.com>
To: Sam Ravnborg <sam@...nborg.org>
Cc: linux-kernel@...r.kernel.org, Tim Abbott <tabbott@...lice.com>,
Sam Ravnborg <sam@...nborg.org>
Subject: [PATCH v4 1/4] kbuild: Don't define ALIGN and ENTRY when preprocessing linker scripts.
Adding a reference to <linux/linkage.h> to x86's <asm/cache.h> causes
the x86 linker script to have syntax errors, because the ALIGN and
ENTRY keywords get redefined to the assembly implementations of those.
One could fix this by adjusting the include structure, but I think any
solution based on that approach would be fragile.
Currently, it is impossible when writing a header to do something
different for assembly files and linker scripts, even though there are
clearly cases where one wants them to define macros differently for
the two (ENTRY being an excellent example). So I think the right
solution here is to introduce a new preprocessor definition,
tentatively called LINKER_SCRIPT that is set along with __ASSEMBLY__
for linker scripts, and to use that to not define ALIGN and ENTRY in
linker scripts. I suspect we'll find other uses for this mechanism in
the future.
Signed-off-by: Tim Abbott <tabbott@...lice.com>
Cc: Sam Ravnborg <sam@...nborg.org>
---
include/linux/linkage.h | 2 ++
scripts/Makefile.build | 2 +-
2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index 691f591..5126cce 100644
--- a/include/linux/linkage.h
+++ b/include/linux/linkage.h
@@ -57,6 +57,7 @@
#ifdef __ASSEMBLY__
+#ifndef LINKER_SCRIPT
#define ALIGN __ALIGN
#define ALIGN_STR __ALIGN_STR
@@ -66,6 +67,7 @@
ALIGN; \
name:
#endif
+#endif /* LINKER_SCRIPT */
#ifndef WEAK
#define WEAK(name) \
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index d542566..341b589 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -271,7 +271,7 @@ targets += $(extra-y) $(MAKECMDGOALS) $(always)
# ---------------------------------------------------------------------------
quiet_cmd_cpp_lds_S = LDS $@
cmd_cpp_lds_S = $(CPP) $(cpp_flags) -P -C -U$(ARCH) \
- -D__ASSEMBLY__ -o $@ $<
+ -D__ASSEMBLY__ -DLINKER_SCRIPT -o $@ $<
$(obj)/%.lds: $(src)/%.lds.S FORCE
$(call if_changed_dep,cpp_lds_S)
--
1.6.3.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists