From: Peter Zijlstra <peterz@infradead.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
the arch/x86 maintainers <x86@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
Josh Poimboeuf <jpoimboe@redhat.com>
Subject: Re: [GIT pull] locking/urgent for v5.12-rc3
Date: Mon, 15 Mar 2021 13:08:27 +0100 [thread overview]
Message-ID: <YE9OOx0za7ZH3AXe@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <YE9EVNG4/5UMJvFp@hirez.programming.kicks-ass.net>
On Mon, Mar 15, 2021 at 12:26:12PM +0100, Peter Zijlstra wrote:
> Ooooh, modules don't have this. They still have regular
> .static_call_sites sections, and *those* are unaligned.
>
> Section Headers:
> [Nr] Name Type Address Off Size ES Flg Lk Inf Al
>
> [16] .static_call_sites PROGBITS 0000000000000000 008aa1 0006f0 00 WA 0 0 1
>
> And that goes *BOOM*.. Let me ses if I can figure out how to make
> objtool align those sections.
The below seems to have cured it:
[16] .static_call_sites PROGBITS 0000000000000000 008aa8 0006f0 00 WA 0 0 8
So, anybody any opinion on if we ought to do this?
---
--- a/tools/objtool/arch/x86/decode.c
+++ b/tools/objtool/arch/x86/decode.c
@@ -683,7 +683,7 @@ static int elf_add_alternative(struct el
sec = find_section_by_name(elf, ".altinstructions");
if (!sec) {
sec = elf_create_section(elf, ".altinstructions",
- SHF_WRITE, size, 0);
+ SHF_WRITE, size, 1, 0);
if (!sec) {
WARN_ELF("elf_create_section");
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -456,7 +456,7 @@ static int create_static_call_sections(s
idx++;
sec = elf_create_section(file->elf, ".static_call_sites", SHF_WRITE,
- sizeof(struct static_call_site), idx);
+ sizeof(struct static_call_site), sizeof(unsigned long), idx);
if (!sec)
return -1;
@@ -567,7 +567,8 @@ static int create_mcount_loc_sections(st
list_for_each_entry(insn, &file->mcount_loc_list, mcount_loc_node)
idx++;
- sec = elf_create_section(file->elf, "__mcount_loc", 0, sizeof(unsigned long), idx);
+ sec = elf_create_section(file->elf, "__mcount_loc", 0, sizeof(unsigned long),
+ sizeof(unsigned long), idx);
if (!sec)
return -1;
--- a/tools/objtool/elf.c
+++ b/tools/objtool/elf.c
@@ -737,7 +737,8 @@ struct symbol *elf_create_undef_symbol(s
}
struct section *elf_create_section(struct elf *elf, const char *name,
- unsigned int sh_flags, size_t entsize, int nr)
+ unsigned int sh_flags, size_t entsize,
+ size_t entalign, int nr)
{
struct section *sec, *shstrtab;
size_t size = entsize * nr;
@@ -777,7 +778,7 @@ struct section *elf_create_section(struc
}
sec->data->d_size = size;
- sec->data->d_align = 1;
+ sec->data->d_align = entalign;
if (size) {
sec->data->d_buf = malloc(size);
@@ -796,7 +797,7 @@ struct section *elf_create_section(struc
sec->sh.sh_size = size;
sec->sh.sh_entsize = entsize;
sec->sh.sh_type = SHT_PROGBITS;
- sec->sh.sh_addralign = 1;
+ sec->sh.sh_addralign = entalign;
sec->sh.sh_flags = SHF_ALLOC | sh_flags;
@@ -852,7 +853,7 @@ static struct section *elf_create_rel_re
strcpy(relocname, ".rel");
strcat(relocname, base->name);
- sec = elf_create_section(elf, relocname, 0, sizeof(GElf_Rel), 0);
+ sec = elf_create_section(elf, relocname, 0, sizeof(GElf_Rel), 1, 0);
free(relocname);
if (!sec)
return NULL;
@@ -882,7 +883,7 @@ static struct section *elf_create_rela_r
strcpy(relocname, ".rela");
strcat(relocname, base->name);
- sec = elf_create_section(elf, relocname, 0, sizeof(GElf_Rela), 0);
+ sec = elf_create_section(elf, relocname, 0, sizeof(GElf_Rela), 1, 0);
free(relocname);
if (!sec)
return NULL;
--- a/tools/objtool/include/objtool/elf.h
+++ b/tools/objtool/include/objtool/elf.h
@@ -121,7 +121,7 @@ static inline u32 reloc_hash(struct relo
}
struct elf *elf_open_read(const char *name, int flags);
-struct section *elf_create_section(struct elf *elf, const char *name, unsigned int sh_flags, size_t entsize, int nr);
+struct section *elf_create_section(struct elf *elf, const char *name, unsigned int sh_flags, size_t entsize, size_t entalign, int nr);
struct section *elf_create_reloc_section(struct elf *elf, struct section *base, int reltype);
void elf_add_reloc(struct elf *elf, struct reloc *reloc);
int elf_write_insn(struct elf *elf, struct section *sec,
--- a/tools/objtool/orc_gen.c
+++ b/tools/objtool/orc_gen.c
@@ -235,11 +235,11 @@ int orc_create(struct objtool_file *file
return -1;
}
orc_sec = elf_create_section(file->elf, ".orc_unwind", 0,
- sizeof(struct orc_entry), nr);
+ sizeof(struct orc_entry), 1, nr);
if (!orc_sec)
return -1;
- sec = elf_create_section(file->elf, ".orc_unwind_ip", 0, sizeof(int), nr);
+ sec = elf_create_section(file->elf, ".orc_unwind_ip", 0, sizeof(int), 1, nr);
if (!sec)
return -1;
ip_rsec = elf_create_reloc_section(file->elf, sec, SHT_RELA);
next prev parent reply other threads:[~2021-03-15 12:10 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-14 15:39 [GIT pull] locking/urgent for v5.12-rc3 Thomas Gleixner
2021-03-14 15:39 ` [GIT pull] objtool/urgent " Thomas Gleixner
2021-03-14 20:38 ` pr-tracker-bot
2021-03-14 15:39 ` [GIT pull] sched/urgent " Thomas Gleixner
2021-03-14 20:38 ` pr-tracker-bot
2021-03-14 15:40 ` [GIT pull] timers/urgent " Thomas Gleixner
2021-03-14 20:38 ` pr-tracker-bot
2021-03-14 15:40 ` [GIT pull] irq/urgent for v5.12-rc2 Thomas Gleixner
2021-03-14 20:38 ` pr-tracker-bot
2021-03-14 20:15 ` [GIT pull] locking/urgent for v5.12-rc3 Linus Torvalds
2021-03-15 8:33 ` Peter Zijlstra
2021-03-15 11:10 ` Peter Zijlstra
2021-03-15 11:26 ` Peter Zijlstra
2021-03-15 12:08 ` Peter Zijlstra [this message]
2021-03-15 13:31 ` Steven Rostedt
2021-03-15 17:03 ` Josh Poimboeuf
2021-03-15 17:43 ` Peter Zijlstra
2021-03-15 18:59 ` Linus Torvalds
2021-03-15 22:09 ` Peter Zijlstra
2021-03-14 20:38 ` pr-tracker-bot
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=YE9OOx0za7ZH3AXe@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=x86@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).