From c9f9d6a6cc05a769a214fda0d3754fa8b65e41dd Mon Sep 17 00:00:00 2001
From: Tom Callaway <spot(a)fedoraproject.org>
Date: Tue, 28 Feb 2017 16:17:12 -0500
Subject: fix ftbfs (thanks to Ben Noordhuis)
---
v8-5.2.258-gcc7.patch | 119 ++++++++++++++++++++++++++++++++++++++++++++++++++
v8.spec | 9 +++-
2 files changed, 127 insertions(+), 1 deletion(-)
create mode 100644 v8-5.2.258-gcc7.patch
diff --git a/v8-5.2.258-gcc7.patch b/v8-5.2.258-gcc7.patch
new file mode 100644
index 0000000..162a9c4
--- /dev/null
+++ b/v8-5.2.258-gcc7.patch
@@ -0,0 +1,119 @@
+diff -up v8-5.2.258/samples/shell.cc.gcc7 v8-5.2.258/samples/shell.cc
+--- v8-5.2.258/samples/shell.cc.gcc7 2017-02-28 15:33:38.931424708 -0500
++++ v8-5.2.258/samples/shell.cc 2017-02-28 15:34:00.759853299 -0500
+@@ -361,6 +361,8 @@ bool ExecuteString(v8::Isolate* isolate,
+ } else {
+ v8::Local<v8::Value> result;
+ if (!script->Run(context).ToLocal(&result)) {
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wgnu"
+ assert(try_catch.HasCaught());
+ // Print errors that happened during execution.
+ if (report_exceptions)
+@@ -368,6 +370,7 @@ bool ExecuteString(v8::Isolate* isolate,
+ return false;
+ } else {
+ assert(!try_catch.HasCaught());
++#pragma GCC diagnostic pop
+ if (print_result && !result->IsUndefined()) {
+ // If all went well and the result wasn't undefined then print
+ // the returned value.
+diff -up v8-5.2.258/src/crankshaft/lithium.cc.gcc7 v8-5.2.258/src/crankshaft/lithium.cc
+--- v8-5.2.258/src/crankshaft/lithium.cc.gcc7 2016-05-09 10:28:43.000000000 -0400
++++ v8-5.2.258/src/crankshaft/lithium.cc 2017-02-28 14:42:17.188361709 -0500
+@@ -128,11 +128,6 @@ void LOperand::PrintTo(StringStream* str
+
+
+ template<LOperand::Kind kOperandKind, int kNumCachedOperands>
+-LSubKindOperand<kOperandKind, kNumCachedOperands>*
+-LSubKindOperand<kOperandKind, kNumCachedOperands>::cache = NULL;
+-
+-
+-template<LOperand::Kind kOperandKind, int kNumCachedOperands>
+ void LSubKindOperand<kOperandKind, kNumCachedOperands>::SetUpCache() {
+ if (cache) return;
+ cache = new LSubKindOperand[kNumCachedOperands];
+diff -up v8-5.2.258/src/crankshaft/lithium.h.gcc7 v8-5.2.258/src/crankshaft/lithium.h
+--- v8-5.2.258/src/crankshaft/lithium.h.gcc7 2016-05-09 10:28:43.000000000 -0400
++++ v8-5.2.258/src/crankshaft/lithium.h 2017-02-28 14:42:17.188361709 -0500
+@@ -338,6 +338,9 @@ class LSubKindOperand final : public LOp
+ explicit LSubKindOperand(int index) : LOperand(kOperandKind, index) { }
+ };
+
++template<LOperand::Kind kOperandKind, int kNumCachedOperands>
++LSubKindOperand<kOperandKind, kNumCachedOperands>*
++LSubKindOperand<kOperandKind, kNumCachedOperands>::cache = NULL;
+
+ #define LITHIUM_TYPEDEF_SUBKIND_OPERAND_CLASS(name, type, number) \
+ typedef LSubKindOperand<LOperand::type, number> L##name;
+diff -up v8-5.2.258/src/objects-body-descriptors.h.gcc7
v8-5.2.258/src/objects-body-descriptors.h
+--- v8-5.2.258/src/objects-body-descriptors.h.gcc7 2016-05-09 10:28:43.000000000 -0400
++++ v8-5.2.258/src/objects-body-descriptors.h 2017-02-28 14:42:17.189361685 -0500
+@@ -99,7 +99,7 @@ class FixedBodyDescriptor final : public
+
+ template <typename StaticVisitor>
+ static inline void IterateBody(HeapObject* obj, int object_size) {
+- IterateBody(obj);
++ IterateBody<StaticVisitor>(obj);
+ }
+ };
+
+diff -up v8-5.2.258/src/objects.h.gcc7 v8-5.2.258/src/objects.h
+--- v8-5.2.258/src/objects.h.gcc7 2016-05-09 10:28:43.000000000 -0400
++++ v8-5.2.258/src/objects.h 2017-02-28 14:42:17.190361661 -0500
+@@ -3182,22 +3182,10 @@ class HashTableBase : public FixedArray
+ template <typename Derived, typename Shape, typename Key>
+ class HashTable : public HashTableBase {
+ public:
+- // Wrapper methods
+- inline uint32_t Hash(Key key) {
+- if (Shape::UsesSeed) {
+- return Shape::SeededHash(key, GetHeap()->HashSeed());
+- } else {
+- return Shape::Hash(key);
+- }
+- }
+-
+- inline uint32_t HashForObject(Key key, Object* object) {
+- if (Shape::UsesSeed) {
+- return Shape::SeededHashForObject(key, GetHeap()->HashSeed(), object);
+- } else {
+- return Shape::HashForObject(key, object);
+- }
+- }
++ // Wrapper methods. Defined in src/objects-inl.h
++ // to break a cycle with src/heap/heap.h.
++ inline uint32_t Hash(Key key);
++ inline uint32_t HashForObject(Key key, Object* object);
+
+ // Returns a new HashTable object.
+ MUST_USE_RESULT static Handle<Derived> New(
+diff -up v8-5.2.258/src/objects-inl.h.gcc7 v8-5.2.258/src/objects-inl.h
+--- v8-5.2.258/src/objects-inl.h.gcc7 2016-05-09 10:28:43.000000000 -0400
++++ v8-5.2.258/src/objects-inl.h 2017-02-28 14:42:17.191361638 -0500
+@@ -35,6 +35,25 @@
+ namespace v8 {
+ namespace internal {
+
++template <typename Derived, typename Shape, typename Key>
++uint32_t HashTable<Derived, Shape, Key>::Hash(Key key) {
++ if (Shape::UsesSeed) {
++ return Shape::SeededHash(key, GetHeap()->HashSeed());
++ } else {
++ return Shape::Hash(key);
++ }
++}
++
++template <typename Derived, typename Shape, typename Key>
++uint32_t HashTable<Derived, Shape, Key>::HashForObject(Key key,
++ Object* object) {
++ if (Shape::UsesSeed) {
++ return Shape::SeededHashForObject(key, GetHeap()->HashSeed(), object);
++ } else {
++ return Shape::HashForObject(key, object);
++ }
++}
++
+ PropertyDetails::PropertyDetails(Smi* smi) {
+ value_ = smi->value();
+ }
diff --git a/v8.spec b/v8.spec
index 4bbc28a..f1b35df 100644
--- a/v8.spec
+++ b/v8.spec
@@ -1,5 +1,6 @@
# clang doesn't understand hardening, specifically "-specs="
%global clang_optflags %(echo %{optflags} | sed
's|-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1||g')
+%global clang_ldflags %(echo "%{__global_ldflags} -Wl,--build-id" | sed
's|-specs=/usr/lib/rpm/redhat/redhat-hardened-ld||g')
# Hi Googlers! If you're looking in here for patches, nifty.
# You (and everyone else) are welcome to use any of my Chromium spec files and
@@ -24,7 +25,7 @@
Name: v8
Version: %{somajor}.%{sominor}.%{sobuild}
-Release: 9%{?dist}
+Release: 10%{?dist}
Epoch: 1
Summary: JavaScript Engine
Group: System Environment/Libraries
@@ -46,6 +47,7 @@ Source0: v8-5.2.258.tar.xz
Patch0: v8-4.10.91-system_icu.patch
Patch1: v8-5.2.197-readdir-fix.patch
Patch2: v8-5.2.258-bundled-binutils.patch
+Patch3: v8-5.2.258-gcc7.patch
# arm is excluded because of bz1334406
ExclusiveArch: %{ix86} x86_64 ppc ppc64 aarch64 %{mips} s390 s390x
BuildRequires: readline-devel, libicu-devel
@@ -77,6 +79,7 @@ Python libraries from v8.
%patch0 -p1 -b .system_icu
%patch1 -p1 -b .readdir
%patch2 -p1 -b .bb
+%patch3 -p1 -b .gcc7
# Use system header ... except it doesn't work.
# rm -rf src/third_party/valgrind/valgrind.h
@@ -161,6 +164,7 @@ CC=%{_bindir}/clang \
CXX=%{_bindir}/clang++ \
CFLAGS="%{clang_optflags}" \
CXXFLAGS="%{clang_optflags}" \
+LDFLAGS="%{clang_ldflags}" \
V=1
%install
@@ -225,6 +229,9 @@ chmod -R -x %{buildroot}%{python_sitelib}/*.py*
%{python_sitelib}/j*.py*
%changelog
+* Tue Feb 28 2017 Tom Callaway <spot(a)fedoraproject.org> - 1:5.2.258-10
+- fix ftbfs (thanks to Ben Noordhuis)
+
* Sat Feb 11 2017 Fedora Release Engineering <releng(a)fedoraproject.org> -
1:5.2.258-9
- Rebuilt for
https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
--
cgit v1.1
https://src.fedoraproject.org/cgit/v8.git/commit/?h=master&id=c9f9d6a...