From: Michael Ellerman <patch-notifications@ellerman.id.au>
To: Desnes Augusto Nunes do Rosario <desnesn@linux.vnet.ibm.com>,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
amodra@gmail.com
Cc: ard.biesheuvel@linaro.org, rusty@rustcorp.com.au,
desnesn@linux.vnet.ibm.com, paulus@samba.org
Subject: Re: [powerpc-next] Fix powerpc64 alignment of .toc section in kernel modules
Date: Tue, 12 Dec 2017 22:39:32 +1100 (AEDT) [thread overview]
Message-ID: <3ywyXh5hTTz9tBC@ozlabs.org> (raw)
In-Reply-To: <20171206191228.30830-1-desnesn@linux.vnet.ibm.com>
On Wed, 2017-12-06 at 19:12:28 UTC, Desnes Augusto Nunes do Rosario wrote:
> powerpc64 gcc can generate code that offsets an address, to access part of
> an object in memory. If the address is a -mcmodel=medium toc pointer
> relative address then code like the following is possible.
>
> addis r9,r2,var@toc@ha
> ld r3,var@toc@l(r9)
> ld r4,(var+8)@toc@l(r9)
>
> This works fine so long as var is naturally aligned, *and* r2 is
> sufficiently aligned. If not, there is a possibility that the offset added
> to access var+8 wraps over a n*64k+32k boundary. Modules don't have any
> guarantee that r2 is sufficiently aligned. Moreover, code generated by
> older compilers generates a .toc section with 2**0 alignment, which can
> result in relocation failures at module load time even without the wrap
> problem.
>
> Thus, this patch links modules with an aligned .toc section (Makefile and
> module.lds changes), and forces alignment for out of tree modules or those
> without a .toc section (module_64.c changes).
>
> Signed-off-by: Alan Modra <amodra@gmail.com>
> [ desnesn: updated patch to apply to powerpc-next kernel v4.15 ]
> Signed-off-by: Desnes A. Nunes do Rosario <desnesn@linux.vnet.ibm.com>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/5c45b5280196a92c4437f5648209c5
cheers
prev parent reply other threads:[~2017-12-12 11:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-06 19:12 [PATCH] " Desnes Augusto Nunes do Rosario
2017-12-07 12:25 ` Michael Ellerman
2017-12-07 13:24 ` Desnes Augusto Nunes do Rosário
2017-12-08 11:25 ` Michael Ellerman
2017-12-12 11:39 ` Michael Ellerman [this message]
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=3ywyXh5hTTz9tBC@ozlabs.org \
--to=patch-notifications@ellerman.id.au \
--cc=amodra@gmail.com \
--cc=ard.biesheuvel@linaro.org \
--cc=desnesn@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=paulus@samba.org \
--cc=rusty@rustcorp.com.au \
/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®