From: Bryan Wu <bryan.wu@analog.com>
To: torvalds@linux-foundation.org, akpm@linux-foundation.org,
linux-kernel@vger.kernel.org
Cc: Bernd Schmidt <bernd.schmidt@analog.com>, Bryan Wu <bryan.wu@analog.com>
Subject: [PATCH 20/20] binfmt_flat: minimum support for the Blackfin relocations
Date: Mon, 28 May 2007 16:37:55 +0800 [thread overview]
Message-ID: <11803414902910-git-send-email-bryan.wu@analog.com> (raw)
In-Reply-To: <11803414753217-git-send-email-bryan.wu@analog.com>
From: Bernd Schmidt <bernd.schmidt@analog.com>
This just adds minimum support for the Blackfin relocations,
since we don't have enough space in each reloc. The idea
is to store a value with one relocation so that subsequent ones can
access it.
Signed-off-by: Bernd Schmidt <bernd.schmidt@analog.com>
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
---
fs/binfmt_flat.c | 5 ++++-
include/asm-h8300/flat.h | 3 ++-
include/asm-m32r/flat.h | 3 ++-
include/asm-m68knommu/flat.h | 3 ++-
include/asm-sh/flat.h | 3 ++-
include/asm-v850/flat.h | 4 +++-
6 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c
index 7b0265d..13b58f8 100644
--- a/fs/binfmt_flat.c
+++ b/fs/binfmt_flat.c
@@ -742,6 +742,7 @@ static int load_flat_file(struct linux_binprm * bprm,
* __start to address 4 so that is okay).
*/
if (rev > OLD_FLAT_VERSION) {
+ unsigned long persistent = 0;
for (i=0; i < relocs; i++) {
unsigned long addr, relval;
@@ -749,6 +750,8 @@ static int load_flat_file(struct linux_binprm * bprm,
relocated (of course, the address has to be
relocated first). */
relval = ntohl(reloc[i]);
+ if (flat_set_persistent (relval, &persistent))
+ continue;
addr = flat_get_relocate_addr(relval);
rp = (unsigned long *) calc_reloc(addr, libinfo, id, 1);
if (rp == (unsigned long *)RELOC_FAILED) {
@@ -757,7 +760,7 @@ static int load_flat_file(struct linux_binprm * bprm,
}
/* Get the pointer's value. */
- addr = flat_get_addr_from_rp(rp, relval, flags);
+ addr = flat_get_addr_from_rp(rp, relval, flags, &persistent);
if (addr != 0) {
/*
* Do the relocation. PIC relocs in the data section are
diff --git a/include/asm-h8300/flat.h b/include/asm-h8300/flat.h
index c20eee7..2a87350 100644
--- a/include/asm-h8300/flat.h
+++ b/include/asm-h8300/flat.h
@@ -9,6 +9,7 @@
#define flat_argvp_envp_on_stack() 1
#define flat_old_ram_flag(flags) 1
#define flat_reloc_valid(reloc, size) ((reloc) <= (size))
+#define flat_set_persistent(relval, p) 0
/*
* on the H8 a couple of the relocations have an instruction in the
@@ -18,7 +19,7 @@
*/
#define flat_get_relocate_addr(rel) (rel)
-#define flat_get_addr_from_rp(rp, relval, flags) \
+#define flat_get_addr_from_rp(rp, relval, flags, persistent) \
(get_unaligned(rp) & ((flags & FLAT_FLAG_GOTPIC) ? 0xffffffff: 0x00ffffff))
#define flat_put_addr_at_rp(rp, addr, rel) \
put_unaligned (((*(char *)(rp)) << 24) | ((addr) & 0x00ffffff), rp)
diff --git a/include/asm-m32r/flat.h b/include/asm-m32r/flat.h
index 1b285f6..d851cf0 100644
--- a/include/asm-m32r/flat.h
+++ b/include/asm-m32r/flat.h
@@ -15,9 +15,10 @@
#define flat_stack_align(sp) (*sp += (*sp & 3 ? (4 - (*sp & 3)): 0))
#define flat_argvp_envp_on_stack() 0
#define flat_old_ram_flag(flags) (flags)
+#define flat_set_persistent(relval, p) 0
#define flat_reloc_valid(reloc, size) \
(((reloc) - textlen_for_m32r_lo16_data) <= (size))
-#define flat_get_addr_from_rp(rp, relval, flags) \
+#define flat_get_addr_from_rp(rp, relval, flags, persistent) \
m32r_flat_get_addr_from_rp(rp, relval, (text_len) )
#define flat_put_addr_at_rp(rp, addr, relval) \
diff --git a/include/asm-m68knommu/flat.h b/include/asm-m68knommu/flat.h
index 2d836ed..814b517 100644
--- a/include/asm-m68knommu/flat.h
+++ b/include/asm-m68knommu/flat.h
@@ -9,8 +9,9 @@
#define flat_argvp_envp_on_stack() 1
#define flat_old_ram_flag(flags) (flags)
#define flat_reloc_valid(reloc, size) ((reloc) <= (size))
-#define flat_get_addr_from_rp(rp, relval, flags) get_unaligned(rp)
+#define flat_get_addr_from_rp(rp, relval, flags, p) get_unaligned(rp)
#define flat_put_addr_at_rp(rp, val, relval) put_unaligned(val,rp)
#define flat_get_relocate_addr(rel) (rel)
+#define flat_set_persistent(relval, p) 0
#endif /* __M68KNOMMU_FLAT_H__ */
diff --git a/include/asm-sh/flat.h b/include/asm-sh/flat.h
index 0d5cc04..dc4f595 100644
--- a/include/asm-sh/flat.h
+++ b/include/asm-sh/flat.h
@@ -16,8 +16,9 @@
#define flat_argvp_envp_on_stack() 0
#define flat_old_ram_flag(flags) (flags)
#define flat_reloc_valid(reloc, size) ((reloc) <= (size))
-#define flat_get_addr_from_rp(rp, relval, flags) get_unaligned(rp)
+#define flat_get_addr_from_rp(rp, relval, flags, p) get_unaligned(rp)
#define flat_put_addr_at_rp(rp, val, relval) put_unaligned(val,rp)
#define flat_get_relocate_addr(rel) (rel)
+#define flat_set_persistent(relval, p) 0
#endif /* __ASM_SH_FLAT_H */
diff --git a/include/asm-v850/flat.h b/include/asm-v850/flat.h
index 3888f59..17f0ea5 100644
--- a/include/asm-v850/flat.h
+++ b/include/asm-v850/flat.h
@@ -25,6 +25,7 @@
#define flat_stack_align(sp) /* nothing needed */
#define flat_argvp_envp_on_stack() 0
#define flat_old_ram_flag(flags) (flags)
+#define flat_set_persistent(relval, p) 0
/* We store the type of relocation in the top 4 bits of the `relval.' */
@@ -46,7 +47,8 @@ flat_get_relocate_addr (unsigned long relval)
For the v850, RP should always be half-word aligned. */
static inline unsigned long flat_get_addr_from_rp (unsigned long *rp,
unsigned long relval,
- unsigned long flags)
+ unsigned long flags,
+ unsigned long *persistent)
{
short *srp = (short *)rp;
--
1.5.2
next prev parent reply other threads:[~2007-05-28 8:43 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-28 8:37 [PATCH 00/20] Blackfin update for 2.6.22-rc3 Bryan Wu
2007-05-28 8:37 ` [PATCH 01/20] Blackfin arch: remove defconfig file Bryan Wu
2007-05-28 8:37 ` [PATCH 02/20] Blackfin arch: DMA code minor naming convention fix Bryan Wu
2007-05-28 8:37 ` [PATCH 03/20] Blackfin arch: spelling fixes Bryan Wu
2007-05-28 8:37 ` [PATCH 04/20] Blackfin arch: fix bug ad1836 fails to build properly for BF533-EZKIT Bryan Wu
2007-05-28 8:37 ` [PATCH 05/20] Blackfin arch: all symbols were offset by 4k, since we didn't have the __text label Bryan Wu
2007-05-28 8:37 ` [PATCH 06/20] Blackfin arch: mark our memory init functions with __init so they get freed after init Bryan Wu
2007-05-28 8:37 ` [PATCH 07/20] Blackfin arch: implement a basic /proc/sram file for L1 allocation visibility Bryan Wu
2007-05-28 8:37 ` [PATCH 08/20] Blackfin arch: Add header files for BF548 Bryan Wu
2007-05-28 8:37 ` [PATCH 09/20] Blackfin arch: fixup Blackfin MAINTIANERS team member list Bryan Wu
2007-05-28 11:48 ` Pekka Enberg
2007-05-28 14:33 ` Robin Getz
2007-05-28 8:37 ` [PATCH 10/20] Blackfin arch: scrub old console defines Bryan Wu
2007-05-28 8:37 ` [PATCH 11/20] Blackfin arch: update defconfigs Bryan Wu
2007-05-28 8:37 ` [PATCH 12/20] Blackfin arch: unify differences between our diff head.S files -- no functional changes Bryan Wu
2007-05-28 8:37 ` [PATCH 13/20] Blackfin arch: move more of our startup code to .init so it can be freed once we are up and running Bryan Wu
2007-05-28 8:37 ` [PATCH 14/20] Blackfin arch: add proper ENDPROC() Bryan Wu
2007-05-28 8:37 ` [PATCH 15/20] Blackfin serial driver: hook up our UARTs STP bit with userspaces CMSPAR Bryan Wu
2007-05-28 8:37 ` [PATCH 16/20] Blackfin serial driver: ignore framing and parity errors Bryan Wu
2007-05-28 8:37 ` [PATCH 17/20] Blackfin RTC drivers: update MAINTAINERS information Bryan Wu
2007-05-28 8:37 ` [PATCH 18/20] Blackfin SPI driver: tweak spi cleanup function to match newer kernel changes Bryan Wu
2007-05-28 8:37 ` [PATCH 19/20] Blackfin on-chip watchdog driver Bryan Wu
2007-05-29 17:20 ` Mike Frysinger
2007-05-31 20:17 ` Mike Frysinger
2007-05-28 8:37 ` Bryan Wu [this message]
2007-05-29 20:59 ` [PATCH 00/20] Blackfin update for 2.6.22-rc3 Linus Torvalds
2007-05-29 23:31 ` Bernd Schmidt
2007-05-30 1:04 ` Linus Torvalds
2007-05-30 2:31 ` Bryan Wu
2007-05-30 2:42 ` Andrew Morton
2007-05-30 2:56 ` Bryan Wu
2007-05-30 13:09 ` Robin Getz
2007-05-30 13:30 ` Sam Ravnborg
2007-05-30 13:48 ` Robin Getz
2007-05-30 15:53 ` Linus Torvalds
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=11803414902910-git-send-email-bryan.wu@analog.com \
--to=bryan.wu@analog.com \
--cc=akpm@linux-foundation.org \
--cc=bernd.schmidt@analog.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.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