Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Jul 2004 12:15:28 +1000
From:      Peter Grehan <grehan@freebsd.org>
To:        freebsd-ppc@freebsd.org
Subject:   re: modules ?
Message-ID:  <40FDD1C0.8030405@freebsd.org>

next in thread | raw e-mail | index | archive | help
(Oops, this didn't make it to -ppc first time)

 > Are modules supposed to work?  Attempting to load
 > a kld built on powerpc yields tons of warnings about
 > not supporting R_PPC_REL24 relocations:
 >
 >     unexpected relocation type 10
 > <...>     link_elf: symbol minor undefined
 >
 >
 > Is there a linker script, or some CFLAGs that I'm missing?


  Sorry for the delay, just got back to email.

  There's 2 outstanding diffs. First one:

diff -u -r1.163 kmod.mk
--- kmod.mk     29 Jun 2004 18:56:14 -0000      1.163
+++ kmod.mk     16 Jul 2004 07:34:06 -0000
@@ -125,6 +125,11 @@
  .endif
  LDFLAGS+=      -d -warn-common

+# PG XXX ppc-specific module flags
+.if ${MACHINE_ARCH} == "powerpc"
+CFLAGS+=       -mlongcall
+.endif
+
  CFLAGS+=       ${DEBUG_FLAGS}

  This forces the compiler to generate a call via the CTR register
with a 32-bit load. The normal call sequence uses "blr" with a 24-bit
displacement, which doesn't work with modules being loaded in the
4th gig and the kernel residing in the first.

  I was going to ask ruslan if this was the correct place to commit
this CFLAGS change. However, if you think it's OK, I'll do it.

  The second is a gcc patch, since internal libcalls (e.g. 64-bit arith)
don't respect the "-mlongcall" attribute. I've yet to file a bug against
gcc for this one.

diff -u -r1.1.1.9 rs6000.c
--- rs6000.c    7 Nov 2003 02:43:04 -0000       1.1.1.9
+++ rs6000.c    15 Jul 2004 03:40:09 -0000
@@ -2914,6 +2914,9 @@
        && lookup_attribute ("longcall", TYPE_ATTRIBUTES (fntype))
        && !lookup_attribute ("shortcall", TYPE_ATTRIBUTES (fntype)))
      cum->call_cookie = CALL_LONG;
+  else if (!fntype)
+    if (rs6000_default_long_calls)
+      cum->call_cookie = CALL_LONG;

    if (TARGET_DEBUG_ARG)

later,

Peter.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?40FDD1C0.8030405>