Re: Undefined reference with clang16 and address sanitizer
Niels, Thank you very much for the quick response. > Also, Nettle's configure modifies CFLAGS (which is somewhat debatable), > so it may be more reliable with > > CC="clang -fsanitize=address" This indeed did the trick. It's still a bit mysterious why older versions of clang didn't have this problem, and just generally mysterious why the sanitizer would cause the issue. But, it does seem to be ok now (fwiw sanitizer does report a memory leak when eccdata is running at the end of make). On Tue, Apr 25, 2023 at 10:35 PM Niels Möller wrote: > > Noah Watkins writes: > > > Hi nettle-bugs, > > > > We just updated to clang-16 and are encountering an issue compiling > > nettle with -fsanitize=address. > > > > Configured with > > > > CC=clang CXX=clang++ CFLAGS="-fsanitize=address" > > LDFLAGS="-fsanitize=address" ./configure --disable-documentation > > --enable-x86-aesni > > Note that --enable-x86-aesni has no effect in a fat build (which is the > default). If you really want to unconditionally use aesni instructions, you > need --disable-fat --enable-x86-aesni. Thanks a lot. I'm not entirely sure of the lineage of the flags we are using, but indeed the intention was to unconditionally enable so we'll apply this. > > To be clear, you mean the nettle-3.8.1 release? I was testing with a fresh clone of nettle from git as well as 3.8.1 release. - Noah ___ nettle-bugs mailing list -- nettle-bugs@lists.lysator.liu.se To unsubscribe send an email to nettle-bugs-le...@lists.lysator.liu.se
Re: Undefined reference with clang16 and address sanitizer
Noah Watkins writes: > Hi nettle-bugs, > > We just updated to clang-16 and are encountering an issue compiling > nettle with -fsanitize=address. > > Configured with > > CC=clang CXX=clang++ CFLAGS="-fsanitize=address" > LDFLAGS="-fsanitize=address" ./configure --disable-documentation > --enable-x86-aesni Note that --enable-x86-aesni has no effect in a fat build (which is the default). If you really want to unconditionally use aesni instructions, you need --disable-fat --enable-x86-aesni. Also, Nettle's configure modifies CFLAGS (which is somewhat debatable), so it may be more reliable with CC="clang -fsanitize=address" > I did just test with upstream nettle and the issue appears to be present > there. To be clear, you mean the nettle-3.8.1 release? > /usr/bin/ld: ../libnettle.so: undefined reference to > `_nettle_aes192_encrypt_aesni' > /usr/bin/ld: ../libnettle.so: undefined reference to > `_nettle_poly1305_set_key' > /usr/bin/ld: ../libnettle.so: undefined reference to `_nettle_salsa20_2core' > /usr/bin/ld: ../libnettle.so: undefined reference to `_nettle_poly1305_blocks' > /usr/bin/ld: ../libnettle.so: undefined reference to `nettle_serpent_decrypt' > /usr/bin/ld: ../libnettle.so: undefined reference to `_nettle_memxor_sse2' > /usr/bin/ld: ../libnettle.so: undefined reference to `_nettle_umac_nh_n' > /usr/bin/ld: ../libnettle.so: undefined reference to `_nettle_camellia_crypt' > /usr/bin/ld: ../libnettle.so: undefined reference to > `_nettle_aes128_encrypt_aesni' > /usr/bin/ld: ../libnettle.so: undefined reference to > `_nettle_ghash_update_pclmul' > ``` It seems you get link errors on all the assembly files that should go into libnettle.so. The way it's supposed to work, configure should symlink various .asm files from the x86_64/ subdirectories into the build directory, where they are preprocessed with m4 into .s files, and passed to the compiler (unix C compiler frontends traditionally recognize .s files as assembly, and invoke the appropriate assembler). To troubleshoot, I would suggest (i) double check that you start with a clean tree, make distclean, (ii) comparing configure output and build steps between your clang-14 and clang-16 builds, (iii) examine the contents of libnettle.so, so try to figure out if the assembly files are missing completely, or if they're there but with some other symbol names (those are tweaked a bit by fat build logic: names with suffixes like _aesni and _pclmul are typical for fat builds, and setup by the wrapper files in x86_64/fat/). Regards, /Niels -- Niels Möller. PGP key CB4962D070D77D7FCB8BA36271D8F1FF368C6677. Internet email is subject to wholesale government surveillance. ___ nettle-bugs mailing list -- nettle-bugs@lists.lysator.liu.se To unsubscribe send an email to nettle-bugs-le...@lists.lysator.liu.se
Undefined references with clang-16 and address sanitizer
We just updated to clang-16 and are encountering an issue compiling nettle with -fsanitize=address. Configured with CC=clang CXX=clang++ CFLAGS="-fsanitize=address" LDFLAGS="-fsanitize=address" ./configure --disable-documentation --enable-x86-aesni We get the following errors. This doesn't appear to be an issue with clang-14 (I didn't try 15). I did just test with upstream nettle and the issue appears to be present there. Any pointers? Thanks! Noah ``` clang -fsanitize=address -ggdb3 -Wall -W -Wno-sign-compare -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wpointer-arith -Wbad-function-cast -Wnested-externs -L.. -fsanitize=address nettle-pbkdf2.o misc.o ../getopt.o ../getopt1.o -lnettle -o nettle-pbkdf2 clang -fsanitize=address -ggdb3 -Wall -W -Wno-sign-compare -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wpointer-arith -Wbad-function-cast -Wnested-externs -L.. -fsanitize=address nettle-hash.o misc.o ../getopt.o ../getopt1.o -lnettle -o nettle-hash clang -fsanitize=address -ggdb3 -Wall -W -Wno-sign-compare -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wpointer-arith -Wbad-function-cast -Wnested-externs -L.. -fsanitize=address sexp-conv.o input.o output.o parse.o misc.o ../getopt.o ../getopt1.o -lnettle -lgmp -o sexp-conv clang -fsanitize=address -ggdb3 -Wall -W -Wno-sign-compare -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wpointer-arith -Wbad-function-cast -Wnested-externs -L.. -fsanitize=address pkcs1-conv.o misc.o ../getopt.o ../getopt1.o -lhogweed -lnettle -lgmp -o pkcs1-conv /usr/bin/ld: ../libnettle.so: undefined reference to `_nettle_aes192_encrypt_aesni' /usr/bin/ld: ../libnettle.so: undefined reference to `_nettle_poly1305_set_key' /usr/bin/ld: ../libnettle.so: undefined reference to `_nettle_salsa20_2core' /usr/bin/ld: ../libnettle.so: undefined reference to `_nettle_poly1305_blocks' /usr/bin/ld: ../libnettle.so: undefined reference to `nettle_serpent_decrypt' /usr/bin/ld: ../libnettle.so: undefined reference to `_nettle_memxor_sse2' /usr/bin/ld: ../libnettle.so: undefined reference to `_nettle_umac_nh_n' /usr/bin/ld: ../libnettle.so: undefined reference to `_nettle_camellia_crypt' /usr/bin/ld: ../libnettle.so: undefined reference to `_nettle_aes128_encrypt_aesni' /usr/bin/ld: ../libnettle.so: undefined reference to `_nettle_ghash_update_pclmul' ``` ___ nettle-bugs mailing list -- nettle-bugs@lists.lysator.liu.se To unsubscribe send an email to nettle-bugs-le...@lists.lysator.liu.se