public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] modpost: error out if addend_*_rel() is not implemented for REL arch
@ 2023-05-11 16:24 Masahiro Yamada
  2023-05-21 13:11 ` Masahiro Yamada
  0 siblings, 1 reply; 2+ messages in thread
From: Masahiro Yamada @ 2023-05-11 16:24 UTC (permalink / raw)
  To: linux-kbuild
  Cc: linux-kernel, Masahiro Yamada, Nathan Chancellor,
	Nick Desaulniers, Nicolas Schier

The section mismatch check relies on the relocation entries.

For REL, the addend value is implicit, so we need some code to compute
it. Currently, EM_386, EM_ARM, and EM_MIPS are supported. This commit
makes sure we covered all the cases.

I believe the other architectures use RELA, where the explicit r_addend
field exists.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/mod/modpost.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 95da374cc534..44309d463a49 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1442,6 +1442,8 @@ static void section_rel(const char *modname, struct elf_info *elf,
 			if (addend_mips_rel(elf, sechdr, &r))
 				continue;
 			break;
+		default:
+			fatal("Please add code to calculate addend for this architecture\n");
 		}
 		sym = elf->symtab_start + r_sym;
 		/* Skip special sections */
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] modpost: error out if addend_*_rel() is not implemented for REL arch
  2023-05-11 16:24 [PATCH] modpost: error out if addend_*_rel() is not implemented for REL arch Masahiro Yamada
@ 2023-05-21 13:11 ` Masahiro Yamada
  0 siblings, 0 replies; 2+ messages in thread
From: Masahiro Yamada @ 2023-05-21 13:11 UTC (permalink / raw)
  To: linux-kbuild
  Cc: linux-kernel, Nathan Chancellor, Nick Desaulniers, Nicolas Schier

On Fri, May 12, 2023 at 1:25 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> The section mismatch check relies on the relocation entries.
>
> For REL, the addend value is implicit, so we need some code to compute
> it. Currently, EM_386, EM_ARM, and EM_MIPS are supported. This commit
> makes sure we covered all the cases.
>
> I believe the other architectures use RELA, where the explicit r_addend
> field exists.
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---

Applied to linux-kbuild.



>
>  scripts/mod/modpost.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
> index 95da374cc534..44309d463a49 100644
> --- a/scripts/mod/modpost.c
> +++ b/scripts/mod/modpost.c
> @@ -1442,6 +1442,8 @@ static void section_rel(const char *modname, struct elf_info *elf,
>                         if (addend_mips_rel(elf, sechdr, &r))
>                                 continue;
>                         break;
> +               default:
> +                       fatal("Please add code to calculate addend for this architecture\n");
>                 }
>                 sym = elf->symtab_start + r_sym;
>                 /* Skip special sections */
> --
> 2.39.2
>


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-21 13:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-11 16:24 [PATCH] modpost: error out if addend_*_rel() is not implemented for REL arch Masahiro Yamada
2023-05-21 13:11 ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox