View | Details | Raw Unified | Return to bug 213202 | Differences between
and this patch

Collapse All | Expand All

(-)lang/v8/Makefile (-45 / +103 lines)
Lines 1-67 Link Here
1
# Created by: siasia
2
# $FreeBSD$
1
# $FreeBSD$
3
2
4
PORTNAME=	v8
3
PORTNAME=	v8
5
PORTVERSION=	3.18.5
4
DISTVERSION=	8.5.145
6
PORTREVISION=	8
7
CATEGORIES=	lang
5
CATEGORIES=	lang
8
MASTER_SITES=	LOCAL/vanilla
6
MASTER_SITES=	http://mikael.urankar.free.fr/FreeBSD/v8/:build \
7
		http://mikael.urankar.free.fr/FreeBSD/v8/:buildtools \
8
		http://mikael.urankar.free.fr/FreeBSD/v8/:clang \
9
		http://mikael.urankar.free.fr/FreeBSD/v8/:common \
10
		http://mikael.urankar.free.fr/FreeBSD/v8/:gmock \
11
		http://mikael.urankar.free.fr/FreeBSD/v8/:icu \
12
		http://mikael.urankar.free.fr/FreeBSD/v8/:perfetto \
13
		http://mikael.urankar.free.fr/FreeBSD/v8/:zlib
14
# # XXX sha256 changes everytime you download the archive
15
#MASTER_SITES=	https://chromium.googlesource.com/chromium/src/build.git/+archive/:build \
16
#		https://chromium.googlesource.com/chromium/src/buildtools.git/+archive/:buildtools \
17
#		https://chromium.googlesource.com/chromium/src/tools/clang.git/+archive/:clang \
18
#		https://chromium.googlesource.com/chromium/src/base/trace_event/common.git/+archive/:common \
19
#		https://chromium.googlesource.com/external/github.com/google/googletest.git/+archive/:gmock \
20
#		https://chromium.googlesource.com/chromium/deps/icu.git/+archive/:icu \
21
#		https://android.googlesource.com/platform/external/perfetto.git/+archive/:perfetto \
22
#		https://chromium.googlesource.com/chromium/src/third_party/zlib.git/+archive/:zlib
23
DISTFILES=	build-${BUILD_REV}.tar.gz:build \
24
		buildtools-${BUILDTOOLS_REV}.tar.gz:buildtools \
25
		clang-${CLANG_REV}.tar.gz:clang \
26
		common-${COMMON_REV}.tar.gz:common \
27
		gmock-${GMOCK_REV}.tar.gz:gmock \
28
		icu-${ICU_REV}.tar.gz:icu \
29
		perfetto-${PERFETTO_REV}.tar.gz:perfetto \
30
		zlib-${ZLIB_REV}.tar.gz:zlib
31
EXTRACT_ONLY=	${DISTNAME}.tar.gz
9
32
10
MAINTAINER=	sunpoet@FreeBSD.org
33
MAINTAINER=	sunpoet@FreeBSD.org
11
COMMENT=	Open source JavaScript engine by Google
34
COMMENT=	Open source JavaScript engine by Google
12
35
13
LICENSE=	BSD3CLAUSE
36
LICENSE=	BSD3CLAUSE
37
LICENSE_FILE=	${WRKSRC}/LICENSE
14
38
15
CONFLICTS_INSTALL=	v8-devel-[0-9]*
39
# clang10+ is required, hardcoded in files/patch-build_toolchain_gcc__toolchain.gni
40
BUILD_DEPENDS=	binutils>0:devel/binutils \
41
		gn:devel/chromium-gn \
42
		glib>0:devel/glib20 \
43
		${PYTHON_PKGNAMEPREFIX}Jinja2>0:devel/py-Jinja2@${PY_FLAVOR} \
44
		llvm10>0:devel/llvm10
16
45
17
ONLY_FOR_ARCHS=	i386 amd64
46
USES=		pkgconfig ninja python:2.7,build tar:xz
47
USE_GITHUB=	yes
48
USE_LDCONFIG=	yes
18
49
19
PORTSCOUT=	limit:^3.18.*
50
# see ${WRKSRC}/DEPS
51
BUILD_REV=	8038ef2827d0bc23ac85450a91b0a2a413944a24
52
BUILDTOOLS_REV=	574cbd5df82c6ae48805b2aa8d75e0ef76aa15aa
53
CLANG_REV=	5e1d63a7e37e51596de0d3c01e239ff8919b5d6e
54
COMMON_REV=	ef3586804494b7e402b6c1791d5dccdf2971afff
55
GMOCK_REV=	4fe018038f87675c083d0cfb6a6b57c274fb1753
56
ICU_REV=	46f53dfc09c520b7c520a089ca473bb0ee29c07e
57
PERFETTO_REV=	ff70e0d273ed10995866c803f23e11250eb3dc52
58
ZLIB_REV=	a68151fd9b9f5ad11b96a3765f706361ff22dbc8
20
59
21
ALL_TARGET=	native
60
BUILDTYPE=	Release
22
MAKE_ARGS=	library=shared
23
MAKE_ENV=	CC.host=${CC} CXX.host=${CXX} LINK.host=${CXX} LINK.target=${CXX}
24
USE_LDCONFIG=	yes
25
USES=		alias compiler cpe gmake python:2.7 shebangfix tar:xz
26
61
27
CPE_VENDOR=	google
62
BINARY_ALIAS=	python=${PYTHON_CMD}
28
63
29
SHEBANG_FILES=	build/gyp/gyp
64
# Run "gn args out/RELEASE --list" for all variables.
65
# Some parts don't have use_system_* flag, and can be turned on/off by using
66
# replace_gn_files.py script, some parts just turned on/off for target host
67
# OS "target_os == is_bsd", like libusb, libpci.
68
GN_ARGS+=	clang_use_chrome_plugins=false \
69
		is_clang=true \
70
		treat_warnings_as_errors=false \
71
		use_aura=true \
72
		use_lld=true \
73
		extra_cxxflags="${CXXFLAGS}" \
74
		extra_ldflags="${LDFLAGS}"
30
75
31
.include <bsd.port.pre.mk>
76
MAKE_ARGS=	-C out/${BUILDTYPE}
32
77
33
.if ${COMPILER_TYPE} == clang
78
post-extract:
34
CXXFLAGS+=	-Wno-nested-anon-types -Wno-unused-function -Wno-unused-private-field
79
	${MKDIR} \
35
MAKE_ENV+=	LINK=clang++
80
		${WRKSRC}/base/trace_event/common \
36
.if ${COMPILER_VERSION} >= 34
81
		${WRKSRC}/build \
37
CXXFLAGS+=	-Wno-unused-const-variable
82
		${WRKSRC}/buildtools \
38
.if ${COMPILER_VERSION} >= 35
83
		${WRKSRC}/third_party/googletest/src \
39
CXXFLAGS+=	-Wno-tautological-undefined-compare
84
		${WRKSRC}/third_party/icu \
40
.if ${COMPILER_VERSION} >= 36
85
		${WRKSRC}/third_party/perfetto \
41
CXXFLAGS+=	-Wno-unused-local-typedef
86
		${WRKSRC}/third_party/zlib \
42
.if ${COMPILER_VERSION} >= 60
87
		${WRKSRC}/tools/clang
43
CXXFLAGS+=	-Wno-null-pointer-arithmetic -Wno-vexing-parse
88
	${TAR} -xf ${DISTDIR}/build-${BUILD_REV}.tar.gz  -C ${WRKSRC}/build
44
EXTRA_PATCHES+=	${PATCHDIR}/extra-patch-src-stub-cache.cc
89
	${TAR} -xf ${DISTDIR}/buildtools-${BUILDTOOLS_REV}.tar.gz  -C ${WRKSRC}/buildtools
45
.endif
90
	${TAR} -xf ${DISTDIR}/clang-${CLANG_REV}.tar.gz  -C ${WRKSRC}/tools/clang
46
.endif
91
	${TAR} -xf ${DISTDIR}/common-${COMMON_REV}.tar.gz  -C ${WRKSRC}/base/trace_event/common
47
.endif
92
	${TAR} -xf ${DISTDIR}/gmock-${GMOCK_REV}.tar.gz  -C ${WRKSRC}/third_party/googletest/src
48
.endif
93
	${TAR} -xf ${DISTDIR}/icu-${ICU_REV}.tar.gz -C ${WRKSRC}/third_party/icu
49
.else
94
	${TAR} -xf ${DISTDIR}/zlib-${ZLIB_REV}.tar.gz -C ${WRKSRC}/third_party/zlib
50
MAKE_ARGS+=	strictaliasing=off
51
USE_GCC=	any
52
.endif
53
95
54
post-patch:
96
post-patch:
55
	@${REINPLACE_CMD} -e 's|test/cctest/cctest.gyp||' ${WRKSRC}/Makefile
97
	${REINPLACE_CMD} "s|%%LOCALBASE%%|${LOCALBASE}|" \
56
	@${REINPLACE_CMD} -e '/test\/cctest\/cctest.gyp/d' ${WRKSRC}/build/all.gyp
98
		${WRKSRC}/build/toolchain/gcc_toolchain.gni
57
	@${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|' ${WRKSRC}/build/common.gypi ${WRKSRC}/tools/gyp/v8.gyp
99
do-configure:
58
	@${REINPLACE_CMD} -e 's, | MAP_NORESERVE,,' ${WRKSRC}/src/platform-freebsd.cc
100
	@${ECHO_CMD} 'is_clang=true' > ${WRKSRC}/build/args/release.gn
59
	@${REINPLACE_CMD} -e 's|python|${PYTHON_CMD}|' ${WRKSRC}/tools/gyp/v8.gyp
101
	@${ECHO_CMD} 'treat_warnings_as_errors=false' >> ${WRKSRC}/build/args/release.gn
102
	@${ECHO_CMD} 'use_custom_libcxx=false' >> ${WRKSRC}/build/args/release.gn
103
	@${ECHO_CMD} 'use_lld=true' >> ${WRKSRC}/build/args/release.gn
104
	@${ECHO_CMD} 'extra_cxxflags="-I${PREFIX}/include"' >> ${WRKSRC}/build/args/release.gn
105
	@${ECHO_CMD} 'extra_ldflags="-L${PREFIX}/lib"' >> ${WRKSRC}/build/args/release.gn
106
	cd ${WRKSRC} && ${SETENV} ${CONFIGURE_ENV} gn gen out/${BUILDTYPE} \
107
		--args='import("//build/args/release.gn") ${GN_ARGS}'
60
108
61
do-install:
109
do-install:
62
	${INSTALL_PROGRAM} ${WRKSRC}/out/native/d8 ${STAGEDIR}${PREFIX}/bin/d8
110
	${INSTALL_PROGRAM} ${WRKSRC}/out/${BUILDTYPE}/d8 ${STAGEDIR}${PREFIX}/bin/d8
63
	cd ${WRKSRC}/include/ && ${INSTALL_DATA} *.h ${STAGEDIR}${PREFIX}/include/
111
#	${INSTALL_PROGRAM} ${WRKSRC}/out/${BUILDTYPE}/d8 ${STAGEDIR}${PREFIX}/bin/cctest
64
	${INSTALL_LIB} ${WRKSRC}/out/native/lib.target/libv8.so ${STAGEDIR}${PREFIX}/lib/libv8.so.1
112
#	${INSTALL_PROGRAM} ${WRKSRC}/out/${BUILDTYPE}/mksnapshot ${STAGEDIR}${PREFIX}/bin/mksnapshot
65
	${LN} -fs ${PREFIX}/lib/libv8.so.1 ${STAGEDIR}${PREFIX}/lib/libv8.so
113
#	${INSTALL_PROGRAM} ${WRKSRC}/out/${BUILDTYPE}/mkgrokdump ${STAGEDIR}${PREFIX}/bin/mkgrokdump
114
	${INSTALL_LIB} ${WRKSRC}/out/${BUILDTYPE}/libv8.so ${STAGEDIR}${PREFIX}/lib/libv8.so
115
	${INSTALL_LIB} ${WRKSRC}/out/${BUILDTYPE}/libv8_libbase.so ${STAGEDIR}${PREFIX}/lib/libv8_libbase.so
116
	${INSTALL_LIB} ${WRKSRC}/out/${BUILDTYPE}/libv8_libplatform.so ${STAGEDIR}${PREFIX}/lib/libv8_libplatform.so
66
117
67
.include <bsd.port.post.mk>
118
	${INSTALL_DATA} ${WRKSRC}/include/*.h ${STAGEDIR}${PREFIX}/include/
119
	${MKDIR} ${STAGEDIR}${PREFIX}/include/libplatform/
120
	${INSTALL_DATA} ${WRKSRC}/include/libplatform/*.h ${STAGEDIR}${PREFIX}/include/libplatform/
121
	${INSTALL_DATA} ${FILESDIR}/*.pc ${STAGEDIR}${PREFIX}/libdata/pkgconfig
122
	${REINPLACE_CMD} "s|%%PREFIX%%|${PREFIX}|" \
123
		${STAGEDIR}${PREFIX}/libdata/pkgconfig/*
124
125
.include <bsd.port.mk>
(-)lang/v8/distinfo (-2 / +19 lines)
Lines 1-2 Link Here
1
SHA256 (v8-3.18.5.tar.xz) = badfa55867887e4fef68161dc877aac5e9d19c6dddb7e96b8d6f7084de711b71
1
TIMESTAMP = 1592416014
2
SIZE (v8-3.18.5.tar.xz) = 8727400
2
SHA256 (build-8038ef2827d0bc23ac85450a91b0a2a413944a24.tar.gz) = 4aed0dd7e22ce04c2ca9a494c72fbb3cb700ecb8e7c2a784cc6915f05ac3e355
3
SIZE (build-8038ef2827d0bc23ac85450a91b0a2a413944a24.tar.gz) = 1204344
4
SHA256 (buildtools-574cbd5df82c6ae48805b2aa8d75e0ef76aa15aa.tar.gz) = 56ce3c7d545ee6b9629ca470f2ee716c809047e78819153f5702ee7331e31b66
5
SIZE (buildtools-574cbd5df82c6ae48805b2aa8d75e0ef76aa15aa.tar.gz) = 86391
6
SHA256 (clang-5e1d63a7e37e51596de0d3c01e239ff8919b5d6e.tar.gz) = 6fb2cb105a1a262d29b5740b8216b3428492b33c03930af495a17e071edbc004
7
SIZE (clang-5e1d63a7e37e51596de0d3c01e239ff8919b5d6e.tar.gz) = 263915
8
SHA256 (common-ef3586804494b7e402b6c1791d5dccdf2971afff.tar.gz) = 112f2d82316830cbbbdfd4a89b0df647676753ed654e0351f0db99c9b23139f1
9
SIZE (common-ef3586804494b7e402b6c1791d5dccdf2971afff.tar.gz) = 9980
10
SHA256 (gmock-4fe018038f87675c083d0cfb6a6b57c274fb1753.tar.gz) = c407b7cdcb9b762ee3ee266f11a8243a4c2450f000bf14e1933d75ceb8ddd76c
11
SIZE (gmock-4fe018038f87675c083d0cfb6a6b57c274fb1753.tar.gz) = 863491
12
SHA256 (icu-46f53dfc09c520b7c520a089ca473bb0ee29c07e.tar.gz) = 8198f22522d33e0339ecd6a114876c47d6c864c7a96319d0d035ed235e24f1d3
13
SIZE (icu-46f53dfc09c520b7c520a089ca473bb0ee29c07e.tar.gz) = 43209997
14
SHA256 (perfetto-ff70e0d273ed10995866c803f23e11250eb3dc52.tar.gz) = 7040abc5c8f5628ec540b208b1ff0cf458baeaf09ad445d30280175c213f1779
15
SIZE (perfetto-ff70e0d273ed10995866c803f23e11250eb3dc52.tar.gz) = 4198649
16
SHA256 (zlib-a68151fd9b9f5ad11b96a3765f706361ff22dbc8.tar.gz) = 3613d81827e569f1b6fb873933586204460b3c374189d549f332375b7e5431b7
17
SIZE (zlib-a68151fd9b9f5ad11b96a3765f706361ff22dbc8.tar.gz) = 301126
18
SHA256 (v8-v8-8.5.145_GH0.tar.gz) = 0c5d78927f7d43271176c2518f436056cba6b7b7ea13bac83aceb1d1644533b6
19
SIZE (v8-v8-8.5.145_GH0.tar.gz) = 25662202
(-)lang/v8/files/extra-patch-src-stub-cache.cc (-11 lines)
Lines 1-11 Link Here
1
--- src/stub-cache.cc.orig	2013-05-01 12:56:29 UTC
2
+++ src/stub-cache.cc
3
@@ -1474,7 +1474,7 @@ Handle<Code> StubCompiler::GetCodeWithFl
4
                                             Handle<Name> name) {
5
   return (FLAG_print_code_stubs && !name.is_null() && name->IsString())
6
       ? GetCodeWithFlags(flags, *Handle<String>::cast(name)->ToCString())
7
-      : GetCodeWithFlags(flags, reinterpret_cast<char*>(NULL));
8
+      : GetCodeWithFlags(flags, static_cast<char*>(NULL));
9
 }
10
 
11
 
(-)lang/v8/files/patch-CVE-2015-5380 (-95 lines)
Lines 1-95 Link Here
1
Backport of fix found here:
2
https://github.com/joyent/node/commit/78b0e30954111cfaba0edbeee85450d8cbc6fdf6
3
4
Note, this patch is modified to use ASSERT instead of DCHECK because
5
this version of node is from before the rename which happened here:
6
https://codereview.chromium.org/430503007
7
8
--- src/unicode-inl.h.orig	2013-05-01 12:56:29 UTC
9
+++ src/unicode-inl.h
10
@@ -168,6 +168,7 @@ unsigned Utf8::Length(uchar c, int previ
11
 
12
 Utf8DecoderBase::Utf8DecoderBase()
13
   : unbuffered_start_(NULL),
14
+    unbuffered_length_(0),
15
     utf16_length_(0),
16
     last_byte_of_buffer_unused_(false) {}
17
 
18
@@ -207,8 +208,7 @@ unsigned Utf8Decoder<kBufferSize>::Write
19
   if (length <= buffer_length) return length;
20
   ASSERT(unbuffered_start_ != NULL);
21
   // Copy the rest the slow way.
22
-  WriteUtf16Slow(unbuffered_start_,
23
-                 data + buffer_length,
24
+  WriteUtf16Slow(unbuffered_start_, unbuffered_length_, data + buffer_length,
25
                  length - buffer_length);
26
   return length;
27
 }
28
--- src/unicode.cc.orig	2013-05-01 12:56:29 UTC
29
+++ src/unicode.cc
30
@@ -284,6 +284,7 @@ void Utf8DecoderBase::Reset(uint16_t* bu
31
   // Assume everything will fit in the buffer and stream won't be needed.
32
   last_byte_of_buffer_unused_ = false;
33
   unbuffered_start_ = NULL;
34
+  unbuffered_length_ = 0;
35
   bool writing_to_buffer = true;
36
   // Loop until stream is read, writing to buffer as long as buffer has space.
37
   unsigned utf16_length = 0;
38
@@ -310,6 +311,7 @@ void Utf8DecoderBase::Reset(uint16_t* bu
39
         // Just wrote last character of buffer
40
         writing_to_buffer = false;
41
         unbuffered_start_ = stream;
42
+        unbuffered_length_ = stream_length;
43
       }
44
       continue;
45
     }
46
@@ -319,20 +321,24 @@ void Utf8DecoderBase::Reset(uint16_t* bu
47
     writing_to_buffer = false;
48
     last_byte_of_buffer_unused_ = true;
49
     unbuffered_start_ = stream - cursor;
50
+    unbuffered_length_ = stream_length + cursor;
51
   }
52
   utf16_length_ = utf16_length;
53
 }
54
 
55
 
56
 void Utf8DecoderBase::WriteUtf16Slow(const uint8_t* stream,
57
+                                     unsigned stream_length,
58
                                      uint16_t* data,
59
                                      unsigned data_length) {
60
   while (data_length != 0) {
61
     unsigned cursor = 0;
62
-    uint32_t character = Utf8::ValueOf(stream, Utf8::kMaxEncodedSize, &cursor);
63
+
64
+    uint32_t character = Utf8::ValueOf(stream, stream_length, &cursor);
65
     // There's a total lack of bounds checking for stream
66
     // as it was already done in Reset.
67
     stream += cursor;
68
+    stream_length -= cursor;
69
     if (character > unibrow::Utf16::kMaxNonSurrogateCharCode) {
70
       *data++ = Utf16::LeadSurrogate(character);
71
       *data++ = Utf16::TrailSurrogate(character);
72
@@ -343,6 +349,7 @@ void Utf8DecoderBase::WriteUtf16Slow(con
73
       data_length -= 1;
74
     }
75
   }
76
+  ASSERT(stream_length >= 0);
77
 }
78
 
79
 
80
--- src/unicode.h.orig	2013-05-01 12:56:29 UTC
81
+++ src/unicode.h
82
@@ -184,10 +184,10 @@ class Utf8DecoderBase {
83
              unsigned buffer_length,
84
              const uint8_t* stream,
85
              unsigned stream_length);
86
-  static void WriteUtf16Slow(const uint8_t* stream,
87
-                             uint16_t* data,
88
-                             unsigned length);
89
+  static void WriteUtf16Slow(const uint8_t* stream, unsigned stream_length,
90
+                             uint16_t* data, unsigned length);
91
   const uint8_t* unbuffered_start_;
92
+  unsigned unbuffered_length_;
93
   unsigned utf16_length_;
94
   bool last_byte_of_buffer_unused_;
95
  private:
(-)lang/v8/files/patch-build_config_BUILD.gn (+30 lines)
Line 0 Link Here
1
--- build/config/BUILD.gn.orig	2020-05-13 18:39:35 UTC
2
+++ build/config/BUILD.gn
3
@@ -133,7 +133,7 @@ config("debug") {
4
       # builds, and we have to tell it to turn it off.
5
       defines += [ "_HAS_ITERATOR_DEBUGGING=0" ]
6
     }
7
-  } else if (is_linux && current_cpu == "x64" && enable_iterator_debugging) {
8
+  } else if ((is_linux || is_bsd) && current_cpu == "x64" && enable_iterator_debugging) {
9
     # Enable libstdc++ debugging facilities to help catch problems early, see
10
     # http://crbug.com/65151 .
11
     # TODO(phajdan.jr): Should we enable this for all of POSIX?
12
@@ -231,9 +231,7 @@ config("default_libs") {
13
     ]
14
   } else if (is_linux) {
15
     libs = [
16
-      "dl",
17
       "pthread",
18
-      "rt",
19
     ]
20
   }
21
 }
22
@@ -316,7 +314,7 @@ config("executable_config") {
23
       "//build/config/ios:ios_dynamic_flags",
24
       "//build/config/ios:ios_executable_flags",
25
     ]
26
-  } else if (is_linux || is_android || current_os == "aix") {
27
+  } else if (is_linux || is_bsd || is_android || current_os == "aix") {
28
     configs += [ "//build/config/gcc:executable_config" ]
29
     if (is_chromecast) {
30
       configs += [ "//build/config/chromecast:executable_config" ]
(-)lang/v8/files/patch-build_config_BUILDCONFIG.gn (+48 lines)
Line 0 Link Here
1
--- build/config/BUILDCONFIG.gn.orig	2019-06-04 18:55:15 UTC
2
+++ build/config/BUILDCONFIG.gn
3
@@ -131,10 +131,10 @@ declare_args() {
4
   is_official_build = false
5
 
6
   # Whether we're a traditional desktop unix.
7
-  is_desktop_linux = current_os == "linux"
8
+  is_desktop_linux = current_os == "linux" || current_os == "freebsd"
9
 
10
   # Set to true when compiling with the Clang compiler.
11
-  is_clang = current_os != "linux" ||
12
+  is_clang = current_os != "linux" || current_os == "freebsd" ||
13
              (current_cpu != "s390x" && current_cpu != "s390" &&
14
               current_cpu != "ppc64" && current_cpu != "ppc" &&
15
               current_cpu != "mips" && current_cpu != "mips64")
16
@@ -186,8 +186,8 @@ if (host_toolchain == "") {
17
   # TODO(dpranke): Add some sort of assert here that verifies that
18
   # no toolchain omitted host_toolchain from its toolchain_args().
19
 
20
-  if (host_os == "linux") {
21
-    if (target_os != "linux") {
22
+  if (host_os == "linux" || host_os == "freebsd") {
23
+    if (target_os != "linux" && target_os != "freebsd") {
24
       host_toolchain = "//build/toolchain/linux:clang_$host_cpu"
25
     } else if (is_clang) {
26
       host_toolchain = "//build/toolchain/linux:clang_$host_cpu"
27
@@ -224,7 +224,7 @@ if (target_os == "android") {
28
   assert(host_os == "linux" || host_os == "mac",
29
          "Android builds are only supported on Linux and Mac hosts.")
30
   _default_toolchain = "//build/toolchain/android:android_clang_$target_cpu"
31
-} else if (target_os == "chromeos" || target_os == "linux") {
32
+} else if (target_os == "chromeos" || target_os == "linux" || target_os == "freebsd") {
33
   # See comments in build/toolchain/cros/BUILD.gn about board compiles.
34
   if (is_clang) {
35
     _default_toolchain = "//build/toolchain/linux:clang_$target_cpu"
36
@@ -288,10 +288,11 @@ is_android = current_os == "android"
37
 is_chromeos = current_os == "chromeos"
38
 is_fuchsia = current_os == "fuchsia"
39
 is_ios = current_os == "ios"
40
-is_linux = current_os == "chromeos" || current_os == "linux"
41
+is_linux = current_os == "chromeos" || current_os == "linux" || current_os == "freebsd"
42
 is_mac = current_os == "mac"
43
 is_nacl = current_os == "nacl"
44
 is_win = current_os == "win" || current_os == "winuwp"
45
+is_bsd = current_os == "freebsd"
46
 
47
 is_posix = !is_win && !is_fuchsia
48
 
(-)lang/v8/files/patch-build_config_compiler_BUILD.gn (+92 lines)
Line 0 Link Here
1
--- build/config/compiler/BUILD.gn.orig	2020-06-03 18:40:10 UTC
2
+++ build/config/compiler/BUILD.gn
3
@@ -138,7 +138,7 @@ declare_args() {
4
   # 'is_android' breaks content_shell_test_apk on android-kitkat-arm-rel.
5
   # 'use_xcode_clang' may call old clang.
6
   init_stack_vars =
7
-      !is_android && !use_xcode_clang && (!is_official_build || is_linux)
8
+      !is_android && !use_xcode_clang && (!is_official_build || is_linux) && !is_bsd
9
 
10
   # This argument is to control whether enabling text section splitting in the
11
   # final binary. When enabled, the separated text sections with prefix
12
@@ -307,7 +307,7 @@ config("compiler") {
13
     }
14
 
15
     # Linker warnings.
16
-    if (fatal_linker_warnings && !is_mac && !is_ios && current_os != "aix") {
17
+    if (fatal_linker_warnings && !is_mac && !is_ios && !is_bsd && current_os != "aix") {
18
       ldflags += [ "-Wl,--fatal-warnings" ]
19
     }
20
     if (fatal_linker_warnings && (is_mac || is_ios)) {
21
@@ -401,7 +401,7 @@ config("compiler") {
22
 
23
     # Compiler instrumentation can introduce dependencies in DSOs to symbols in
24
     # the executable they are loaded into, so they are unresolved at link-time.
25
-    if (!using_sanitizer) {
26
+    if (!using_sanitizer && !is_bsd) {
27
       ldflags += [
28
         "-Wl,-z,defs",
29
         "-Wl,--as-needed",
30
@@ -500,7 +500,7 @@ config("compiler") {
31
     ldflags += [ "-Wl,-z,keep-text-section-prefix" ]
32
   }
33
 
34
-  if (is_clang && !is_nacl && !use_xcode_clang) {
35
+  if (is_clang && !is_nacl && !use_xcode_clang && !is_bsd) {
36
     cflags += [ "-fcrash-diagnostics-dir=" +
37
                 rebase_path("//tools/clang/crashreports", root_build_dir) ]
38
 
39
@@ -770,7 +770,7 @@ config("compiler_cpu_abi") {
40
         cflags += [ "-mtune=$arm_tune" ]
41
       }
42
     } else if (current_cpu == "arm64") {
43
-      if (is_clang && !is_android && !is_nacl && !is_fuchsia) {
44
+      if (is_clang && !is_android && !is_nacl && !is_fuchsia && !is_bsd) {
45
         cflags += [ "--target=aarch64-linux-gnu" ]
46
         ldflags += [ "--target=aarch64-linux-gnu" ]
47
       }
48
@@ -1120,7 +1120,7 @@ config("compiler_deterministic") {
49
       "-Xclang",
50
       ".",
51
     ]
52
-    if (!is_win) {
53
+    if (!is_win && !is_bsd) {
54
       # We don't use clang -cc1as on Windows (yet? https://crbug.com/762167)
55
       asmflags = [ "-Wa,-fdebug-compilation-dir,." ]
56
     }
57
@@ -1503,7 +1503,7 @@ config("default_warnings") {
58
         cflags += [ "-Wno-nonportable-include-path" ]
59
       }
60
 
61
-      if (current_toolchain == host_toolchain || !use_xcode_clang) {
62
+      if ((current_toolchain == host_toolchain || !use_xcode_clang) && !is_bsd) {
63
         # Flags NaCl (Clang 3.7) and Xcode 9.2 (Clang clang-900.0.39.2) do not
64
         # recognize.
65
         cflags += [
66
@@ -1753,7 +1753,7 @@ config("thin_archive") {
67
   # Mac and iOS use the mac-specific "libtool" command, not ar, which doesn't
68
   # have a "thin archive" mode (it does accept -T, but it means truncating
69
   # archive names to 16 characters, which is not what we want).
70
-  if ((is_posix && !is_nacl && !is_mac && !is_ios) || is_fuchsia) {
71
+  if ((is_posix && !is_nacl && !is_mac && !is_ios && !is_bsd) || is_fuchsia) {
72
     arflags = [ "-T" ]
73
   } else if (is_win && use_lld) {
74
     arflags = [ "/llvmlibthin" ]
75
@@ -2277,7 +2277,7 @@ config("symbols") {
76
     # flag, so we can use use -g1 for pnacl and nacl-clang compiles.
77
     # gcc nacl is is_nacl && !is_clang, pnacl and nacl-clang are && is_clang.
78
     if (!is_nacl || is_clang) {
79
-      cflags += [ "-g2" ]
80
+      cflags += [ "-g0" ]
81
     }
82
 
83
     if (is_clang && !is_nacl && !use_xcode_clang) {
84
@@ -2305,7 +2305,7 @@ config("symbols") {
85
     # DWARF info may be corrupt; offsets in a range list entry are in different
86
     # sections" there.  Maybe just a bug in nacl_switch_32.S.
87
     if (!is_mac && !is_ios && !is_nacl && current_cpu != "x86" &&
88
-        (use_gold || use_lld)) {
89
+        (use_gold || use_lld) && !is_bsd) {
90
       if (is_clang) {
91
         # This flag enables the GNU-format pubnames and pubtypes sections,
92
         # which lld needs in order to generate a correct GDB index.
(-)lang/v8/files/patch-build_config_compiler_compiler.gni (+11 lines)
Line 0 Link Here
1
--- build/config/compiler/compiler.gni.orig	2020-06-13 18:27:18 UTC
2
+++ build/config/compiler/compiler.gni
3
@@ -176,7 +176,7 @@ declare_args() {
4
 declare_args() {
5
   # Whether to use the gold linker from binutils instead of lld or bfd.
6
   use_gold =
7
-      !use_lld && !(is_chromecast && is_linux &&
8
+      !is_bsd && !use_lld && !(is_chromecast && is_linux &&
9
                     (current_cpu == "arm" || current_cpu == "mipsel")) &&
10
       ((is_linux && (current_cpu == "x64" || current_cpu == "x86" ||
11
                      current_cpu == "arm" || current_cpu == "arm64" ||
(-)lang/v8/files/patch-build_config_features.gni (+11 lines)
Line 0 Link Here
1
--- build/config/features.gni.orig	2019-10-21 19:06:18 UTC
2
+++ build/config/features.gni
3
@@ -26,7 +26,7 @@ declare_args() {
4
   proprietary_codecs = is_chrome_branded || is_chromecast
5
 
6
   # libudev usage. This currently only affects the content layer.
7
-  use_udev = is_linux && !is_chromecast
8
+  use_udev = is_linux && !is_chromecast && !is_bsd
9
 
10
   use_dbus = is_linux && !is_chromecast
11
 
(-)lang/v8/files/patch-build_config_freetype_freetype.gni (+9 lines)
Line 0 Link Here
1
--- build/config/freetype/freetype.gni.orig	2019-03-18 08:59:45 UTC
2
+++ build/config/freetype/freetype.gni
3
@@ -10,5 +10,5 @@ declare_args() {
4
   # than version 2.7.1 and have color bitmap support compiled in. WARNING:
5
   # System FreeType configurations other than as described WILL INTRODUCE TEXT
6
   # RENDERING AND SECURITY REGRESSIONS.
7
-  use_system_freetype = false
8
+  use_system_freetype = true
9
 }
(-)lang/v8/files/patch-build_config_linux_BUILD.gn (+11 lines)
Line 0 Link Here
1
--- build/config/linux/BUILD.gn.orig	2020-05-13 18:39:36 UTC
2
+++ build/config/linux/BUILD.gn
3
@@ -30,7 +30,7 @@ config("runtime_library") {
4
 
5
   if ((!(is_chromeos || chromeos_is_browser_only) ||
6
        default_toolchain != "//build/toolchain/cros:target") &&
7
-      (!use_custom_libcxx || current_cpu == "mipsel")) {
8
+      (!use_custom_libcxx || current_cpu == "mipsel") && !is_bsd) {
9
     libs = [ "atomic" ]
10
   }
11
 }
(-)lang/v8/files/patch-build_config_linux_pkg-config.py (+26 lines)
Line 0 Link Here
1
--- build/config/linux/pkg-config.py.orig	2019-07-24 18:58:02 UTC
2
+++ build/config/linux/pkg-config.py
3
@@ -59,8 +59,12 @@ def SetConfigPath(options):
4
     print("You must specify an architecture via -a if using a sysroot.")
5
     sys.exit(1)
6
 
7
-  libdir = sysroot + '/usr/' + options.system_libdir + '/pkgconfig'
8
-  libdir += ':' + sysroot + '/usr/share/pkgconfig'
9
+  if "linux" in sys.platform:
10
+    libdir = sysroot + '/libdata/' + options.system_libdir + '/pkgconfig'
11
+    libdir += ':' + sysroot + '/usr/share/pkgconfig'
12
+  elif "bsd" in sys.platform:
13
+    libdir = sysroot + '/libdata/pkgconfig'
14
+    libdir += ':' + '/usr/libdata/pkgconfig'
15
   os.environ['PKG_CONFIG_LIBDIR'] = libdir
16
   return libdir
17
 
18
@@ -109,7 +113,7 @@ def main():
19
   # If this is run on non-Linux platforms, just return nothing and indicate
20
   # success. This allows us to "kind of emulate" a Linux build from other
21
   # platforms.
22
-  if "linux" not in sys.platform:
23
+  if "bsd" not in sys.platform:
24
     print("[[],[],[],[],[]]")
25
     return 0
26
 
(-)lang/v8/files/patch-build_config_sysroot.gni (+14 lines)
Line 0 Link Here
1
--- build/config/sysroot.gni.orig	2020-05-13 18:39:36 UTC
2
+++ build/config/sysroot.gni
3
@@ -21,9 +21,9 @@ declare_args() {
4
 
5
   # Controls default is_linux sysroot. If set to true, and sysroot
6
   # is empty, default sysroot is calculated.
7
-  use_sysroot = current_cpu == "x86" || current_cpu == "x64" ||
8
+  use_sysroot = !is_bsd && (current_cpu == "x86" || current_cpu == "x64" ||
9
                 current_cpu == "arm" || current_cpu == "arm64" ||
10
-                current_cpu == "mipsel" || current_cpu == "mips64el"
11
+                current_cpu == "mipsel" || current_cpu == "mips64el")
12
 }
13
 
14
 if (sysroot == "") {
(-)lang/v8/files/patch-build_detect__host__arch.py (+11 lines)
Line 0 Link Here
1
--- build/detect_host_arch.py.orig	2019-07-24 18:58:02 UTC
2
+++ build/detect_host_arch.py
3
@@ -21,6 +21,8 @@ def HostArch():
4
     host_arch = 'ia32'
5
   elif host_arch in ['x86_64', 'amd64']:
6
     host_arch = 'x64'
7
+  elif host_arch.startswith('arm64'):
8
+    host_arch = 'arm64'
9
   elif host_arch.startswith('arm'):
10
     host_arch = 'arm'
11
   elif host_arch.startswith('aarch64'):
(-)lang/v8/files/patch-build_gn__run__binary.py (+11 lines)
Line 0 Link Here
1
--- build/gn_run_binary.py.orig	2019-07-24 18:58:02 UTC
2
+++ build/gn_run_binary.py
3
@@ -24,7 +24,7 @@ if not os.path.isabs(path):
4
 # The rest of the arguments are passed directly to the executable.
5
 args = [path] + sys.argv[2:]
6
 
7
-ret = subprocess.call(args)
8
+ret = subprocess.call(args, env={"CHROME_EXE_PATH":"${WRKSRC}/out/Release/chrome"})
9
 if ret != 0:
10
   if ret <= -100:
11
     # Windows error codes such as 0xC0000005 and 0xC0000409 are much easier to
(-)lang/v8/files/patch-build_linux_chrome.map (+29 lines)
Line 0 Link Here
1
--- build/linux/chrome.map.orig	2019-03-11 22:00:52 UTC
2
+++ build/linux/chrome.map
3
@@ -1,4 +1,7 @@
4
 {
5
+local:
6
+  *;
7
+
8
 global:
9
   __bss_start;
10
   __data_start;
11
@@ -20,6 +23,10 @@ global:
12
   # Program entry point.
13
   _start;
14
 
15
+  # FreeBSD specific variables.
16
+  __progname;
17
+  environ;
18
+
19
   # Memory allocation symbols.  We want chrome and any libraries to
20
   # share the same heap, so it is correct to export these symbols.
21
   calloc;
22
@@ -81,7 +88,4 @@ global:
23
   localtime64;
24
   localtime64_r;
25
   localtime_r;
26
-
27
-local:
28
-  *;
29
 };
(-)lang/v8/files/patch-build_linux_libpci_BUILD.gn (+53 lines)
Line 0 Link Here
1
--- build/linux/libpci/BUILD.gn.orig	2019-03-11 22:00:52 UTC
2
+++ build/linux/libpci/BUILD.gn
3
@@ -3,20 +3,36 @@
4
 # found in the LICENSE file.
5
 
6
 import("//tools/generate_library_loader/generate_library_loader.gni")
7
+import("//build/config/linux/pkg_config.gni")
8
 
9
-# This generates a target named "libpci".
10
-generate_library_loader("libpci") {
11
-  name = "LibPciLoader"
12
-  output_h = "libpci.h"
13
-  output_cc = "libpci_loader.cc"
14
-  header = "<pci/pci.h>"
15
+declare_args() {
16
+  use_system_libpci = is_bsd
17
+}
18
 
19
-  functions = [
20
-    "pci_alloc",
21
-    "pci_init",
22
-    "pci_cleanup",
23
-    "pci_scan_bus",
24
-    "pci_fill_info",
25
-    "pci_lookup_name",
26
-  ]
27
+if (use_system_libpci) {
28
+  pkg_config("system_libpci") {
29
+    packages = [ "libpci" ]
30
+  }
31
+
32
+  source_set("libpci") {
33
+    public_configs = [ ":system_libpci" ]
34
+  }
35
+
36
+} else {
37
+  # This generates a target named "libpci".
38
+  generate_library_loader("libpci") {
39
+    name = "LibPciLoader"
40
+    output_h = "libpci.h"
41
+    output_cc = "libpci_loader.cc"
42
+    header = "<pci/pci.h>"
43
+
44
+    functions = [
45
+      "pci_alloc",
46
+      "pci_init",
47
+      "pci_cleanup",
48
+      "pci_scan_bus",
49
+      "pci_fill_info",
50
+      "pci_lookup_name",
51
+    ]
52
+  }
53
 }
(-)lang/v8/files/patch-build_linux_unbundle_libusb.gn (+27 lines)
Line 0 Link Here
1
--- build/linux/unbundle/libusb.gn.orig	2019-03-17 01:47:13 UTC
2
+++ build/linux/unbundle/libusb.gn
3
@@ -0,0 +1,24 @@
4
+# Copyright 2016 The Chromium Authors. All rights reserved.
5
+# Use of this source code is governed by a BSD-style license that can be
6
+# found in the LICENSE file.
7
+
8
+import("//build/config/linux/pkg_config.gni")
9
+import("//build/shim_headers.gni")
10
+
11
+pkg_config("system_libusb") {
12
+  packages = [ "libusb-1.0" ]
13
+}
14
+
15
+shim_headers("libusb_shim") {
16
+  root_path = "src/libusb"
17
+  headers = [
18
+    "libusb.h",
19
+  ]
20
+}
21
+
22
+source_set("libusb") {
23
+  deps = [
24
+    ":libusb_shim",
25
+  ]
26
+  public_configs = [ ":system_libusb" ]
27
+}
(-)lang/v8/files/patch-build_linux_unbundle_replace__gn__files.py (+10 lines)
Line 0 Link Here
1
--- build/linux/unbundle/replace_gn_files.py.orig	2019-03-11 22:00:52 UTC
2
+++ build/linux/unbundle/replace_gn_files.py
3
@@ -27,6 +27,7 @@ REPLACEMENTS = {
4
   'libevent': 'base/third_party/libevent/BUILD.gn',
5
   'libjpeg': 'third_party/libjpeg.gni',
6
   'libpng': 'third_party/libpng/BUILD.gn',
7
+  'libusb': 'third_party/libusb/BUILD.gn',
8
   'libvpx': 'third_party/libvpx/BUILD.gn',
9
   'libwebp': 'third_party/libwebp/BUILD.gn',
10
   'libxml': 'third_party/libxml/BUILD.gn',
(-)lang/v8/files/patch-build_toolchain_gcc__toolchain.gni (+45 lines)
Line 0 Link Here
1
--- build/toolchain/gcc_toolchain.gni.orig	2020-05-13 18:40:16 UTC
2
+++ build/toolchain/gcc_toolchain.gni
3
@@ -36,6 +36,11 @@ if (is_linux && target_os == "android") {
4
   enable_resource_whitelist_generation = false
5
 }
6
 
7
+declare_args() {
8
+  extra_cxxflags = ""
9
+  extra_ldflags = ""
10
+}
11
+
12
 # This template defines a toolchain for something that works like gcc
13
 # (including clang).
14
 #
15
@@ -589,13 +594,23 @@ template("clang_toolchain") {
16
   }
17
 
18
   gcc_toolchain(target_name) {
19
-    prefix = rebase_path("$clang_base_path/bin", root_build_dir)
20
-    cc = "$prefix/clang"
21
-    cxx = "$prefix/clang++"
22
-    ld = cxx
23
-    readelf = "${toolprefix}readelf"
24
-    ar = "${prefix}/llvm-ar"
25
-    nm = "${toolprefix}nm"
26
+    if (is_bsd) {
27
+      prefix = "%%LOCALBASE%%/bin"
28
+      cc = "clang10"
29
+      cxx = "clang++10"
30
+      ld = cxx
31
+      readelf = "readelf"
32
+      ar = "${prefix}/ar"
33
+      nm = "${toolprefix}nm"
34
+    } else {
35
+      prefix = rebase_path("$clang_base_path/bin", root_build_dir)
36
+      cc = "$prefix/clang"
37
+      cxx = "$prefix/clang++"
38
+      ld = cxx
39
+      readelf = "${toolprefix}readelf"
40
+      ar = "${prefix}/llvm-ar"
41
+      nm = "${toolprefix}nm"
42
+    }
43
 
44
     forward_variables_from(invoker,
45
                            [
(-)lang/v8/files/patch-build_toolchain_get__concurrent__links.py (+17 lines)
Line 0 Link Here
1
--- build/toolchain/get_concurrent_links.py.orig	2019-06-04 18:55:15 UTC
2
+++ build/toolchain/get_concurrent_links.py
3
@@ -48,6 +48,14 @@ def _GetTotalMemoryInBytes():
4
       return int(subprocess.check_output(['sysctl', '-n', 'hw.memsize']))
5
     except Exception:
6
       return 0
7
+  elif sys.platform.startswith('freebsd'):
8
+    try:
9
+      avail_bytes = int(subprocess.check_output(['sysctl', '-n', 'hw.physmem']))
10
+      # With -fuse-lld it doesn't take a lot of ram, feel free to change that
11
+      # 1 * ... to needed amount
12
+      return max(1, avail_bytes / (1 * (2 ** 30)))  # total / 4GB
13
+    except Exception:
14
+      return 1
15
   # TODO(scottmg): Implement this for other platforms.
16
   return 0
17
 
(-)lang/v8/files/patch-build_toolchain_linux_BUILD.gn (+10 lines)
Line 0 Link Here
1
--- build/toolchain/linux/BUILD.gn.orig	2019-04-30 22:22:28 UTC
2
+++ build/toolchain/linux/BUILD.gn
3
@@ -22,7 +22,6 @@ clang_toolchain("clang_arm") {
4
 }
5
 
6
 clang_toolchain("clang_arm64") {
7
-  toolprefix = "aarch64-linux-gnu-"
8
   toolchain_args = {
9
     current_cpu = "arm64"
10
     current_os = "linux"
(-)lang/v8/files/patch-src-checks.h (-11 lines)
Lines 1-11 Link Here
1
--- src/checks.h.orig	2013-05-01 12:56:29 UTC
2
+++ src/checks.h
3
@@ -248,7 +248,7 @@ template <int> class StaticAssertionHelp
4
 #define STATIC_CHECK(test)                                                    \
5
   typedef                                                                     \
6
     StaticAssertionHelper<sizeof(StaticAssertion<static_cast<bool>((test))>)> \
7
-    SEMI_STATIC_JOIN(__StaticAssertTypedef__, __LINE__)
8
+    SEMI_STATIC_JOIN(__StaticAssertTypedef__, __LINE__) __attribute__((__unused__))
9
 
10
 
11
 extern bool FLAG_enable_slow_asserts;
(-)lang/v8/files/patch-src-deoptimizer.cc (-29 lines)
Lines 1-29 Link Here
1
--- src/deoptimizer.cc.orig	2013-05-01 12:56:29 UTC
2
+++ src/deoptimizer.cc
3
@@ -1392,7 +1392,7 @@ void Deoptimizer::MaterializeHeapObjects
4
       PrintF("Materializing a new heap number %p [%e] in slot %p\n",
5
              reinterpret_cast<void*>(*num),
6
              d.value(),
7
-             d.slot_address());
8
+             reinterpret_cast<void*>(d.slot_address()));
9
     }
10
     Memory::Object_at(d.slot_address()) = *num;
11
   }
12
@@ -1474,7 +1474,7 @@ void Deoptimizer::MaterializeHeapNumbers
13
                "for parameter slot #%d\n",
14
                reinterpret_cast<void*>(*num),
15
                d.value(),
16
-               d.slot_address(),
17
+               reinterpret_cast<void*>(d.slot_address()),
18
                index);
19
       }
20
 
21
@@ -1490,7 +1490,7 @@ void Deoptimizer::MaterializeHeapNumbers
22
                "for expression slot #%d\n",
23
                reinterpret_cast<void*>(*num),
24
                d.value(),
25
-               d.slot_address(),
26
+               reinterpret_cast<void*>(d.slot_address()),
27
                index);
28
       }
29
 
(-)lang/v8/files/patch-src-ia32-code-stubs-ia32.cc (-11 lines)
Lines 1-11 Link Here
1
--- src/ia32/code-stubs-ia32.cc.orig	2013-05-01 12:56:29 UTC
2
+++ src/ia32/code-stubs-ia32.cc
3
@@ -5650,7 +5650,7 @@ void StringCharFromCodeGenerator::Genera
4
   ASSERT(IsPowerOf2(String::kMaxOneByteCharCode + 1));
5
   __ test(code_,
6
           Immediate(kSmiTagMask |
7
-                    ((~String::kMaxOneByteCharCode) << kSmiTagSize)));
8
+                    ((~String::kMaxOneByteCharCodeU) << kSmiTagSize)));
9
   __ j(not_zero, &slow_case_);
10
 
11
   Factory* factory = masm->isolate()->factory();
(-)lang/v8/files/patch-src-ia32-disasm-ia32.cc (-11 lines)
Lines 1-11 Link Here
1
--- src/ia32/disasm-ia32.cc.orig	2013-05-01 12:56:29 UTC
2
+++ src/ia32/disasm-ia32.cc
3
@@ -1707,7 +1707,7 @@ int Disassembler::ConstantPoolSizeAt(byt
4
     buffer[0] = '\0';
5
     byte* prev_pc = pc;
6
     pc += d.InstructionDecode(buffer, pc);
7
-    fprintf(f, "%p", prev_pc);
8
+    fprintf(f, "%p", reinterpret_cast<void*>(prev_pc));
9
     fprintf(f, "    ");
10
 
11
     for (byte* bp = prev_pc; bp < pc; bp++) {
(-)lang/v8/files/patch-src-ia32-ic-ia32.cc (-12 lines)
Lines 1-12 Link Here
1
--- src/ia32/ic-ia32.cc.orig	2013-05-01 12:56:29 UTC
2
+++ src/ia32/ic-ia32.cc
3
@@ -1657,7 +1657,8 @@ void PatchInlinedSmiCode(Address address
4
   int8_t delta = *reinterpret_cast<int8_t*>(delta_address);
5
   if (FLAG_trace_ic) {
6
     PrintF("[  patching ic at %p, test=%p, delta=%d\n",
7
-           address, test_instruction_address, delta);
8
+           reinterpret_cast<void*>(address),
9
+           reinterpret_cast<void*>(test_instruction_address), delta);
10
   }
11
 
12
   // Patch with a short conditional jump. Enabling means switching from a short
(-)lang/v8/files/patch-src-liveedit.cc (-11 lines)
Lines 1-11 Link Here
1
--- src/liveedit.cc.orig	2013-05-01 12:56:29 UTC
2
+++ src/liveedit.cc
3
@@ -203,7 +203,7 @@ class Differencer {
4
 
5
   static const int kDirectionSizeBits = 2;
6
   static const int kDirectionMask = (1 << kDirectionSizeBits) - 1;
7
-  static const int kEmptyCellValue = -1 << kDirectionSizeBits;
8
+  static const int kEmptyCellValue = -(1 << kDirectionSizeBits);
9
 
10
   // This method only holds static assert statement (unfortunately you cannot
11
   // place one in class scope).
(-)lang/v8/files/patch-src-objects.h (-22 lines)
Lines 1-22 Link Here
1
--- src/objects.h.orig	2013-05-01 12:56:29 UTC
2
+++ src/objects.h
3
@@ -5573,7 +5573,7 @@ class Map: public HeapObject {
4
   static const int kElementsKindBitCount = 5;
5
 
6
   // Derived values from bit field 2
7
-  static const int kElementsKindMask = (-1 << kElementsKindShift) &
8
+  static const int kElementsKindMask = -(1 << kElementsKindShift) &
9
       ((1 << (kElementsKindShift + kElementsKindBitCount)) - 1);
10
   static const int8_t kMaximumBitField2FastElementValue = static_cast<int8_t>(
11
       (FAST_ELEMENTS + 1) << Map::kElementsKindShift) - 1;
12
@@ -7580,8 +7580,8 @@ class Name: public HeapObject {
13
   STATIC_CHECK(IS_POWER_OF_TWO(kMaxCachedArrayIndexLength + 1));
14
 
15
   static const int kContainsCachedArrayIndexMask =
16
-      (~kMaxCachedArrayIndexLength << kArrayIndexHashLengthShift) |
17
-      kIsNotArrayIndexMask;
18
+      (~static_cast<unsigned>(kMaxCachedArrayIndexLength) <<
19
+      kArrayIndexHashLengthShift) | kIsNotArrayIndexMask;
20
 
21
   // Value of empty hash field indicating that the hash is not computed.
22
   static const int kEmptyHashField =
(-)lang/v8/files/patch-src-x64-disasm-x64.cc (-11 lines)
Lines 1-11 Link Here
1
--- src/x64/disasm-x64.cc.orig	2013-05-01 12:56:28 UTC
2
+++ src/x64/disasm-x64.cc
3
@@ -1851,7 +1851,7 @@ void Disassembler::Disassemble(FILE* f, 
4
     buffer[0] = '\0';
5
     byte* prev_pc = pc;
6
     pc += d.InstructionDecode(buffer, pc);
7
-    fprintf(f, "%p", prev_pc);
8
+    fprintf(f, "%p", reinterpret_cast<void*>(prev_pc));
9
     fprintf(f, "    ");
10
 
11
     for (byte* bp = prev_pc; bp < pc; bp++) {
(-)lang/v8/files/patch-src-x64-ic-x64.cc (-12 lines)
Lines 1-12 Link Here
1
--- src/x64/ic-x64.cc.orig	2013-05-01 12:56:28 UTC
2
+++ src/x64/ic-x64.cc
3
@@ -1672,7 +1672,8 @@ void PatchInlinedSmiCode(Address address
4
   int8_t delta = *reinterpret_cast<int8_t*>(delta_address);
5
   if (FLAG_trace_ic) {
6
     PrintF("[  patching ic at %p, test=%p, delta=%d\n",
7
-           address, test_instruction_address, delta);
8
+           reinterpret_cast<void*>(address),
9
+           reinterpret_cast<void*>(test_instruction_address), delta);
10
   }
11
 
12
   // Patch with a short conditional jump. Enabling means switching from a short
(-)lang/v8/files/patch-src_d8_d8-posix.cc (+19 lines)
Line 0 Link Here
1
--- src/d8/d8-posix.cc.orig	2020-06-13 18:02:18 UTC
2
+++ src/d8/d8-posix.cc
3
@@ -4,6 +4,8 @@
4
 
5
 #include <errno.h>
6
 #include <fcntl.h>
7
+#include <sys/types.h>
8
+#include <netinet/in.h>
9
 #include <netinet/ip.h>
10
 #include <signal.h>
11
 #include <stdlib.h>
12
@@ -12,7 +14,6 @@
13
 #include <sys/socket.h>
14
 #include <sys/stat.h>
15
 #include <sys/time.h>
16
-#include <sys/types.h>
17
 #include <sys/wait.h>
18
 #include <unistd.h>
19
 
(-)lang/v8/files/patch-v8_BUILD.gn (+32 lines)
Line 0 Link Here
1
--- BUILD.gn.orig	2020-05-13 18:41:59 UTC
2
+++ BUILD.gn
3
@@ -3742,7 +3742,7 @@ v8_component("v8_libbase") {
4
     }
5
   }
6
 
7
-  if (is_linux) {
8
+  if (is_linux && !is_bsd) {
9
     sources += [
10
       "src/base/debug/stack_trace_posix.cc",
11
       "src/base/platform/platform-linux.cc",
12
@@ -3762,6 +3762,12 @@ v8_component("v8_libbase") {
13
       "dl",
14
       "rt",
15
     ]
16
+  } else if (is_bsd) {
17
+    sources += [
18
+      "src/base/debug/stack_trace_posix.cc",
19
+      "src/base/platform/platform-freebsd.cc",
20
+    ]
21
+    libs = [ "rt", "execinfo" ]
22
   } else if (is_android) {
23
     if (current_toolchain == host_toolchain) {
24
       libs = [
25
@@ -4064,6 +4070,7 @@ if (current_toolchain == v8_snapshot_toolchain) {
26
       "src/snapshot/mksnapshot.cc",
27
       "src/snapshot/snapshot-empty.cc",
28
     ]
29
+    libs = ["execinfo"]
30
 
31
     configs = [ ":internal_config" ]
32
 
(-)lang/v8/files/patch-v8_include_v8config.h (+21 lines)
Line 0 Link Here
1
--- include/v8config.h.orig	2020-03-03 18:55:34 UTC
2
+++ include/v8config.h
3
@@ -273,7 +273,18 @@
4
 # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \
5
     (__has_attribute(warn_unused_result))
6
 
7
+// Work around Clang bug present in 9.0.1, at least.
8
+//
9
+// Clang stores alignment as a 32-bit unsigned integer, but V8 only uses
10
+// V8_ASSUME_ALIGNED() for a 4GB (2^32) alignment
11
+// (kPtrComprIsolateRootAlignment).  As such, the alignment overflows and
12
+// becomes zero, triggering an internal Clang assertion that alignment must not
13
+// be zero.
14
+#if 0
15
 # define V8_HAS_BUILTIN_ASSUME_ALIGNED (__has_builtin(__builtin_assume_aligned))
16
+#else
17
+# define V8_HAS_BUILTIN_ASSUME_ALIGNED 0
18
+#endif
19
 # define V8_HAS_BUILTIN_BSWAP16 (__has_builtin(__builtin_bswap16))
20
 # define V8_HAS_BUILTIN_BSWAP32 (__has_builtin(__builtin_bswap32))
21
 # define V8_HAS_BUILTIN_BSWAP64 (__has_builtin(__builtin_bswap64))
(-)lang/v8/files/patch-v8_src_api_api.cc (+11 lines)
Line 0 Link Here
1
--- src/api/api.cc.orig	2020-05-13 18:41:59 UTC
2
+++ src/api/api.cc
3
@@ -5726,7 +5726,7 @@ bool v8::V8::Initialize() {
4
   return true;
5
 }
6
 
7
-#if V8_OS_LINUX || V8_OS_MACOSX
8
+#if V8_OS_LINUX || V8_OS_MACOSX || V8_OS_OPENBSD || V8_OS_FREEBSD
9
 bool TryHandleWebAssemblyTrapPosix(int sig_code, siginfo_t* info,
10
                                    void* context) {
11
 #if V8_TARGET_ARCH_X64 && !V8_OS_ANDROID
(-)lang/v8/files/patch-v8_src_base_cpu.cc (+18 lines)
Line 0 Link Here
1
--- src/base/cpu.cc.orig	2020-05-13 18:41:59 UTC
2
+++ src/base/cpu.cc
3
@@ -427,6 +427,7 @@ CPU::CPU()
4
 
5
 #if V8_OS_LINUX
6
 
7
+#if V8_OS_LINUX
8
   CPUInfo cpu_info;
9
 
10
   // Extract implementor from the "CPU implementer" field.
11
@@ -460,6 +461,7 @@ CPU::CPU()
12
     }
13
     delete[] part;
14
   }
15
+#endif
16
 
17
   // Extract architecture from the "CPU Architecture" field.
18
   // The list is well-known, unlike the the output of
(-)lang/v8/files/patch-v8_src_base_platform_platform-freebsd.cc (+13 lines)
Line 0 Link Here
1
--- src/base/platform/platform-freebsd.cc.orig	2020-05-13 18:41:59 UTC
2
+++ src/base/platform/platform-freebsd.cc
3
@@ -81,8 +82,8 @@ std::vector<OS::SharedLibraryAddress> OS::GetSharedLib
4
             lib_name = std::string(path);
5
           }
6
           result.push_back(SharedLibraryAddress(
7
-              lib_name, reinterpret_cast<uintptr_t>(map->kve_start),
8
-              reinterpret_cast<uintptr_t>(map->kve_end)));
9
+              lib_name, static_cast<uintptr_t>(map->kve_start),
10
+              static_cast<uintptr_t>(map->kve_end)));
11
         }
12
 
13
         start += ssize;
(-)lang/v8/files/patch-v8_src_base_platform_platform-posix.cc (+24 lines)
Line 0 Link Here
1
--- src/base/platform/platform-posix.cc.orig	2020-05-13 18:41:59 UTC
2
+++ src/base/platform/platform-posix.cc
3
@@ -433,7 +433,7 @@ bool OS::DiscardSystemPages(void* address, size_t size
4
 
5
 // static
6
 bool OS::HasLazyCommits() {
7
-#if V8_OS_AIX || V8_OS_LINUX || V8_OS_MACOSX
8
+#if V8_OS_AIX || V8_OS_LINUX || V8_OS_MACOSX || V8_OS_FREEBSD
9
   return true;
10
 #else
11
   // TODO(bbudge) Return true for all POSIX platforms.
12
@@ -564,6 +564,12 @@ int OS::GetCurrentThreadId() {
13
   return static_cast<int>(syscall(__NR_gettid));
14
 #elif V8_OS_ANDROID
15
   return static_cast<int>(gettid());
16
+#elif V8_OS_DRAGONFLYBSD || defined(__DragonFly__)
17
+  return static_cast<int>(lwp_gettid());
18
+#elif V8_OS_FREEBSD
19
+  return static_cast<int>(pthread_getthreadid_np());
20
+#elif V8_OS_NETBSD
21
+  return static_cast<int>(_lwp_self());
22
 #elif V8_OS_AIX
23
   return static_cast<int>(thread_self());
24
 #elif V8_OS_FUCHSIA
(-)lang/v8/files/v8.pc (+11 lines)
Line 0 Link Here
1
prefix=%%PREFIX%%
2
exec_prefix=${prefix}
3
libdir=${prefix}/lib
4
includedir=${prefix}/include
5
6
Name: v8
7
Description: V8 JavaScript Engine
8
Version: @VERSION@
9
Requires: icu-uc, icu-i18n, v8_libbase = @VERSION@
10
Libs: -L${libdir} -lv8 -pthread
11
Cflags: -I${includedir}
(-)lang/v8/files/v8_libbase.pc (+10 lines)
Line 0 Link Here
1
prefixr=%%PREFIX%%
2
exec_prefix=${prefix}
3
libdir=${prefix}/lib
4
includedir=${prefix}/include
5
6
Name: v8
7
Description: V8 JavaScript Engine - Base library
8
Version: @VERSION@
9
Libs: -L${libdir} -lv8_libbase
10
Cflags: -I${includedir}
(-)lang/v8/files/v8_libplatform.pc (+10 lines)
Line 0 Link Here
1
prefix=%%PREFIX%%
2
exec_prefix=${prefix}
3
libdir=${prefix}/lib
4
includedir=${prefix}/include
5
6
Name: v8
7
Description: V8 JavaScript Engine - Platform library
8
Version: @VERSION@
9
Libs: -L${libdir} -lv8_libplatform -pthread
10
Cflags: -I${includedir}
(-)lang/v8/pkg-descr (-12 / +5 lines)
Lines 1-14 Link Here
1
V8 is Google's open source JavaScript engine.
1
V8 is Google's open source high-performance JavaScript and WebAssembly engine,
2
2
written in C++. It is used in Chrome and in Node.js, among others.
3
V8 is written in C++ and is used in Google Chrome, the open source browser from
3
It implements ECMAScript and WebAssembly, and runs on Windows 7 or later,
4
Google.
4
macOS 10.12+, and Linux systems that use x64, IA-32, ARM, or MIPS processors.
5
6
V8 implements ECMAScript as specified in ECMA-262, 5th edition, and runs on
7
Windows (XP or newer), Mac OS X (10.5 or newer), and Linux systems that use
8
IA-32, x64, or ARM processors.
9
10
V8 can run standalone, or can be embedded into any C++ application.
5
V8 can run standalone, or can be embedded into any C++ application.
11
6
12
Git repository at https://github.com/v8/v8
7
WWW: https://v8.dev/
13
14
WWW: http://code.google.com/p/v8/
(-)lang/v8/pkg-plist (-5 / +20 lines)
Lines 1-9 Link Here
1
bin/d8
1
bin/d8
2
include/v8-debug.h
2
include/libplatform/libplatform-export.h
3
include/v8-preparser.h
3
include/libplatform/libplatform.h
4
include/libplatform/v8-tracing.h
5
include/v8-fast-api-calls.h
6
include/v8-inspector-protocol.h
7
include/v8-inspector.h
8
include/v8-internal.h
9
include/v8-platform.h
4
include/v8-profiler.h
10
include/v8-profiler.h
5
include/v8-testing.h
11
include/v8-util.h
12
include/v8-value-serializer-version.h
13
include/v8-version-string.h
14
include/v8-version.h
15
include/v8-wasm-trap-handler-posix.h
16
include/v8-wasm-trap-handler-win.h
6
include/v8.h
17
include/v8.h
7
include/v8stdint.h
18
include/v8config.h
8
lib/libv8.so
19
lib/libv8.so
9
lib/libv8.so.1
20
lib/libv8_libbase.so
21
lib/libv8_libplatform.so
22
libdata/pkgconfig/v8_libbase.pc
23
libdata/pkgconfig/v8_libplatform.pc
24
libdata/pkgconfig/v8.pc

Return to bug 213202