Discussion:
Mapfile missing from shared object artifact?
Jeffrey Walton
2017-11-07 17:33:36 UTC
Permalink
I'm trying to run 'make check' on Solaris. It results in:

$ ./cryptestcwd v
ld.so.1: cryptestcwd: fatal:
/export/home/cryptopp/.libs/libcryptopp.so.6: hardware capability
(CA_SUNW_HW_1) unsupported: 0x4800000 [ AES SSE4.1 ]
Killed

I have a Mapfile to set the capabilities for the binaries, and it was
added to AM_LDFLAGS in configure.ac
(https://github.com/noloader/cryptopp-autotools/blob/master/configure.ac#L186):

LDFLAGS="-M cryptopp.mapfile"
AC_MSG_CHECKING([if $LD supports $LDFLAGS])
AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_RESULT([yes]); AC_SUBST([tr_RESULT], [1])],
[AC_MSG_RESULT([no]); AC_SUBST([tr_RESULT], [0])]
)

if test "$tr_RESULT" -eq "1"; then
AM_LDFLAGS="$AM_LDFLAGS $LDFLAGS"
fi

AM_LDFLAGS is used in all recipes where a uniform LDFLAG name is
present. For us, there is one and it is libcryptopp_LDFLAGS
(https://github.com/noloader/cryptopp-autotools/blob/master/Makefile.am#L105
):

libcryptopp_la_LDFLAGS = $(AM_LDFLAGS) -version-info 6:0:0

The libtool link command is shown below but it lacks the mapfile.

There's not too many results when searching:
https://www.google.com/search?q=automake+"shared+object"+mapfile

Any ideas what I might be doing wrong?

Thanks in advance,

Jeff

**********************

The following is a summary that is printed after configuration. It
shows the flag is present.

CRYPTOPP_CPU_FLAG: -xarch=sse2
CRYPTOPP_ARIA_FLAG: -xarch=ssse3
CRYPTOPP_BLAKE2_FLAG: -xarch=sse4_2
CRYPTOPP_CRC_FLAG: -xarch=sse4_2
CRYPTOPP_AES_FLAG: -xarch=aes

Automake flags (can be overridden by user flags):
AM_CXXFLAGS: -DCRYPTOPP_DISABLE_SHA
AM_LDFLAGS: -M cryptopp.mapfile -lnsl -lsocket -xarch=sse2
-xarch=ssse3 -xarch=sse4_1 -xarch=sse4_2 -xarch=aes

User flags (overrides Automake flags on conflict):
CXXFLAGS: -g
LDFLAGS:

**********************

libtool: link: /opt/solarisstudio12.4/bin/CC -G -hlibcryptopp.so.6 -o
.libs/libcryptopp.so.6.0.0 .libs/adhoc.o
.libs/libcryptlib_la-cryptlib.o .libs/libcpu_la-cpu.o
.libs/libinteger_la-integer.o .libs/libaria_simd_la-aria-simd.o
.libs/libblake2_simd_la-blake2-simd.o .libs/libcrc_simd_la-crc-simd.o
.libs/libgcm_simd_la-gcm-simd.o .libs/libneon_simd_la-neon-simd.o
.libs/libppc_simd_la-ppc-simd.o
.libs/librijndael_simd_la-rijndael-simd.o
.libs/libsha_simd_la-sha-simd.o
.libs/libshacal2_simd_la-shacal2-simd.o .libs/3way.o .libs/adler32.o
.libs/algebra.o .libs/algparam.o .libs/arc4.o .libs/aria.o
.libs/ariatab.o .libs/asn.o .libs/authenc.o .libs/base32.o
.libs/base64.o .libs/basecode.o .libs/bfinit.o .libs/blake2.o
.libs/blowfish.o .libs/blumshub.o .libs/camellia.o .libs/cast.o
.libs/casts.o .libs/cbcmac.o .libs/ccm.o .libs/chacha.o
.libs/channels.o .libs/cmac.o .libs/crc.o .libs/default.o .libs/des.o
.libs/dessp.o .libs/dh.o .libs/dh2.o .libs/dll.o .libs/dsa.o
.libs/eax.o .libs/ec2n.o .libs/eccrypto.o .libs/ecp.o .libs/elgamal.o
.libs/emsa2.o .libs/eprecomp.o .libs/esign.o .libs/files.o
.libs/filters.o .libs/fips140.o .libs/fipstest.o .libs/gcm.o
.libs/gf256.o .libs/gf2_32.o .libs/gf2n.o .libs/gfpcrypt.o
.libs/gost.o .libs/gzip.o .libs/hex.o .libs/hmac.o .libs/hrtimer.o
.libs/ida.o .libs/idea.o .libs/iterhash.o .libs/kalyna.o
.libs/kalynatab.o .libs/keccak.o .libs/luc.o .libs/mars.o
.libs/marss.o .libs/md2.o .libs/md4.o .libs/md5.o .libs/misc.o
.libs/modes.o .libs/mqueue.o .libs/mqv.o .libs/nbtheory.o
.libs/network.o .libs/oaep.o .libs/osrng.o .libs/padlkrng.o
.libs/panama.o .libs/pkcspad.o .libs/poly1305.o .libs/polynomi.o
.libs/pssr.o .libs/pubkey.o .libs/queue.o .libs/rabin.o
.libs/randpool.o .libs/rc2.o .libs/rc5.o .libs/rc6.o .libs/rdrand.o
.libs/rdtables.o .libs/rijndael.o .libs/ripemd.o .libs/rng.o
.libs/rsa.o .libs/rw.o .libs/safer.o .libs/salsa.o .libs/seal.o
.libs/seed.o .libs/serpent.o .libs/sha.o .libs/sha3.o .libs/shacal2.o
.libs/shark.o .libs/sharkbox.o .libs/skipjack.o .libs/socketft.o
.libs/sosemanuk.o .libs/square.o .libs/squaretb.o .libs/strciphr.o
.libs/tea.o .libs/tftables.o .libs/threefish.o .libs/tiger.o
.libs/tigertab.o .libs/trdlocal.o .libs/ttmac.o .libs/twofish.o
.libs/vmac.o .libs/wait.o .libs/wake.o .libs/whrlpool.o .libs/xtr.o
.libs/xtrcrypt.o .libs/zdeflate.o .libs/zinflate.o .libs/zlib.o
-lnsl -lsocket -library=Cstd -library=Crun -lc -xarch=sse2
-xarch=ssse3 -xarch=sse4_1 -xarch=sse4_2 -xarch=aes
libtool: link: (cd ".libs" && rm -f "libcryptopp.so.6" && ln -s
"libcryptopp.so.6.0.0" "libcryptopp.so.6")
libtool: link: (cd ".libs" && rm -f "libcryptopp.so" && ln -s
"libcryptopp.so.6.0.0" "libcryptopp.so")
Jeffrey Walton
2017-11-08 20:53:57 UTC
Permalink
Post by Jeffrey Walton
$ ./cryptestcwd v
/export/home/cryptopp/.libs/libcryptopp.so.6: hardware capability
(CA_SUNW_HW_1) unsupported: 0x4800000 [ AES SSE4.1 ]
Killed
Any thoughts on this issue?

Looking at the link command it appears the -M cryptopp.mapfile is
being actively removed. There appears to be a hole with whitespace
instead of my option:

libtool: link: /opt/solarisstudio12.4/bin/CC -G -hlibcryptopp.so.6 -o
.libs/libcryptopp.so.6.0.0 <object files ...> .libs/zinflate.o
.libs/zlib.o -lnsl -lsocket -library=Cstd -library=Crun -lc -O3
-xarch=sse2 -xarch=ssse3 -xarch=sse4_1 -xarch=sse4_2 -xarch=aes

Jeff
Jeffrey Walton
2017-11-09 04:10:20 UTC
Permalink
Post by Jeffrey Walton
Post by Jeffrey Walton
$ ./cryptestcwd v
/export/home/cryptopp/.libs/libcryptopp.so.6: hardware capability
(CA_SUNW_HW_1) unsupported: 0x4800000 [ AES SSE4.1 ]
Killed
Any thoughts on this issue?
I gave up trying to have Automake use the flag. When I finally got it
applied using 'sed' on 'libtool', libtool choked on the option.

We ended up hijacking libtool's postlink_cmds (which was empty), and
inserting a script that used elfedit to insert the capabilities we
wanted:

elfedit -e 'cap:hw1 0x1800' .libs/libcryptopp.so.6.0.0

Libtool probably should have warned it was discarding an important
f**k'ing option instead of trying to sneak it by. Silent failures
waste everyone's time and make my blood boil.

Also see https://github.com/noloader/cryptopp-autotools/commit/61828068c6ab.

Jeff
Thomas Jahns
2017-11-09 09:37:28 UTC
Permalink
Post by Jeffrey Walton
Post by Jeffrey Walton
Post by Jeffrey Walton
$ ./cryptestcwd v
/export/home/cryptopp/.libs/libcryptopp.so.6: hardware capability
(CA_SUNW_HW_1) unsupported: 0x4800000 [ AES SSE4.1 ]
Killed
Any thoughts on this issue?
I gave up trying to have Automake use the flag. When I finally got it
applied using 'sed' on 'libtool', libtool choked on the option.
We ended up hijacking libtool's postlink_cmds (which was empty), and
inserting a script that used elfedit to insert the capabilities we
elfedit -e 'cap:hw1 0x1800' .libs/libcryptopp.so.6.0.0
Libtool probably should have warned it was discarding an important
f**k'ing option instead of trying to sneak it by. Silent failures
waste everyone's time and make my blood boil.
Also see https://github.com/noloader/cryptopp-autotools/commit/61828068c6ab.
Our[1] solution to the problem of libtool swallowing options is to escape known
problematic options with -Xlinker or -Xcompiler prior to emitting the Makfiles.
And since we run configure tests with libtool already active, that happens
relatively early. We have more problems with Fortran compilers, so that's
reflected in the corresponding macro _ACX_LT_FORT_FLAGS_MANGLE in
m4/acx_use_libtool_configuration.m4 but the idea equally applies to C/C++
compiler options.

Regards, Thomas

[1] https://www.dkrz.de/redmine/projects/scales-ppm

Jeffrey Walton
2017-11-08 22:15:52 UTC
Permalink
Post by Jeffrey Walton
$ ./cryptestcwd v
/export/home/cryptopp/.libs/libcryptopp.so.6: hardware capability
(CA_SUNW_HW_1) unsupported: 0x4800000 [ AES SSE4.1 ]
Killed
If I am parsing things correctly, it looks like AM_LDFLAGS is not
being applied to the one object I am most interested in...

...
am_libcryptopp_la_OBJECTS = adhoc.lo
libcryptopp_la_OBJECTS = $(am_libcryptopp_la_OBJECTS)
libcryptopp_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(libcryptopp_la_LDFLAGS) $(LDFLAGS) -o $@
libgcm_simd_la_LIBADD =
am_libgcm_simd_la_OBJECTS = libgcm_simd_la-gcm-simd.lo
libgcm_simd_la_OBJECTS = $(am_libgcm_simd_la_OBJECTS)
libgcm_simd_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) \
$(libgcm_simd_la_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
...

am_libcryptopp_la_OBJECTS is the phone C++ source file to force
Automake in =to C++ mode.

AM_LDFLAGS is on other objects, but its not on libcryptopp_la_LINK.

libcryptopp_la_LDFLAGS includes AM_LDFLAGS
(https://github.com/noloader/cryptopp-autotools/blob/master/Makefile.am#L108):

libcryptopp_la_LDFLAGS = $(AM_LDFLAGS) -version-info 6:0:0

I'm not really sure how to proceed at this point. Maybe I need to
patch it with sed after `configure.ac` runs?

Jeff
Loading...