From: "Marty Leisner" <linux@rochester.rr.com>
To: linux-kernel@vger.kernel.org
Cc: maleisner@gmail.com
Subject: OPTIMIZE_FOR_SIZE makes PPC modules sick when trampolines are used
Date: Wed, 21 Sep 2011 00:21:30 +0000 [thread overview]
Message-ID: <201109210021.p8L0LVCn019238@dell2.home> (raw)
We're using Windriver linux on a PPC board (2.6.34).
When turning on OPTIMIZE_FOR_SIZE, we saw "strangeness" with the IPv6
module depending on when it was loaded (it either "hung" or paniced the system
with a empty stack dump -- or worked fine!!).
Editing inet6_init so:
a) a return (after entry) worked
b) anything (for example printk) hung/paniced returning from the module
The trampoline code uses r11.
gcc OPTIMIZE_FOR_SIZE (4.x) does (when returning from inet6_init):
418: 39 7f 00 10 addi r11,r31,16
41c: 48 00 00 00 b 41c <ac6_proc_init+0x44>
41c: R_PPC_REL24 _rest32gpr_31_x
on function exit (_rest32gpr_31_x bases a stackpointer off r11)
If _rest32gpr_31_x has to go across a trampoline, r11 is getting clobbered.
Hence bad things happen:
The trampoline code is (if the comments are right ;-):
(from arch/powerpc/kernel/module_32.c)
/* Stolen from Paul Mackerras as well... */
entry->jump[0] = 0x3d600000+((val+0x8000)>>16); /* lis r11,sym@ha */
entry->jump[1] = 0x396b0000 + (val&0xffff); /* addi r11,r11,sym@l*/
entry->jump[2] = 0x7d6903a6; /* mtctr r11 */
entry->jump[3] = 0x4e800420; /* bctr */
Has anyone seen this? An old ABI (maybe current? Its version 3 from 1995) lists r0, r11, r12
as volatile registers which may be used for function linkage.
marty
reply other threads:[~2011-09-20 23:49 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=201109210021.p8L0LVCn019238@dell2.home \
--to=linux@rochester.rr.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maleisner@gmail.com \
/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
all inboxes | Powered by JetHome®