[klibc] ppc32: "Relocation truncated to fit"

H. Peter Anvin hpa at zytor.com
Tue Jun 6 14:26:18 PDT 2006


Hello ppc32 users,

I think I finally got the "official" answer on the ppc32 problem.  Apparently some 
distributions build binutils so that it defaults to elf32ppc emulation rather than 
elf32ppclinux.  This doesn't matter when using gcc, since gcc overrides the emulation 
explicitly, but it does matter when invoking ld directly like klibc does.

This patch should hopefully take care of it; this supercedes previous patches.

If you could test it out I would be most grateful.

	-hpa
-------------- next part --------------
[klibc] ppc32: address space fixes

- klibc.so should be linked at 0x0f800000, so there is actually some
  "reach" in the +/- 16 MB calls.
- On some distributions, the PowerPC linker defaults to the elf32ppc
  emulation rather than elf32ppclinux.  This affects the start address,
  among other things.  Thus, specify the emulation explicitly.
- Add -m32 if gcc supports it, just in case someone ever makes a distro
  which defaults to ppc64.

Signed-off-by: H. Peter Anvin <hpa at zytor.com>

---
commit 44ae64c1599705929af23db553b48043bc2a2237
tree c8cf6fdb0c2bbaaa8ccfb60083bef5ac0427363f
parent cd0f24180910be745b5aa0b926f26421c0e8a0e0
author H. Peter Anvin <hpa at zytor.com> Tue, 06 Jun 2006 14:22:35 -0700
committer H. Peter Anvin <hpa at zytor.com> Tue, 06 Jun 2006 14:22:35 -0700

 usr/klibc/arch/ppc/MCONFIG |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/usr/klibc/arch/ppc/MCONFIG b/usr/klibc/arch/ppc/MCONFIG
index 8b51e65..5410933 100644
--- a/usr/klibc/arch/ppc/MCONFIG
+++ b/usr/klibc/arch/ppc/MCONFIG
@@ -7,15 +7,20 @@
 # accordingly.
 #
 
-KLIBCOPTFLAGS = -Os
-KLIBCBITSIZE  = 32
+gcc_m32_option  := $(call cc-option, -m32, )
+
+KLIBCOPTFLAGS	   = -Os
+KLIBCLDFLAGS       = -m elf32ppclinux
+KLIBCARCHREQFLAGS += $(gcc_m32_option)
+
+KLIBCBITSIZE       = 32
 
 # Extra linkflags when building the shared version of the library
 # This address needs to be reachable using normal inter-module
 # calls, and work on the memory models for this architecture
 # 256-16 MB - normal binaries start at 256 MB, and jumps are limited
 # to +/- 16 MB
-KLIBCSHAREDFLAGS     = -Ttext 0x0f000200
+KLIBCSHAREDFLAGS     = -Ttext 0x0f800200
 
 # The kernel so far has both asm-ppc* and asm-powerpc.
 KLIBCARCHINCFLAGS = -I$(KLIBCKERNELOBJ)arch/$(KLIBCARCH)/include


More information about the klibc mailing list