Re: [PATCH v2 2/3] riscv/purgatory: do not link with string.o and its dependencies

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8/3/2023 5:13 PM, Palmer Dabbelt wrote:
> On Wed, 26 Jul 2023 09:33:49 PDT (-0700), Conor Dooley wrote:
>> On Wed, Jul 26, 2023 at 11:54:00AM +0200, Petr Tesarik wrote:
>>> From: Petr Tesarik <petr.tesarik.ext@xxxxxxxxxx>
>>>
>>> Linking with this object file makes kexec_file_load(2) fail because of
>>> multiple unknown relocation types:
>>>
>>> - R_RISCV_ADD16, R_RISCV_SUB16: used by alternatives in strcmp()
>>> - R_RISCV_GOT_HI20: used to resolve _ctype in strcasecmp()
>>>
>>> All this hassle is needed for one single call to memcmp() from
>>> verify_sha256_digest() to compare 32 bytes of SHA256 checksum.
>>>
>>> Simply replace this memcmp() call with an explicit loop over those 32
>>> bytes
>>> and remove the need to link with string.o and all the other object files
>>> that provide undefined symbols from that object file.
>>>
>>> Fixes: 838b3e28488f ("RISC-V: Load purgatory in kexec_file")
>>> Signed-off-by: Petr Tesarik <petr.tesarik.ext@xxxxxxxxxx>
>>
>> This version keeps the automation happy,
>> Acked-by: Conor Dooley <conor.dooley@xxxxxxxxxxxxx>
> 
> Oddly enough, this breaks my builds.  I tried fixing the first one with
> something like

FTR I have no idea how a patch to the purgatory code and its Makefile
can have any effect on the compilation of asm-offsets.s in another
directory.

Petr T

>    From 41c5a952f77e53bf4201296abff0132725aa19e6 Mon Sep 17 00:00:00 2001
>    From: Palmer Dabbelt <palmer@xxxxxxxxxxxx>
>    Date: Wed, 2 Aug 2023 20:22:33 -0700
>    Subject: [PATCH] RISC-V: Include io from timex
>       Without this I get some implicit declarations.
>         CC      arch/riscv/kernel/asm-offsets.s
>    In file included from linux/include/linux/timex.h:67,
>                     from linux/include/linux/time32.h:13,
>                     from linux/include/linux/time.h:60,
>                     from linux/include/linux/ktime.h:24,
>                     from linux/include/linux/timer.h:6,
>                     from linux/include/linux/workqueue.h:9,
>                     from linux/include/linux/mm_types.h:19,
>                     from linux/include/linux/mmzone.h:22,
>                     from linux/include/linux/gfp.h:7,
>                     from linux/include/linux/mm.h:7,
>                     from linux/arch/riscv/kernel/asm-offsets.c:10:
>    linux/arch/riscv/include/asm/timex.h: In function 'get_cycles':
>    linux/arch/riscv/include/asm/timex.h:25:16: error: implicit
> declaration of function 'readl_relaxed'
> [-Werror=implicit-function-declaration]
>       25 |         return readl_relaxed(((u32 *)clint_time_val));
>          |
>       Signed-off-by: Palmer Dabbelt <palmer@xxxxxxxxxxxx>
>    ---
>     arch/riscv/include/asm/timex.h | 1 +
>     1 file changed, 1 insertion(+)
>       diff --git a/arch/riscv/include/asm/timex.h
> b/arch/riscv/include/asm/timex.h
>    index a06697846e69..1a4d181193e0 100644
>    --- a/arch/riscv/include/asm/timex.h
>    +++ b/arch/riscv/include/asm/timex.h
>    @@ -7,6 +7,7 @@
>     #define _ASM_RISCV_TIMEX_H
>         #include <asm/csr.h>
>    +#include <asm/io.h>
>         typedef unsigned long cycles_t;
> 
>    --    2.41.0
> 
> The other two look fine and are somewhat independent, so I've picked
> those up
> for fixes.
> 
> Thanks!
> 
>>
>> Thanks,
>> Conor.


_______________________________________________
kexec mailing list
kexec@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/kexec




[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux