Description
Building PHP 8.2.11 on ARM (32-bit) using mold 2.2.0 as linker fails with following errors (shortened for readability):
/bin/sh /home/users/builder/rpm/BUILD/php-8.2.11/libtool --silent --preserve-dup-deps --tag CC --mode=link /usr/libexec/icecc/bin/g++ -shared ... -o ext/intl/intl.la ... -Wl,-fuse-ld=mold ...
mold: error: ext/intl/msgformat/.libs/msgformat_helpers.o:(.ARM.extab): R_ARM_PREL31 relocation at offset 0x0 against symbol `__gxx_personality_v0' can not be used; recompile with -fPIC
mold: error: ext/intl/msgformat/.libs/msgformat_helpers.o:(.ARM.extab): R_ARM_PREL31 relocation at offset 0x28 against symbol `__gxx_personality_v0' can not be used; recompile with -fPIC
mold: error: ext/intl/msgformat/.libs/msgformat_helpers.o:(.ARM.extab.text._ZNSt6vectorIN6icu_7311FormattableESaIS1_EE17_M_default_appendEj): R_ARM_PREL31 relocation at offset 0x0 against sym
bol `__gxx_personality_v0' can not be used; recompile with -fPIC
mold: error: ext/intl/breakiterator/.libs/codepointiterator_internal.o:(.ARM.extab): R_ARM_PREL31 relocation at offset 0xc against symbol `__gxx_personality_v0' can not be used; recompile wit
h -fPIC
...
How it works with binutils is not clear to me, however the reason why it fails with mold is somewhat hidden by the use of --silent flag passed to libtool. If it's dropped then that's the exact command being run by libtool:
/bin/sh /home/users/builder/rpm/BUILD/php-8.2.11/libtool --preserve-dup-deps --tag CC --mode=link /usr/libexec/icecc/bin/g++ ...
libtool: link: /usr/libexec/icecc/bin/gcc -shared -fPIC -DPIC ...
Even though C++ compiler was passed to libtool invocation, C compiler was used for linking in the end. For linking libtool prefers compiler set with --tag:
# Commands used to build a shared archive.
archive_cmds="\$CC -shared \$pic_flag \$compiler_flags \$libobjs \$deplibs \$wl-soname \$wl\$soname -o \$lib"
$CC evaluates to compiler determined during configure time and follows settings for current --tag so either C compiler for --tag=CC or C++ compiler for --tag=CXX. Unfortunately PHP is using single global --tag setting:
|
PHP_SET_LIBTOOL_VARIABLE([--tag CC]) |
Since all compile/link commands already have logic for using either C or C++ compiler in libtool invocation I think it would be reasonable to drop global --tag parameter and shift it to individual libtool invocations so it matches with expected compiler.
PHP Version
PHP 8.2.11
Operating System
PLD Linux
Description
Building
PHP 8.2.11onARM (32-bit)usingmold 2.2.0as linker fails with following errors (shortened for readability):How it works with
binutilsis not clear to me, however the reason why it fails withmoldis somewhat hidden by the use of--silentflag passed tolibtool. If it's dropped then that's the exact command being run bylibtool:Even though C++ compiler was passed to
libtoolinvocation, C compiler was used for linking in the end. For linkinglibtoolprefers compiler set with--tag:$CCevaluates to compiler determined duringconfiguretime and follows settings for current--tagso either C compiler for--tag=CCor C++ compiler for--tag=CXX. UnfortunatelyPHPis using single global--tagsetting:php-src/configure.ac
Line 1575 in bdc87b0
Since all compile/link commands already have logic for using either C or C++ compiler in
libtoolinvocation I think it would be reasonable to drop global--tagparameter and shift it to individuallibtoolinvocations so it matches with expected compiler.PHP Version
PHP 8.2.11
Operating System
PLD Linux