Fix parameter passing on ppc64le (mozb#1690152)

This commit is contained in:
Dan Horák 2021-02-03 12:07:56 +01:00
parent 634d3e1ea3
commit 2fe076f06f
2 changed files with 103 additions and 1 deletions

View File

@ -174,7 +174,7 @@ ExcludeArch: armv7hl
Summary: Mozilla Firefox Web browser
Name: firefox
Version: 85.0
Release: 10%{?pre_tag}%{?dist}
Release: 11%{?pre_tag}%{?dist}
URL: https://www.mozilla.org/firefox/
License: MPLv1.1 or GPLv2+ or LGPLv2+
Source0: https://archive.mozilla.org/pub/firefox/releases/%{version}%{?pre_version}/source/firefox-%{version}%{?pre_version}.source.tar.xz
@ -255,6 +255,7 @@ Patch427: mozilla-1678247.patch
Patch428: mozilla-1679933.patch
Patch429: mozilla-1631061-1.patch
Patch430: mozilla-1631061-2.patch
Patch431: mozilla-1690152.patch
# PGO/LTO patches
Patch600: pgo.patch
@ -469,6 +470,7 @@ This package contains results of tests executed during build.
%patch428 -p1 -b .1679933
%patch429 -p1 -b .1631061
%patch430 -p1 -b .1631061
%patch431 -p1 -b .1690152
# PGO patches
%if %{build_with_pgo}
@ -1044,6 +1046,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
#---------------------------------------------------------------------
%changelog
* Wed Feb 03 2021 Dan Horák <dan[at]danny.cz> - 85.0-11
- Fix parameter passing on ppc64le (mozb#1690152)
* Tue Feb 02 2021 Kalev Lember <klember@redhat.com> - 85.0-10
- Remove gtk2 support as flash plugin is no longer supported

97
mozilla-1690152.patch Normal file
View File

@ -0,0 +1,97 @@
# HG changeset patch
# User Cameron Kaiser <spectre@floodgap.com>
# Date 1612231460 0
# Node ID 579a66fd796690fb752485215b2edaa6167ebf16
# Parent a00504e040bfd34d01c74d478beb9d308ec085be
Bug 1690152 - on ppc64 properly skip parameter slots if we overflow GPRs while still having FPRs to burn. r=tcampbell
Differential Revision: https://phabricator.services.mozilla.com/D103724
diff --git a/xpcom/reflect/xptcall/md/unix/xptcinvoke_ppc64_linux.cpp b/xpcom/reflect/xptcall/md/unix/xptcinvoke_ppc64_linux.cpp
--- a/xpcom/reflect/xptcall/md/unix/xptcinvoke_ppc64_linux.cpp
+++ b/xpcom/reflect/xptcall/md/unix/xptcinvoke_ppc64_linux.cpp
@@ -86,27 +86,37 @@ extern "C" void invoke_copy_to_stack(uin
case nsXPTType::T_WCHAR: value = s->val.wc; break;
default: value = (uint64_t) s->val.p; break;
}
}
if (!s->IsIndirect() && s->type == nsXPTType::T_DOUBLE) {
if (nr_fpr < FPR_COUNT) {
fpregs[nr_fpr++] = s->val.d;
- nr_gpr++;
+ // Even if we have enough FPRs, still skip space in
+ // the parameter area if we ran out of placeholder GPRs.
+ if (nr_gpr < GPR_COUNT) {
+ nr_gpr++;
+ } else {
+ d++;
+ }
} else {
*((double *)d) = s->val.d;
d++;
}
}
else if (!s->IsIndirect() && s->type == nsXPTType::T_FLOAT) {
if (nr_fpr < FPR_COUNT) {
// Single-precision floats are passed in FPRs too.
fpregs[nr_fpr++] = s->val.f;
- nr_gpr++;
+ if (nr_gpr < GPR_COUNT) {
+ nr_gpr++;
+ } else {
+ d++;
+ }
} else {
#ifdef __LITTLE_ENDIAN__
*((float *)d) = s->val.f;
#else
// Big endian needs adjustment to point to the least
// significant word.
float* p = (float*)d;
p++;
diff --git a/xpcom/reflect/xptcall/md/unix/xptcstubs_ppc64_linux.cpp b/xpcom/reflect/xptcall/md/unix/xptcstubs_ppc64_linux.cpp
--- a/xpcom/reflect/xptcall/md/unix/xptcstubs_ppc64_linux.cpp
+++ b/xpcom/reflect/xptcall/md/unix/xptcstubs_ppc64_linux.cpp
@@ -98,27 +98,37 @@ PrepareAndDispatch(nsXPTCStubBase * self
nr_gpr++;
else
ap++;
}
if (!param.IsOut() && type == nsXPTType::T_DOUBLE) {
if (nr_fpr < FPR_COUNT) {
dp->val.d = fpregs[nr_fpr++];
- nr_gpr++;
+ // Even if we have enough FPRs, still skip space in
+ // the parameter area if we ran out of placeholder GPRs.
+ if (nr_gpr < GPR_COUNT) {
+ nr_gpr++;
+ } else {
+ ap++;
+ }
} else {
dp->val.d = *(double*)ap++;
}
continue;
}
if (!param.IsOut() && type == nsXPTType::T_FLOAT) {
if (nr_fpr < FPR_COUNT) {
// Single-precision floats are passed in FPRs too.
dp->val.f = (float)fpregs[nr_fpr++];
- nr_gpr++;
+ if (nr_gpr < GPR_COUNT) {
+ nr_gpr++;
+ } else {
+ ap++;
+ }
} else {
#ifdef __LITTLE_ENDIAN__
dp->val.f = *(float*)ap++;
#else
// Big endian needs adjustment to point to the least
// significant word.
float* p = (float*)ap;
p++;