linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josh Poimboeuf <jpoimboe@kernel.org>
To: "Thomas Weißschuh" <linux@weissschuh.net>
Cc: Peter Zijlstra <peterz@infradead.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 5/8] objtool: reduce memory usage of struct reloc
Date: Mon, 30 Jan 2023 15:59:39 -0800	[thread overview]
Message-ID: <20230130235939.5kuau4d7agbmxqal@treble> (raw)
In-Reply-To: <20221216-objtool-memory-v2-5-17968f85a464@weissschuh.net>

On Tue, Dec 27, 2022 at 04:01:01PM +0000, Thomas Weißschuh wrote:
>  void elf_reloc_set_type(struct reloc *reloc, int type)
>  {
> +	if (type >= (1U << (8 * sizeof(reloc->type))))
> +		WARN("reloc->type out of range: %d", type);
> +
>  	reloc->type = type;
>  }
> diff --git a/tools/objtool/include/objtool/elf.h b/tools/objtool/include/objtool/elf.h
> index 33ec6cf72325..2b5becad5a0a 100644
> --- a/tools/objtool/include/objtool/elf.h
> +++ b/tools/objtool/include/objtool/elf.h
> @@ -77,10 +77,10 @@ struct reloc {
>  	struct symbol *sym;
>  	struct list_head sym_reloc_entry;
>  	unsigned long offset;
> -	unsigned int type;
>  	s64 addend;
>  	int idx;
>  	bool jump_table_start;
> +	unsigned char type;
>  };

I'd rather not because

  a) the helper function isn't very intuitive and we'll probably forget
     to use it

  b) some arches need more than 256 types (see for example aarch64 which
     objtool may need to support one of these days)

That said, feel free to rearrange the struct fields to at least get some
of those bytes back.

-- 
Josh

  parent reply	other threads:[~2023-01-31  0:00 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-27 16:00 [PATCH v2 0/8] reduce maximum memory usage Thomas Weißschuh
2022-12-27 16:00 ` [PATCH v2 1/8] objtool: make struct entries[] static and const Thomas Weißschuh
2023-02-01 16:26   ` [tip: objtool/core] objtool: Make " tip-bot2 for Thomas Weißschuh
2023-02-04 10:17   ` tip-bot2 for Thomas Weißschuh
2022-12-27 16:00 ` [PATCH v2 2/8] objtool: make struct check_options static Thomas Weißschuh
2023-02-01 16:26   ` [tip: objtool/core] objtool: Make " tip-bot2 for Thomas Weißschuh
2023-02-04 10:17   ` tip-bot2 for Thomas Weißschuh
2022-12-27 16:00 ` [PATCH v2 3/8] objtool: allocate multiple structures with calloc() Thomas Weißschuh
2023-01-30 23:53   ` Josh Poimboeuf
2023-02-01 16:26   ` [tip: objtool/core] objtool: Allocate " tip-bot2 for Thomas Weißschuh
2023-02-04 10:17   ` tip-bot2 for Thomas Weißschuh
2022-12-27 16:01 ` [PATCH v2 4/8] objtool: introduce function elf_reloc_set_type Thomas Weißschuh
2022-12-27 16:01 ` [PATCH v2 5/8] objtool: reduce memory usage of struct reloc Thomas Weißschuh
2022-12-29  1:33   ` Rong Tao
2022-12-29  2:26     ` Thomas Weißschuh
2022-12-29  3:29       ` Rong Tao
2022-12-29  5:57         ` Thomas Weißschuh
2023-01-30 23:59   ` Josh Poimboeuf [this message]
2022-12-27 16:01 ` [PATCH v2 6/8] objtool: optimize layout of struct symbol Thomas Weißschuh
2023-02-01 16:26   ` [tip: objtool/core] objtool: Optimize " tip-bot2 for Thomas Weißschuh
2023-02-04 10:17   ` tip-bot2 for Thomas Weißschuh
2022-12-27 16:01 ` [PATCH v2 7/8] objtool: optimize layout of struct special_alt Thomas Weißschuh
2023-02-01 16:26   ` [tip: objtool/core] objtool: Optimize " tip-bot2 for Thomas Weißschuh
2023-02-04 10:17   ` tip-bot2 for Thomas Weißschuh
2022-12-27 16:01 ` [PATCH v2 8/8] objtool: explicitly cleanup resources on success Thomas Weißschuh
2023-01-31  0:02   ` Josh Poimboeuf
2023-01-29 21:43 ` [PATCH v2 0/8] objtool: reduce maximum memory usage Thomas Weißschuh
2023-01-31  0:03   ` Josh Poimboeuf
2023-01-31  3:54     ` Thomas Weißschuh
2023-01-31 17:27       ` Josh Poimboeuf
2023-02-07 17:30         ` Josh Poimboeuf
2023-02-01 12:51       ` David Laight

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=20230130235939.5kuau4d7agbmxqal@treble \
    --to=jpoimboe@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --cc=peterz@infradead.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).