smuellerDD / lrng

Linux Random Number Generator
http://www.chronox.de/lrng
68 stars 11 forks source link

compilation error help #14

Closed chilkat81 closed 2 years ago

chilkat81 commented 2 years ago

Can you help getting a compilation error? my kernel source 4.4 , lrng backports v43-4.4

GCC 13 compilation error

../include/linux/compiler.h:513:45: error: call to 'compiletime_assert_43' declared with attribute error: BUILD_BUG_ON failed: LRNG_MAX_DIGESTSIZE % sizeof(unsigned long) 513 | _compiletime_assert(condition, msg, compiletimeassert, COUNTER) | ^ ../include/linux/compiler.h:496:25: note: in definition of macro '__compiletime_assert' 496 | prefix ## suffix(); \ | ^~ ../include/linux/compiler.h:513:9: note: in expansion of macro '_compiletime_assert' 513 | _compiletime_assert(condition, msg, compiletimeassert, COUNTER__) | ^~~~~~~ ../include/linux/bug.h:50:37: note: in expansion of macro 'compiletime_assert' 50 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | ^~~~~~ ../include/linux/bug.h:74:9: note: in expansion of macro 'BUILD_BUG_ON_MSG' 74 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition) | ^~~~ ../drivers/char/lrng/lrng_es_mgr.c:274:9: note: in expansion of macro 'BUILD_BUG_ON' 274 | BUILD_BUG_ON(LRNG_MAX_DIGESTSIZE % sizeof(unsigned long));

Clang 15 compilation error

ld.lld: error: undefined symbol: __compiletime_assert_43

referenced by synaptics_dsx_test_reporting.c drivers/built-in.o:(rand initialize)

Thank you for your efforts.

smuellerDD commented 2 years ago

Am Donnerstag, 23. Juni 2022, 13:15:43 CEST schrieb chilkat81:

Hi chilkat81,

Can you help getting a compilation error? my kernel source 4.4 , lrng backports v43-4.4

I see the issue, you are using SHA-1 with 20 bytes digestsize and have a 64 bit system.

The following patch should fix the issue - if you confirm that it works, I will push it (that patch is against the v45 code base, so you see a fuzz when applying against v43):

diff --git a/lrng_es_mgr.c b/lrng_es_mgr.c index 510c35a02be3..8cf80fa9ebcc 100644 --- a/lrng_es_mgr.c +++ b/lrng_es_mgr.c @@ -330,14 +330,13 @@ int __init lrng_rand_initialize(void) { struct seed { ktime_t time;

GCC 13 compilation error

../include/linux/compiler.h:513:45: error: call to 'compiletime_assert_43' declared with attribute error: BUILD_BUG_ON failed: LRNG_MAX_DIGESTSIZE % sizeof(unsigned long) 513 | _compiletime_assert(condition, msg, compiletimeassert, COUNTER) | ^

../include/linux/compiler.h:496:25: note: in definition of macro '__compiletime_assert' 496 | prefix ## suffix();
\ | ^~

../include/linux/compiler.h:513:9: note: in expansion of macro '_compiletime_assert' 513 | _compiletime_assert(condition, msg, compiletimeassert, COUNTER__) | ^~~~~~~

../include/linux/bug.h:50:37: note: in expansion of macro 'compiletime_assert' 50 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | ^~~~~~

../include/linux/bug.h:74:9: note: in expansion of macro 'BUILD_BUG_ON_MSG' 74 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: "

condition)

  |         ^~~~~~~~~~~~~~~~

../drivers/char/lrng/lrng_es_mgr.c:274:9: note: in expansion of macro 'BUILD_BUG_ON' 274 | BUILD_BUG_ON(LRNG_MAX_DIGESTSIZE % sizeof(unsigned long));

Clang 15 compilation error

ld.lld: error: undefined symbol: __compiletime_assert_43

referenced by synaptics_dsx_test_reporting.c

          drivers/built-in.o:(rand initialize)

Thank you for your efforts.

Ciao Stephan

chilkat81 commented 2 years ago

Thank you very much for your interest. my problem was solved

CC drivers/char/lrng/lrng_es_mgr.o CC drivers/char/lrng/lrng_aux.o CC drivers/char/lrng/lrng_gcd.o CC drivers/char/lrng/lrng_es_irq.o CC drivers/char/lrng/lrng_es_archrandom.o CC drivers/char/lrng/lrng_drng.o CC drivers/char/lrng/lrng_chacha20.o CC drivers/char/lrng/lrng_interfaces.o CC drivers/char/lrng/lrng_es_aux.o CC drivers/char/lrng/lrng_proc.o LD drivers/char/lrng/built-in.o