2024-02-01 09:17:08

by Jia Jie Ho

[permalink] [raw]
Subject: RE: [PATCH v2 4/5] crypto: starfive: Add sm3 support for JH8100

> > Currently, the object files defining new algo register/unregister functions
> weren't included in Makefile for unsupported device.
> > Compiler will still check for these definitions if IS_ENABLED is used instead of
> ifdef causing build errors.
>
> Please point me to specific examples of something that's included in the
> output and shouldn't be.
>

When compiling both CRYPTO_DEV_JH7110 and CRYPTO_DEV_JH8100 as module,
the compiler flags the following functions as undefined even though they are folded in IS_REACHABLE

#if IS_REACHABLE(CONFIG_CRYPTO_DEV_JH8100)
int starfive_sm3_register_algs(void);
void starfive_sm3_unregister_algs(void);
int starfive_sm4_register_algs(void);
void starfive_sm4_unregister_algs(void);
void starfive_sm3_done_task(unsigned long param);
#endif

ERROR: modpost: "starfive_sm3_done_task" [drivers/crypto/starfive/jh7110-crypto.ko] undefined!
ERROR: modpost: "starfive_sm4_register_algs" [drivers/crypto/starfive/jh7110-crypto.ko] undefined!
ERROR: modpost: "starfive_sm3_unregister_algs" [drivers/crypto/starfive/jh7110-crypto.ko] undefined!
ERROR: modpost: "starfive_sm3_register_algs" [drivers/crypto/starfive/jh7110-crypto.ko] undefined!
ERROR: modpost: "starfive_sm4_unregister_algs" [drivers/crypto/starfive/jh7110-crypto.ko] undefined!

The object files defining these functions aren't included for CRYPTO_DEV_JH7110 in the Makefile.
obj-$(CONFIG_CRYPTO_DEV_JH7110) += jh7110-crypto.o
jh7110-crypto-objs := jh7110-cryp.o jh7110-hash.o jh7110-rsa.o jh7110-aeso

obj-$(CONFIG_CRYPTO_DEV_JH8100) += jh8100-crypto.o
jh8100-crypto-objs := jh7110-cryp.o jh7110-hash.o jh7110-rsa.o jh7110-aeso jh8100-sm3.o jh8100-sm4.o

Thanks,
Jia Jie