Noah Watkins <[email protected]> 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 -- [email protected] To unsubscribe send an email to [email protected]
