* [PATCH] [POWERPC] Fix link errors for allyesconfig
@ 2007-11-04 2:28 Stephen Rothwell
2007-11-04 3:47 ` David Miller
2007-11-16 6:23 ` David Miller
0 siblings, 2 replies; 4+ messages in thread
From: Stephen Rothwell @ 2007-11-04 2:28 UTC (permalink / raw)
To: paulus; +Cc: ppc-dev, David S. Miller
An allyesconfig build creates a .text section that is so big that the
.text.init.refok and .fixup sections are too far away for the relocations
to be fixed up correctly. This patch fixes that by linking all the
relevent text sections for each file together.
Suggested by Paul Mackerras.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
arch/powerpc/kernel/vmlinux.lds.S | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
This still leaves us with the problem that the TOC overflows.
Dave, would something like this help as an alternative to the .fixup
change you committed recently?
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index 823a8cb..f66fa5d 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -37,11 +37,10 @@ SECTIONS
ALIGN_FUNCTION();
*(.text.head)
_text = .;
- TEXT_TEXT
+ *(.text .fixup .text.init.refok .exit.text.refok)
SCHED_TEXT
LOCK_TEXT
KPROBES_TEXT
- *(.fixup)
#ifdef CONFIG_PPC32
*(.got1)
--
1.5.3.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] [POWERPC] Fix link errors for allyesconfig
2007-11-04 2:28 [PATCH] [POWERPC] Fix link errors for allyesconfig Stephen Rothwell
@ 2007-11-04 3:47 ` David Miller
2007-11-16 6:23 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2007-11-04 3:47 UTC (permalink / raw)
To: sfr; +Cc: linuxppc-dev, paulus
From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Sun, 4 Nov 2007 13:28:39 +1100
> An allyesconfig build creates a .text section that is so big that the
> .text.init.refok and .fixup sections are too far away for the relocations
> to be fixed up correctly. This patch fixes that by linking all the
> relevent text sections for each file together.
>
> Suggested by Paul Mackerras.
>
> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
> ---
> arch/powerpc/kernel/vmlinux.lds.S | 3 +--
> 1 files changed, 1 insertions(+), 2 deletions(-)
>
> This still leaves us with the problem that the TOC overflows.
>
> Dave, would something like this help as an alternative to the .fixup
> change you committed recently?
It might, I'll make some tests when I get a chance.
Thanks for pointing this out Stephen.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] [POWERPC] Fix link errors for allyesconfig
2007-11-04 2:28 [PATCH] [POWERPC] Fix link errors for allyesconfig Stephen Rothwell
2007-11-04 3:47 ` David Miller
@ 2007-11-16 6:23 ` David Miller
2007-11-16 8:57 ` David Miller
1 sibling, 1 reply; 4+ messages in thread
From: David Miller @ 2007-11-16 6:23 UTC (permalink / raw)
To: sfr; +Cc: linuxppc-dev, paulus
From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Sun, 4 Nov 2007 13:28:39 +1100
> Dave, would something like this help as an alternative to the .fixup
> change you committed recently?
I tried it, doesn't help:
kernel/built-in.o: In function `context_switch':
/home/davem/src/GIT/sparc-2.6/kernel/sched.c:1950: relocation truncated to fit: R_SPARC_WDISP22 against symbol `ret_from_syscall' defined in .text section in arch/sparc64/kernel/head.o
drivers/built-in.o:(.fixup+0x0): relocation truncated to fit: R_SPARC_WDISP22 against `.text'
drivers/built-in.o:(.fixup+0x8): relocation truncated to fit: R_SPARC_WDISP22 against `.text'
drivers/built-in.o:(.fixup+0x10): relocation truncated to fit: R_SPARC_WDISP22 against `.text'
drivers/built-in.o:(.fixup+0x18): relocation truncated to fit: R_SPARC_WDISP22 against `.text'
drivers/built-in.o:(.fixup+0x20): relocation truncated to fit: R_SPARC_WDISP22 against `.text'
drivers/built-in.o:(.fixup+0x2c): relocation truncated to fit: R_SPARC_WDISP22 against `.text'
drivers/built-in.o:(.fixup+0x38): relocation truncated to fit: R_SPARC_WDISP22 against `.text'
drivers/built-in.o:(.fixup+0x44): relocation truncated to fit: R_SPARC_WDISP22 against `.text'
drivers/built-in.o:(.fixup+0x50): relocation truncated to fit: R_SPARC_WDISP22 against `.text'
drivers/built-in.o:(.fixup+0x5c): additional relocation overflows omitted from the output
make: *** [.tmp_vmlinux1] Error 1
drivers/built-in.o itself has a 16MB+ .text section which is
beyond the 22-bit signed branch displacement we have available.
There has to be a nicer way to do this. In fact I think I
just figured out one such technique.
The whole reason we need these .fixup sections is to encode
a move of -EFAULT into some register, and a control transfer.
Every kernel text address, even for modules, is in the low 32-bits on
sparc64. So we can encode this more simply, perhaps even with one
32-bit word for each entry.
I can probably encode it all in the __ex_table entries in fact,
and I'll give that a shot.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] [POWERPC] Fix link errors for allyesconfig
2007-11-16 6:23 ` David Miller
@ 2007-11-16 8:57 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2007-11-16 8:57 UTC (permalink / raw)
To: sfr; +Cc: linuxppc-dev, paulus
From: David Miller <davem@davemloft.net>
Date: Thu, 15 Nov 2007 22:23:13 -0800 (PST)
> There has to be a nicer way to do this. In fact I think I
> just figured out one such technique.
>
> The whole reason we need these .fixup sections is to encode
> a move of -EFAULT into some register, and a control transfer.
>
> Every kernel text address, even for modules, is in the low 32-bits on
> sparc64. So we can encode this more simply, perhaps even with one
> 32-bit word for each entry.
>
> I can probably encode it all in the __ex_table entries in fact,
> and I'll give that a shot.
Ok, here's what I came up with:
/*
* The exception table consists 3 32-bit words, the encoding takes
* advantage of the fact that all kernel text addresses on sparc64 are
* in the low 4GB of the 64-bit address space so any location can be
* encoded in 32-bits.
*
* The first word is the address of an instruction that is allowed to
* fault. This is the search key used by search_exception_tables().
*
* The second word is a continuation address in the kernel text.
*
* The third word is an instruction to execute before transferring
* control to the location specified by the second word. Most of
* these instructions are of the form:
*
* mov -EFAULT, %reg
*
* Effectively the trap return TPC is set to the address of the third
* word, and the trap return TNPC is set to the value contained in the
* second word.
*/
struct exception_table_entry {
unsigned int insn, fixup_addr, fixup_insn;
};
And then __put_user_asm() now looks like:
#define __put_user_asm(x,size,addr,ret) \
__asm__ __volatile__( \
"/* Put user asm, inline. */\n" \
"1:\t" "st"#size "a %1, [%2] %%asi\n\t" \
"clr %0\n" \
"2:\n\n\t" \
".section __ex_table\n\t" \
".word 1b, 2b; mov %3, %0\n\t" \
".previous\n\n\t" \
: "=r" (ret) : "r" (x), "r" (__m(addr)), \
"i" (-EFAULT))
The .fixup section is completely eliminated, and the exception
dispatch goes:
regs->tpc = (unsigned long) &entry->fixup_insn;
regs->tnpc = entry->fixup_addr;
I have a full patch implementing this and it passes a
allyesconfig build and link.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-11-16 8:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-04 2:28 [PATCH] [POWERPC] Fix link errors for allyesconfig Stephen Rothwell
2007-11-04 3:47 ` David Miller
2007-11-16 6:23 ` David Miller
2007-11-16 8:57 ` David Miller
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).