From 200f9491aa76ed7339f3beddababc274f671e026 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Thu, 10 May 2018 09:56:20 -0400 Subject: [PATCH] Include upstream v8 fix for ppc64[le] Disable debug build on ppc64[le] and s390x Signed-off-by: Stephen Gallagher --- ...-relative-address-to-init-constpool-.patch | 128 ++++++++++++++++++ nodejs.spec | 16 ++- 2 files changed, 143 insertions(+), 1 deletion(-) create mode 100644 0003-PATCH-PPC-use-pc-relative-address-to-init-constpool-.patch diff --git a/0003-PATCH-PPC-use-pc-relative-address-to-init-constpool-.patch b/0003-PATCH-PPC-use-pc-relative-address-to-init-constpool-.patch new file mode 100644 index 0000000..f3b8125 --- /dev/null +++ b/0003-PATCH-PPC-use-pc-relative-address-to-init-constpool-.patch @@ -0,0 +1,128 @@ +From a0048de40ceb91e0bf7b0ffd6eb5054c41b3a4a6 Mon Sep 17 00:00:00 2001 +From: Junliang Yan +Date: Wed, 9 May 2018 18:39:49 -0400 +Subject: [PATCH 3/3] [PATCH] PPC: use pc-relative address to init constpool + reg + +R=joransiu@ca.ibm.com + +Change-Id: I67364f29d494b09786a14b13743f73bef4b64582 +Reviewed-on: https://chromium-review.googlesource.com/950242 +Commit-Queue: Junliang Yan +Reviewed-by: Joran Siu +Cr-Commit-Position: refs/heads/master@{#51750} + +Signed-off-by: Stephen Gallagher +--- + deps/v8/src/ppc/macro-assembler-ppc.cc | 14 ++++++++++---- + deps/v8/src/ppc/macro-assembler-ppc.h | 9 +++++---- + 2 files changed, 15 insertions(+), 8 deletions(-) + +diff --git a/deps/v8/src/ppc/macro-assembler-ppc.cc b/deps/v8/src/ppc/macro-assembler-ppc.cc +index 68efa84c72c7f6d781d508183b53ea83024944d1..3192e9cefb1c1b116c5e12b5c52e7971b92a111a 100644 +--- a/deps/v8/src/ppc/macro-assembler-ppc.cc ++++ b/deps/v8/src/ppc/macro-assembler-ppc.cc +@@ -166,11 +166,11 @@ void TurboAssembler::Call(Register target) { + + DCHECK_EQ(CallSize(target), SizeOfCodeGeneratedSince(&start)); + } + + void MacroAssembler::CallJSEntry(Register target) { +- DCHECK(target == ip); ++ CHECK(target == r5); + Call(target); + } + + int TurboAssembler::CallSize(Address target, RelocInfo::Mode rmode, + Condition cond) { +@@ -823,20 +823,27 @@ void TurboAssembler::ShiftRightAlgPair(Register dst_low, Register dst_high, + srawi(dst_high, src_high, shift); + } + } + #endif + +-void MacroAssembler::LoadConstantPoolPointerRegisterFromCodeTargetAddress( ++void TurboAssembler::LoadConstantPoolPointerRegisterFromCodeTargetAddress( + Register code_target_address) { + lwz(kConstantPoolRegister, + MemOperand(code_target_address, + Code::kConstantPoolOffset - Code::kHeaderSize)); + add(kConstantPoolRegister, kConstantPoolRegister, code_target_address); + } + ++void TurboAssembler::LoadPC(Register dst) { ++ b(4, SetLK); ++ mflr(dst); ++} ++ + void TurboAssembler::LoadConstantPoolPointerRegister() { +- mov_label_addr(kConstantPoolRegister, ConstantPoolPosition()); ++ LoadPC(kConstantPoolRegister); ++ add_label_offset(kConstantPoolRegister, kConstantPoolRegister, ++ ConstantPoolPosition(), -pc_offset() + 4); + } + + void TurboAssembler::StubPrologue(StackFrame::Type type) { + { + ConstantPoolUnavailableScope constant_pool_unavailable(this); +@@ -848,11 +855,10 @@ void TurboAssembler::StubPrologue(StackFrame::Type type) { + set_constant_pool_available(true); + } + } + + void TurboAssembler::Prologue() { +- DCHECK(base != no_reg); + PushStandardFrame(r4); + if (FLAG_enable_embedded_constant_pool) { + // base contains prologue address + LoadConstantPoolPointerRegister(); + set_constant_pool_available(true); +diff --git a/deps/v8/src/ppc/macro-assembler-ppc.h b/deps/v8/src/ppc/macro-assembler-ppc.h +index f4d9afd47f150f9cd2e840c20a61e965a5d8f5f5..32e6219c41bbbfe8427e05f2f9a02ff800efcffb 100644 +--- a/deps/v8/src/ppc/macro-assembler-ppc.h ++++ b/deps/v8/src/ppc/macro-assembler-ppc.h +@@ -214,10 +214,11 @@ class TurboAssembler : public Assembler { + + void LoadSingle(DoubleRegister dst, const MemOperand& mem, + Register scratch = no_reg); + void LoadSingleU(DoubleRegister dst, const MemOperand& mem, + Register scratch = no_reg); ++ void LoadPC(Register dst); + + void StoreDouble(DoubleRegister src, const MemOperand& mem, + Register scratch = no_reg); + void StoreDoubleU(DoubleRegister src, const MemOperand& mem, + Register scratch = no_reg); +@@ -639,10 +640,14 @@ class TurboAssembler : public Assembler { + + // Call a code stub. + void CallStubDelayed(CodeStub* stub); + + void LoadConstantPoolPointerRegister(); ++ ++ // Loads the constant pool pointer (kConstantPoolRegister). ++ void LoadConstantPoolPointerRegisterFromCodeTargetAddress( ++ Register code_target_address); + void AbortConstantPoolBuilding() { + #ifdef DEBUG + // Avoid DCHECK(!is_linked()) failure in ~Label() + bind(ConstantPoolPosition()); + #endif +@@ -733,14 +738,10 @@ class MacroAssembler : public TurboAssembler { + // Push and pop the registers that can hold pointers, as defined by the + // RegList constant kSafepointSavedRegisters. + void PushSafepointRegisters(); + void PopSafepointRegisters(); + +- // Loads the constant pool pointer (kConstantPoolRegister). +- void LoadConstantPoolPointerRegisterFromCodeTargetAddress( +- Register code_target_address); +- + // Flush the I-cache from asm code. You should use CpuFeatures::FlushICache + // from C. + // Does not handle errors. + void FlushICache(Register address, size_t size, Register scratch); + +-- +2.17.0 + diff --git a/nodejs.spec b/nodejs.spec index 28b00be..2924b31 100644 --- a/nodejs.spec +++ b/nodejs.spec @@ -1,5 +1,11 @@ %global with_debug 1 +# PowerPC and s390x segfault during Debug builds +# https://github.com/nodejs/node/issues/20642 +%ifarch %{ppc} s390x +%global with_debug 0 +%endif + # bundle dependencies that are not available as Fedora modules # %%{!?_with_bootstrap: %%global bootstrap 1} # use bcond for building modules @@ -18,7 +24,7 @@ %global nodejs_patch 0 %global nodejs_abi %{nodejs_major}.%{nodejs_minor} %global nodejs_version %{nodejs_major}.%{nodejs_minor}.%{nodejs_patch} -%global nodejs_release 1 +%global nodejs_release 2 # == Bundled Dependency Versions == # v8 - from deps/v8/include/v8-version.h @@ -115,6 +121,9 @@ Patch1: 0001-Disable-running-gyp-files-for-bundled-deps.patch # This does bad things on an RPM-managed npm. Patch3: no-npm-update-msg.patch +# Fix PowerPC builds +Patch4: 0003-PATCH-PPC-use-pc-relative-address-to-init-constpool-.patch + BuildRequires: python2-devel BuildRequires: zlib-devel BuildRequires: gcc >= 4.9.4 @@ -265,6 +274,7 @@ rm -rf deps/zlib %patch3 -p1 +%patch4 -p1 %build # build with debugging symbols and add defines from libuv (#892601) @@ -476,6 +486,10 @@ NODE_PATH=%{buildroot}%{_prefix}/lib/node_modules:%{buildroot}%{_prefix}/lib/nod %{_pkgdocdir}/npm/doc %changelog +* Thu May 10 2018 Stephen Gallagher - 1:10.1.0-2 +- Include upstream v8 fix for ppc64[le] +- Disable debug build on ppc64[le] and s390x + * Wed May 09 2018 Stephen Gallagher - 1:10.1.0-1 - Update to 10.1.0 - https://nodejs.org/en/blog/release/v10.1.0/