[Bug 277021] www/firefox: error on start after updating to 123.0 (rc1, rc2)

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 17 Feb 2024 04:51:17 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=277021

--- Comment #63 from Tatsuki Makino <tatsuki_makino@hotmail.com> ---
(In reply to Ale from comment #62)

A change here could be used as one of the workarounds, but it is not a
fundamental solution.
Because the presence or absence of -march changes whether
/usr/local/lib/firefox/firefox is linked to libm or not.

For example, write code that uses sin.
The -O optimization hardcodes the computed result :) so...

int main(int argc, char * argv[]) { double d; d = sin(atof(argv[1]));
printf("%f\n", d); return 0; }

When this is linked by clang, the -lm specification is mandatory.
When this is linked by clang++, libm is automatically linked.

Let's look at the results of the following command.

clang++15 -E -x c -std=gnu17 -dM /dev/null
clang++15 -E -x c -std=gnu17 -march=haswell -dM /dev/null

These make a difference. The answer is the following.
+#define __AVX2__ 1
+#define __AVX__ 1
+#define __BMI2__ 1
+#define __BMI__ 1
+#define __CRC32__ 1
+#define __F16C__ 1
+#define __FMA__ 1
+#define __FSGSBASE__ 1
+#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 1
+#define __INVPCID__ 1
+#define __LAHF_SAHF__ 1
+#define __LZCNT__ 1
+#define __MOVBE__ 1
+#define __PCLMUL__ 1
+#define __POPCNT__ 1
+#define __RDRND__ 1
+#define __SSE3__ 1
+#define __SSE4_1__ 1
+#define __SSE4_2__ 1
+#define __SSSE3__ 1
+#define __XSAVEOPT__ 1
+#define __XSAVE__ 1
-#define __k8 1
-#define __k8__ 1
+#define __corei7 1
+#define __corei7__ 1
-#define __tune_k8__ 1
+#define __tune_corei7__ 1

The code that switches something by this is around
firefox-123.0/mozglue/misc/SSE.h 。
This may have prevented haswell from using functions that would have required
libm.
This may be why they don't link libm with firefox binary.

In other words, a change to link libm to some binary that cannot avoid using
libm sin would be a good solution.
So much for what I have researched :)

-- 
You are receiving this mail because:
You are the assignee for the bug.