mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tim Abbott <tabbott@ksplice.com>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: Sam Ravnborg <sam@ravnborg.org>, Tim Abbott <tabbott@ksplice.com>
Subject: [PATCH v2 1/5] kbuild: Don't define ALIGN and ENTRY when preprocessing linker scripts.
Date: Tue,  8 Sep 2009 22:49:02 -0400	[thread overview]
Message-ID: <1252464546-26394-2-git-send-email-tabbott@ksplice.com> (raw)
In-Reply-To: <1252464546-26394-1-git-send-email-tabbott@ksplice.com>

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@ksplice.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 include/linux/linkage.h |    2 ++
 scripts/Makefile.build  |    3 ++-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index 691f591..be874bb 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 5c4b7a4..e51e213 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -269,7 +269,8 @@ targets += $(extra-y) $(MAKECMDGOALS) $(always)
 # Linker scripts preprocessor (.lds.S -> .lds)
 # ---------------------------------------------------------------------------
 quiet_cmd_cpp_lds_S = LDS     $@
-      cmd_cpp_lds_S = $(CPP) $(cpp_flags) -D__ASSEMBLY__ -o $@ $<
+      cmd_cpp_lds_S = $(CPP) $(cpp_flags) -D__ASSEMBLY__ -D__LINKER_SCRIPT__ \
+		      -o $@ $<
 
 $(obj)/%.lds: $(src)/%.lds.S FORCE
 	$(call if_changed_dep,cpp_lds_S)
-- 
1.6.3.3


  reply	other threads:[~2009-09-09  2:51 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-09  2:49 [PATCH v2 0/5] Use macros rather than hardcoding section names Tim Abbott
2009-09-09  2:49 ` Tim Abbott [this message]
2009-09-09  2:49 ` [PATCH v2 2/5] Use new __init_task_data macro in arch init_task.c files Tim Abbott
2009-09-09  2:55   ` Paul Mundt
2009-09-09  2:58   ` Daniel Walker
2009-09-09  3:03     ` Joe Perches
2009-09-09  3:07       ` Daniel Walker
2009-09-09  3:10         ` Joe Perches
2009-09-09  3:21           ` Daniel Walker
2009-09-09  3:31             ` Joe Perches
2009-09-09  3:44               ` Daniel Walker
2009-09-09  3:49                 ` Joe Perches
2009-09-09  3:32             ` Paul Mundt
2009-09-09  4:11               ` Dmitry Torokhov
2009-09-09  2:49 ` [PATCH v2 3/5] Use macros for .bss.page_aligned section Tim Abbott
2009-09-09  2:54   ` Paul Mundt
2009-09-09  2:49 ` [PATCH v2 4/5] powerpc: remove unused __page_aligned definition Tim Abbott
2009-09-11  7:33   ` Benjamin Herrenschmidt
2009-09-09  2:49 ` [PATCH v2 5/5] Use macros for .data.page_aligned section Tim Abbott

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1252464546-26394-2-git-send-email-tabbott@ksplice.com \
    --to=tabbott@ksplice.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sam@ravnborg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®