mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@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: desnesn@linux.vnet.ibm.com, benh@kernel.crashing.org,
	paulus@samba.org, ard.biesheuvel@linaro.org,
	rusty@rustcorp.com.au
Subject: Re: [PATCH] [powerpc-next] Fix powerpc64 alignment of .toc section in kernel modules
Date: Thu, 07 Dec 2017 23:25:57 +1100	[thread overview]
Message-ID: <877etylo6i.fsf@concordia.ellerman.id.au> (raw)
In-Reply-To: <20171206191228.30830-1-desnesn@linux.vnet.ibm.com>

Hi Desnes,

Am I right that Alan largely wrote this patch?

If so it should probably be From: him, so that he is the author in the
git log.


Desnes Augusto Nunes do Rosario <desnesn@linux.vnet.ibm.com> writes:
> diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
> index 1381693..c472f5b 100644
> --- a/arch/powerpc/Makefile
> +++ b/arch/powerpc/Makefile
> @@ -63,6 +63,7 @@ UTS_MACHINE := $(subst $(space),,$(machine-y))
>  ifdef CONFIG_PPC32
>  KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
>  else
> +KBUILD_LDFLAGS_MODULE += -T arch/powerpc/kernel/module.lds

This needs to be:

KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/powerpc/kernel/module.lds

Otherwise building with O=../build fails with:

  ld: cannot open linker script file arch/powerpc/kernel/module.lds: No such file or directory

I'll fix it up.

> diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c
> index 759104b..9b2c5c1 100644
> --- a/arch/powerpc/kernel/module_64.c
> +++ b/arch/powerpc/kernel/module_64.c
> @@ -374,11 +377,13 @@ int module_frob_arch_sections(Elf64_Ehdr *hdr,
>  }
>  
>  /* r2 is the TOC pointer: it actually points 0x8000 into the TOC (this
> -   gives the value maximum span in an instruction which uses a signed
> -   offset) */
> + * gives the value maximum span in an instruction which uses a signed
> + * offset).  Round down to a 256 byte boundary for the odd case where
> + * we are setting up r2 without a .toc section.
> + */
>  static inline unsigned long my_r2(const Elf64_Shdr *sechdrs, struct module *me)
>  {
> -	return sechdrs[me->arch.toc_section].sh_addr + 0x8000;
> +	return (sechdrs[me->arch.toc_section].sh_addr & -256) + 0x8000;

I think it's more typical in the kernel to write -256 as ~0xff.

Again I can fix it up.

cheers

  reply	other threads:[~2017-12-07 12:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-06 19:12 Desnes Augusto Nunes do Rosario
2017-12-07 12:25 ` Michael Ellerman [this message]
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

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=877etylo6i.fsf@concordia.ellerman.id.au \
    --to=mpe@ellerman.id.au \
    --cc=amodra@gmail.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=benh@kernel.crashing.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®