[PATCH] arm64: Change .weak to SYM_FUNC_START_WEAK_PI for arch/arm64/lib/mem*.S

Sami Tolvanen samitolvanen at google.com
Thu Oct 29 14:52:58 EDT 2020


On Thu, Oct 29, 2020 at 11:20 AM Fangrui Song <maskray at google.com> wrote:
>
> Commit 39d114ddc682 ("arm64: add KASAN support") added .weak directives to
> arch/arm64/lib/mem*.S instead of changing the existing SYM_FUNC_START_PI
> macros. This can lead to the assembly snippet `.weak memcpy ... .globl
> memcpy` which will produce a STB_WEAK memcpy with GNU as but STB_GLOBAL
> memcpy with LLVM's integrated assembler before LLVM 12. LLVM 12 (since
> https://reviews.llvm.org/D90108) will error on such an overridden symbol
> binding.
>
> Use the appropriate SYM_FUNC_START_WEAK_PI instead.
>
> Fixes: 39d114ddc682 ("arm64: add KASAN support")
> Reported-by: Sami Tolvanen <samitolvanen at google.com>
> Signed-off-by: Fangrui Song <maskray at google.com>
> Cc: <stable at vger.kernel.org>
> ---
>  arch/arm64/lib/memcpy.S  | 3 +--
>  arch/arm64/lib/memmove.S | 3 +--
>  arch/arm64/lib/memset.S  | 3 +--
>  3 files changed, 3 insertions(+), 6 deletions(-)

Thanks for the patch! This fixes the build with Clang 12 + LLVM_IAS=1,
and also builds and boots with gcc 9.3 and Clang 12 without IAS.

Tested-by: Sami Tolvanen <samitolvanen at google.com>

Sami



More information about the linux-arm-kernel mailing list