mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] modpost: remove unused Elf_Sword macro
@ 2022-07-26 16:52 Masahiro Yamada
  2022-08-02 17:35 ` Nick Desaulniers
  0 siblings, 1 reply; 2+ messages in thread
From: Masahiro Yamada @ 2022-07-26 16:52 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Masahiro Yamada, Michal Marek, Nick Desaulniers, linux-kernel

Commit 9ad21c3f3ecf ("kbuild: try harder to find symbol names in
modpost") added Elf_Sword (in a wrong way), but did not use it at all.

BTW, the current code looks weird.

The fix for the 32-bit part would be:

    Elf64_Sword    -->    Elf32_Sword

(weirdness in the prefix, Elf32_ vs Elf64_)

The fix for the 64-bit part would be:

    Elf64_Sxword   -->    Elf64_Sword

(the size is different between Sword and Sxword)

Note:

    Elf32_Sword   ==  Elf64_Sword   ==  int32_t
    Elf32_Sxword  ==  Elf64_Sxword  ==  int64_t

Anyway, let's drop unused code instead of fixing it.

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

 scripts/mod/modpost.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h
index 68cd4aeeae3d..620f2fd08e05 100644
--- a/scripts/mod/modpost.h
+++ b/scripts/mod/modpost.h
@@ -26,7 +26,6 @@
 #define Elf_Shdr    Elf32_Shdr
 #define Elf_Sym     Elf32_Sym
 #define Elf_Addr    Elf32_Addr
-#define Elf_Sword   Elf64_Sword
 #define Elf_Section Elf32_Half
 #define ELF_ST_BIND ELF32_ST_BIND
 #define ELF_ST_TYPE ELF32_ST_TYPE
@@ -41,7 +40,6 @@
 #define Elf_Shdr    Elf64_Shdr
 #define Elf_Sym     Elf64_Sym
 #define Elf_Addr    Elf64_Addr
-#define Elf_Sword   Elf64_Sxword
 #define Elf_Section Elf64_Half
 #define ELF_ST_BIND ELF64_ST_BIND
 #define ELF_ST_TYPE ELF64_ST_TYPE
-- 
2.34.1


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

* Re: [PATCH] modpost: remove unused Elf_Sword macro
  2022-07-26 16:52 [PATCH] modpost: remove unused Elf_Sword macro Masahiro Yamada
@ 2022-08-02 17:35 ` Nick Desaulniers
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Desaulniers @ 2022-08-02 17:35 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: linux-kbuild, Michal Marek, linux-kernel

On Tue, Jul 26, 2022 at 9:53 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> Commit 9ad21c3f3ecf ("kbuild: try harder to find symbol names in
> modpost") added Elf_Sword (in a wrong way), but did not use it at all.
>
> BTW, the current code looks weird.
>
> The fix for the 32-bit part would be:
>
>     Elf64_Sword    -->    Elf32_Sword
>
> (weirdness in the prefix, Elf32_ vs Elf64_)
>
> The fix for the 64-bit part would be:
>
>     Elf64_Sxword   -->    Elf64_Sword
>
> (the size is different between Sword and Sxword)
>
> Note:
>
>     Elf32_Sword   ==  Elf64_Sword   ==  int32_t
>     Elf32_Sxword  ==  Elf64_Sxword  ==  int64_t
>
> Anyway, let's drop unused code instead of fixing it.
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

Thanks for the patch!
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

> ---
>
>  scripts/mod/modpost.h | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h
> index 68cd4aeeae3d..620f2fd08e05 100644
> --- a/scripts/mod/modpost.h
> +++ b/scripts/mod/modpost.h
> @@ -26,7 +26,6 @@
>  #define Elf_Shdr    Elf32_Shdr
>  #define Elf_Sym     Elf32_Sym
>  #define Elf_Addr    Elf32_Addr
> -#define Elf_Sword   Elf64_Sword
>  #define Elf_Section Elf32_Half
>  #define ELF_ST_BIND ELF32_ST_BIND
>  #define ELF_ST_TYPE ELF32_ST_TYPE
> @@ -41,7 +40,6 @@
>  #define Elf_Shdr    Elf64_Shdr
>  #define Elf_Sym     Elf64_Sym
>  #define Elf_Addr    Elf64_Addr
> -#define Elf_Sword   Elf64_Sxword
>  #define Elf_Section Elf64_Half
>  #define ELF_ST_BIND ELF64_ST_BIND
>  #define ELF_ST_TYPE ELF64_ST_TYPE
> --
> 2.34.1
>


-- 
Thanks,
~Nick Desaulniers

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

end of thread, other threads:[~2022-08-02 17:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-26 16:52 [PATCH] modpost: remove unused Elf_Sword macro Masahiro Yamada
2022-08-02 17:35 ` Nick Desaulniers

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

all inboxes | Powered by JetHome®