public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Richard Henderson <rth@twiddle.net>
Cc: torvalds@transmeta.com, linux-kernel@vger.kernel.org,
	trivial@rustcorp.com.au, ak@suse.de
Date: Fri, 03 Jan 2003 16:24:51 +1100	[thread overview]
Message-ID: <20030103052508.379BE2C003@lists.samba.org> (raw)

Subject: Re: sh_link 
In-reply-to: Your message of "Thu, 02 Jan 2003 20:40:23 -0800."
             <20030102204023.A24347@twiddle.net> 

In message <20030102204023.A24347@twiddle.net> you write:
> On Fri, Jan 03, 2003 at 03:26:31PM +1100, Rusty Russell wrote:
> > F... bugger.  Hmm... sh_entsize?  or sh_addralign?
> 
> *shrug* Prolly nothing uses sh_entsize, and you don't have
> the ordering issues you'd have with addralgin.

Ack.  Linus, please apply (sh_link is a 32-bit field on 64 bit archs,
so a bad choice to store offsets, and also INIT_OFFSET_MASK is out of
range).

Andi, you'll want this most.
Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5-bk/kernel/module.c working-2.5-bk-sh_entsize/kernel/module.c
--- linux-2.5-bk/kernel/module.c	2003-01-02 14:48:01.000000000 +1100
+++ working-2.5-bk-sh_entsize/kernel/module.c	2003-01-03 16:21:14.000000000 +1100
@@ -880,7 +880,7 @@ static long get_offset(unsigned long *si
 
 /* Lay out the SHF_ALLOC sections in a way not dissimilar to how ld
    might -- code, read-only data, read-write data, small data.  Tally
-   sizes, and place the offsets into sh_link fields: high bit means it
+   sizes, and place the offsets into sh_entsize fields: high bit means it
    belongs in init. */
 static void layout_sections(struct module *mod,
 			    const Elf_Ehdr *hdr,
@@ -896,7 +896,7 @@ static void layout_sections(struct modul
 	unsigned int m, i;
 
 	for (i = 0; i < hdr->e_shnum; i++)
-		sechdrs[i].sh_link = ~0UL;
+		sechdrs[i].sh_entsize = ~0UL;
 
 	DEBUGP("Core section allocation order:\n");
 	for (m = 0; m < ARRAY_SIZE(masks); ++m) {
@@ -905,10 +905,10 @@ static void layout_sections(struct modul
 
 			if ((s->sh_flags & masks[m][0]) != masks[m][0]
 			    || (s->sh_flags & masks[m][1])
-			    || s->sh_link != ~0UL
+			    || s->sh_entsize != ~0UL
 			    || strstr(secstrings + s->sh_name, ".init"))
 				continue;
-			s->sh_link = get_offset(&mod->core_size, s);
+			s->sh_entsize = get_offset(&mod->core_size, s);
 			DEBUGP("\t%s\n", name);
 		}
 	}
@@ -920,11 +920,11 @@ static void layout_sections(struct modul
 
 			if ((s->sh_flags & masks[m][0]) != masks[m][0]
 			    || (s->sh_flags & masks[m][1])
-			    || s->sh_link != ~0UL
+			    || s->sh_entsize != ~0UL
 			    || !strstr(secstrings + s->sh_name, ".init"))
 				continue;
-			s->sh_link = (get_offset(&mod->init_size, s)
-				      | INIT_OFFSET_MASK);
+			s->sh_entsize = (get_offset(&mod->init_size, s)
+					 | INIT_OFFSET_MASK);
 			DEBUGP("\t%s\n", name);
 		}
 	}
@@ -1066,7 +1066,7 @@ static struct module *load_module(void *
 	if (err < 0)
 		goto free_mod;
 
-	/* Determine total sizes, and put offsets in sh_link.  For now
+	/* Determine total sizes, and put offsets in sh_entsize.  For now
 	   this is done generically; there doesn't appear to be any
 	   special cases for the architectures. */
 	layout_sections(mod, hdr, sechdrs, secstrings);
@@ -1095,11 +1095,11 @@ static struct module *load_module(void *
 		if (!(sechdrs[i].sh_flags & SHF_ALLOC))
 			continue;
 
-		if (sechdrs[i].sh_link & INIT_OFFSET_MASK)
+		if (sechdrs[i].sh_entsize & INIT_OFFSET_MASK)
 			dest = mod->module_init
-				+ (sechdrs[i].sh_link & ~INIT_OFFSET_MASK);
+				+ (sechdrs[i].sh_entsize & ~INIT_OFFSET_MASK);
 		else
-			dest = mod->module_core + sechdrs[i].sh_link;
+			dest = mod->module_core + sechdrs[i].sh_entsize;
 
 		if (sechdrs[i].sh_type != SHT_NOBITS)
 			memcpy(dest, (void *)sechdrs[i].sh_addr,

                 reply	other threads:[~2003-01-03  5:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20030103052508.379BE2C003@lists.samba.org \
    --to=rusty@rustcorp.com.au \
    --cc=ak@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rth@twiddle.net \
    --cc=torvalds@transmeta.com \
    --cc=trivial@rustcorp.com.au \
    /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