Page 1 of 1

PPC64: Compilation stops because of missing "-maltivec" and VSX instructions

Posted: 2020-04-05, 21:12
by rpxrpx
Compiling Palemoon 28.9.0.2 on PPC64 reveals 2 problems that I did not
encounter when compiling 28.3.0 to 28.8.4.

Problem 1

The file

Pale-Moon/platform/security/nss/lib/freebl/altivec-types.h

defines two "long long" types that are not availabe on all PCC64 CPUs
and need the gcc command line option "-mvsx".

They belong to the VSX instructions introduced with the POWER7 CPU
(https://de.wikipedia.org/wiki/AltiVec).

The code lines are:

Code: Select all

typedef __vector unsigned long long vec_u64;
typedef __vector signed long long vec_s64;
I simply commented them out and compiled Palemoon successfully.
However it may be better to provide them if gcc is started with "-mvsx".

Looking at
/usr/lib/gcc/powerpc64-linux-gnu/7/include/altivec.h
I suggest encapsulating them like this:

Code: Select all

#ifdef __VSX__
/* VSX - Power ISA v.2.06 - POWER7 CPU and later */
typedef __vector unsigned long long vec_u64;
typedef __vector signed long long vec_s64;
#endif
For compability: The clang compiler also supports "-mvsx".

Problem 2

My .mozconfig contains this line:

ac_add_options --enable-optimize="-O2 -maltivec"

as suggested by: viewtopic.php?f=57&t=22905#p174684

Nevertheless the build stopped. gcc complained about using altivec code but not using "-maltivec".
I had to:
- change into the subdirectory Pale-Moon/platform/security/nss/lib/freebl
- and isse the following three commands which I enhanced with "-maltivec"

Code: Select all

/usr/bin/gcc -std=gnu99 -o /usr/src/ralf/pmbuild_28.9.0.2/security/nss/lib/freebl/gcm.o -c -std=c99 -O2 -gdwarf-2 -fPIC  -m64 -pipe -ffunction-sections -fdata-sections -DHAVE_STRERROR -DLINUX -Dlinux -Wall -Wshadow -DNSS_NO_GCC48 -DXP_UNIX -DSHLIB_SUFFIX=\"so\" -DSHLIB_PREFIX=\"lib\" -DSHLIB_VERSION=\"3\" -DSOFTOKEN_SHLIB_VERSION=\"3\" -DRIJNDAEL_INCLUDE_TABLES -UDEBUG -DNDEBUG -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_SOURCE -D_REENTRANT -DNSS_NO_INIT_SUPPORT -DUSE_UTIL_DIRECTLY -DNO_NSPR_10_SUPPORT -DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES -DNSS_USE_64 -DFREEBL_LOWHASH -DNSS_NO_INIT_SUPPORT -DHAVE_INT128_SUPPORT -DMP_API_COMPATIBLE -I/usr/src/ralf/pmbuild_28.9.0.2/dist/include/nspr -I/usr/src/ralf/pmbuild_28.9.0.2/dist/include/nspr -I/usr/src/ralf/pmbuild_28.9.0.2/dist/include/nss -I/usr/src/ralf/pmbuild_28.9.0.2/dist/private/nss -Impi -Iecl -Iverified -DNSS_ENABLE_TLS13_SHORT_HEADERS gcm.c -maltivec

/usr/bin/gcc -std=gnu99 -o /usr/src/ralf/pmbuild_28.9.0.2/security/nss/lib/freebl/hmacct.o -c -std=c99 -O2 -gdwarf-2 -fPIC  -m64 -pipe -ffunction-sections -fdata-sections -DHAVE_STRERROR -DLINUX -Dlinux -Wall -Wshadow -DNSS_NO_GCC48 -DXP_UNIX -DSHLIB_SUFFIX=\"so\" -DSHLIB_PREFIX=\"lib\" -DSHLIB_VERSION=\"3\" -DSOFTOKEN_SHLIB_VERSION=\"3\" -DRIJNDAEL_INCLUDE_TABLES -UDEBUG -DNDEBUG -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_SOURCE -D_REENTRANT -DNSS_NO_INIT_SUPPORT -DUSE_UTIL_DIRECTLY -DNO_NSPR_10_SUPPORT -DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES -DNSS_USE_64 -DFREEBL_LOWHASH -DNSS_NO_INIT_SUPPORT -DHAVE_INT128_SUPPORT -DMP_API_COMPATIBLE -I/usr/src/ralf/pmbuild_28.9.0.2/dist/include/nspr -I/usr/src/ralf/pmbuild_28.9.0.2/dist/include/nspr -I/usr/src/ralf/pmbuild_28.9.0.2/dist/include/nss -I/usr/src/ralf/pmbuild_28.9.0.2/dist/private/nss -Impi -Iecl -Iverified -DNSS_ENABLE_TLS13_SHORT_HEADERS hmacct.c -maltivec

/usr/bin/gcc -std=gnu99 -o /usr/src/ralf/pmbuild_28.9.0.2/security/nss/lib/freebl/rijndael.o -c -std=c99 -O2 -gdwarf-2 -fPIC  -m64 -pipe -ffunction-sections -fdata-sections -DHAVE_STRERROR -DLINUX -Dlinux -Wall -Wshadow -DNSS_NO_GCC48 -DXP_UNIX -DSHLIB_SUFFIX=\"so\" -DSHLIB_PREFIX=\"lib\" -DSHLIB_VERSION=\"3\" -DSOFTOKEN_SHLIB_VERSION=\"3\" -DRIJNDAEL_INCLUDE_TABLES -UDEBUG -DNDEBUG -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_SOURCE -D_REENTRANT -DNSS_NO_INIT_SUPPORT -DUSE_UTIL_DIRECTLY -DNO_NSPR_10_SUPPORT -DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES -DNSS_USE_64 -DFREEBL_LOWHASH -DNSS_NO_INIT_SUPPORT -DHAVE_INT128_SUPPORT -DMP_API_COMPATIBLE -I/usr/src/ralf/pmbuild_28.9.0.2/dist/include/nspr -I/usr/src/ralf/pmbuild_28.9.0.2/dist/include/nspr -I/usr/src/ralf/pmbuild_28.9.0.2/dist/include/nss -I/usr/src/ralf/pmbuild_28.9.0.2/dist/private/nss -Impi -Iecl -Iverified -DNSS_ENABLE_TLS13_SHORT_HEADERS rijndael.c -maltivec
After these 3 object files were created I continued with "make -f
client.mk" or "mach build" (I don't remember) and the compilation
finished.

Note: I needed several hours to find this out but I remember that I have seen a file or a Makefile (?) with a one line comment about problems passing down options from mozconfig and that it shoud be investigated further. But even after a lot of "grep"-commands I can not find this file again.

Thank you for reading this.
Thank you for providing Palemoon and UXP.

Re: PPC64: Compilation stops because of missing "-maltivec" and VSX instructions

Posted: 2020-04-05, 21:15
by Admin
This would be something to report on https://bugzilla.mozilla.org because this is part of NSS which is maintained by Mozilla.

Re: PPC64: Compilation stops because of missing "-maltivec" and VSX instructions

Posted: 2020-04-12, 21:27
by rpxrpx
Thank you for the hint.

I posted the problem with the VMX/VSX instructions to https://bugzilla.mozilla.org/show_bug.cgi?id=1629414



I am not sure about the other problem. The problem is that

Code: Select all

ac_add_options --enable-optimize="-O2 -maltivec"
in ".mozconfig" is not passed down to "platform -> security -> nss". I can't complain at mozilla about this, can I?

Thank you.