public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: changhuaixin <changhuaixin@linux.alibaba.com>
To: Ingo Molnar <mingo@kernel.org>
Cc: changhuaixin <changhuaixin@linux.alibaba.com>,
	bp@alien8.de, hpa@zytor.com, linux-kbuild@vger.kernel.org,
	linux-kernel@vger.kernel.org, luto@amacapital.net,
	michal.lkml@markovi.net, mingo@redhat.com,
	Peter Zijlstra <peterz@infradead.org>,
	tglx@linutronix.de, x86@kernel.org,
	yamada.masahiro@socionext.com, jpoimboe@redhat.com
Subject: Re: [PATCH 1/3] scripts/sorttable: Change section type of orc_lookup to SHT_PROGBITS
Date: Tue, 4 Aug 2020 09:40:40 +0800	[thread overview]
Message-ID: <2714DF66-5F65-4CB1-A232-B88E4D5AF566@linux.alibaba.com> (raw)
In-Reply-To: <20200723034643.33537-2-changhuaixin@linux.alibaba.com>

Hi, Ingo

Another way to write SHT_PROGBITS is using elf_create_section to write orc_lookup table headers, when orc_unwind_ip table and orc_unwind table are written. Is this a better solution?

diff --git a/tools/objtool/orc_gen.c b/tools/objtool/orc_gen.c
index 3f98dcfbc177..860d4dcec8e6 100644
--- a/tools/objtool/orc_gen.c
+++ b/tools/objtool/orc_gen.c
@@ -183,6 +183,10 @@ int create_orc_sections(struct objtool_file *file)
        u_sec = elf_create_section(file->elf, ".orc_unwind",
                                   sizeof(struct orc_entry), idx);

+       /* make flags of section orc_lookup right */
+       if (!elf_create_section(file->elf, ".orc_lookup", sizeof(int), 0))
+               return -1;
+
        /* populate sections */
        idx = 0;
        for_each_sec(file, sec) {

Thanks,
Huaixin

> On Jul 23, 2020, at 11:46 AM, Huaixin Chang <changhuaixin@linux.alibaba.com> wrote:
> 
> In order to edit orc_lookup table via sorttable, type of section
> orc_lookup needs to be SHT_PROGBITS instead of SHT_NOBITS.
> 
> Linker script doesn't seem to allow manual specification of the section
> type, so just write a byte into the section instead.
> 
> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
> Signed-off-by: Huaixin Chang <changhuaixin@linux.alibaba.com>
> Signed-off-by: Shile Zhang <shile.zhang@linux.alibaba.com>
> ---
> include/asm-generic/vmlinux.lds.h | 2 ++
> 1 file changed, 2 insertions(+)
> 
> diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
> index db600ef218d7..49f4f5bc6165 100644
> --- a/include/asm-generic/vmlinux.lds.h
> +++ b/include/asm-generic/vmlinux.lds.h
> @@ -826,6 +826,8 @@
> 		. += (((SIZEOF(.text) + LOOKUP_BLOCK_SIZE - 1) /	\
> 			LOOKUP_BLOCK_SIZE) + 1) * 4;			\
> 		orc_lookup_end = .;					\
> +		/* HACK: force SHT_PROGBITS so sorttable can edit: */	\
> +		BYTE(1);						\
> 	}
> #else
> #define ORC_UNWIND_TABLE
> -- 
> 2.14.4.44.g2045bb6


       reply	other threads:[~2020-08-04  1:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200723034643.33537-1-changhuaixin@linux.alibaba.com>
     [not found] ` <20200723034643.33537-2-changhuaixin@linux.alibaba.com>
2020-08-04  1:40   ` changhuaixin [this message]
2020-08-06 15:08     ` [PATCH 1/3] scripts/sorttable: Change section type of orc_lookup to SHT_PROGBITS Ingo Molnar
2020-08-07  4:22       ` changhuaixin
2020-08-07  4:17 ` [PATCH v2 0/3] Build ORC fast lookup table in scripts/sorttable tool Huaixin Chang
2020-08-07  4:18   ` [PATCH 1/3] objtool: Write .orc_lookup section header Huaixin Chang
2020-08-07  4:18   ` [PATCH 2/3] scripts/sorttable: Build ORC fast lookup table via sorttable tool Huaixin Chang
2020-08-07  4:18   ` [PATCH 3/3] x86/unwind/orc: Simplify unwind_init() for x86 boot Huaixin Chang
2020-08-19  3:03   ` [PATCH v2 0/3] Build ORC fast lookup table in scripts/sorttable tool changhuaixin
2020-06-01 17:38 [PATCH 0/2] " Josh Poimboeuf
2020-06-03 14:31 ` [PATCH v2 0/3] " Huaixin Chang
2020-06-03 14:31   ` [PATCH 1/3] scripts/sorttable: Change section type of orc_lookup to SHT_PROGBITS Huaixin Chang
2020-06-03 14:39 ` [PATCH v3 0/3] Build ORC fast lookup table in scripts/sorttable tool Huaixin Chang
2020-06-03 14:39   ` [PATCH 1/3] scripts/sorttable: Change section type of orc_lookup to SHT_PROGBITS Huaixin Chang

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=2714DF66-5F65-4CB1-A232-B88E4D5AF566@linux.alibaba.com \
    --to=changhuaixin@linux.alibaba.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=michal.lkml@markovi.net \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=yamada.masahiro@socionext.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