From: Anton Blanchard <anton@samba.org>
To: Simon Horman <horms@verge.net.au>,
Bill Schmidt <wschmidt@us.ibm.com>, Alan Modra <amodra@gmail.com>,
Tony Breeds <tony@bakeyournoodle.com>
Cc: kexec@lists.infradead.org
Subject: [PATCH 3/3] Properly align powerpc64 .toc
Date: Fri, 26 Feb 2016 18:06:15 +1100 [thread overview]
Message-ID: <20160226180615.20d86d70@kryten> (raw)
In-Reply-To: <20160226180311.2938d804@kryten>
From: Alan Modra <amodra@gmail.com>
gcc leaves .toc byte aligned, relying on the linker to align the section.
* kexec/arch/ppc64/kexec-elf-rel-ppc64.c (machine_verify_elf_rel):
Fudge alignment of .toc section.
Signed-off-by: Alan Modra <amodra@gmail.com>
Signed-off-by: Anton Blanchard <anton@samba.org>
---
kexec/arch/ppc64/kexec-elf-rel-ppc64.c | 30 ++++++++++++++++++------------
1 file changed, 18 insertions(+), 12 deletions(-)
diff --git a/kexec/arch/ppc64/kexec-elf-rel-ppc64.c b/kexec/arch/ppc64/kexec-elf-rel-ppc64.c
index 43851f6..5f8e3f2 100644
--- a/kexec/arch/ppc64/kexec-elf-rel-ppc64.c
+++ b/kexec/arch/ppc64/kexec-elf-rel-ppc64.c
@@ -23,18 +23,6 @@ static unsigned int local_entry_offset(struct mem_sym *UNUSED(sym))
}
#endif
-int machine_verify_elf_rel(struct mem_ehdr *ehdr)
-{
- if (ehdr->ei_class != ELFCLASS64) {
- return 0;
- }
- if (ehdr->e_machine != EM_PPC64) {
- return 0;
- }
-
- return 1;
-}
-
static struct mem_shdr *toc_section(const struct mem_ehdr *ehdr)
{
struct mem_shdr *shdr, *shdr_end;
@@ -52,6 +40,24 @@ static struct mem_shdr *toc_section(const struct mem_ehdr *ehdr)
return NULL;
}
+int machine_verify_elf_rel(struct mem_ehdr *ehdr)
+{
+ struct mem_shdr *toc;
+
+ if (ehdr->ei_class != ELFCLASS64) {
+ return 0;
+ }
+ if (ehdr->e_machine != EM_PPC64) {
+ return 0;
+ }
+
+ /* Ensure .toc is sufficiently aligned. */
+ toc = toc_section(ehdr);
+ if (toc && toc->sh_addralign < 256)
+ toc->sh_addralign = 256;
+ return 1;
+}
+
/* 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) */
--
2.5.0
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2016-02-26 7:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-26 7:03 [PATCH 1/3] Pass struct mem_sym into machine_apply_elf_rel() Anton Blanchard
2016-02-26 7:04 ` [PATCH 2/3] ppc64: purgatory: Handle local symbols in ELF ABIv2 Anton Blanchard
2016-02-26 7:06 ` Anton Blanchard [this message]
2016-02-26 11:53 ` [PATCH 1/3] Pass struct mem_sym into machine_apply_elf_rel() Dave Young
2016-03-04 8:12 ` Dave Young
2016-03-23 4:10 ` Tony Breeds
2016-03-24 0:49 ` Michael Ellerman
2016-03-24 5:00 ` Simon Horman
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=20160226180615.20d86d70@kryten \
--to=anton@samba.org \
--cc=amodra@gmail.com \
--cc=horms@verge.net.au \
--cc=kexec@lists.infradead.org \
--cc=tony@bakeyournoodle.com \
--cc=wschmidt@us.ibm.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