linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Russell King <rmk@arm.linux.org.uk>
To: Alain Knaff <alain@knaff.lu>
Cc: Andrew Morton <akpm@linux-foundation.org>, linux-arch@vger.kernel.org
Subject: [PATCH] Fix ARM PIC problems with new decompressor code
Date: Sun, 28 Feb 2010 15:49:08 +0000	[thread overview]
Message-ID: <20100228154908.GB11343@flint.arm.linux.org.uk> (raw)
In-Reply-To: <4B87907B.7080008@knaff.lu>

On Fri, Feb 26, 2010 at 10:12:27AM +0100, Alain Knaff wrote:
> Yes, that should be fine. So it would be static in full kernel context
> (initrd decompression) but global in preboot. As long as it doesn't clash
> with other variables of the same name, but I think that's rather unlikely
> in the "small" preboot environment.

Here's a patch to this end.  I decided to change the name of the
define to something more sensible.

Are we happy with this?  Shall I queue it for merging?  I'd be nice
to get this into -stable as well as some other fixes for this feature.


Subject: Fix new decompressor for PIC

The ARM kernel decompressor wants to be able to relocate r/w data
independently from the rest of the image, and we do this by ensuring
that r/w data has global visibility.  Define STATIC_RW_DATA to be
empty to achieve this.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-- 
 include/linux/decompress/mm.h |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/include/linux/decompress/mm.h b/include/linux/decompress/mm.h
index 5032b9a..278e6c8 100644
--- a/include/linux/decompress/mm.h
+++ b/include/linux/decompress/mm.h
@@ -14,11 +14,21 @@
 
 /* Code active when included from pre-boot environment: */
 
+/*
+ * Some architectures want to ensure there is no local data in their
+ * pre-boot environment, so that data can arbitarily relocated (via
+ * GOT references).  This is achieved by defining STATIC_RW_DATA to
+ * be null.
+ */
+#ifndef STATIC_RW_DATA
+#define STATIC_RW_DATA static
+#endif
+
 /* A trivial malloc implementation, adapted from
  *  malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994
  */
-static unsigned long malloc_ptr;
-static int malloc_count;
+STATIC_RW_DATA unsigned long malloc_ptr;
+STATIC_RW_DATA int malloc_count;
 
 static void *malloc(int size)
 {


-- 
Russell King

       reply	other threads:[~2010-02-28 15:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20100226081926.GA3511@flint.arm.linux.org.uk>
     [not found] ` <4B87907B.7080008@knaff.lu>
2010-02-28 15:49   ` Russell King [this message]
2010-03-02 22:43     ` [PATCH] Fix ARM PIC problems with new decompressor code Andrew Morton
2010-03-02 22:53       ` Russell King

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=20100228154908.GB11343@flint.arm.linux.org.uk \
    --to=rmk@arm.linux.org.uk \
    --cc=akpm@linux-foundation.org \
    --cc=alain@knaff.lu \
    --cc=linux-arch@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).