Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

Commit 5926526

Browse files
author
Julien Gilli
committed
src: make build pass with GCC < 4.5
Building node with GCC > 4.4 on CentOS makes the node binary depend on a more recent version of the C/C++ runtime that is not installed by default on these older CentOS platforms, and probably on other platforms as well. Building node with the default gcc and g++ compilers that come with these older versions of CentOS allows to ship a node binary that runs out of the box on these setups with older C/C++ runtimes. This change works around a bug that was fixed in GCC 4.5. Versions of GCC < 4.5 would not support using the injected-class-name of a template base class as a type name. This change also disables aliasing optimizations for toolchains using GCC <= 4.4 as they're not able to deal with the aliasing in the queue implementation used by libuv and node (see src/queue.h). Fixes #9079. PR: #9098 PR-URL: #9098 Reviewed-By: Timothy J Fontaine <[email protected]> Reviewed-By: Trevor Norris <[email protected]>
1 parent bcff90e commit 5926526

File tree

9 files changed

+34
-8
lines changed

9 files changed

+34
-8
lines changed

deps/debugger-agent/debugger-agent.gyp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@
1717
"include",
1818
],
1919
},
20+
'conditions': [
21+
[ 'gcc_version<=44', {
22+
# GCC versions <= 4.4 do not handle the aliasing in the queue
23+
# implementation, so disable aliasing on these platforms
24+
# to avoid subtle bugs
25+
'cflags': [ '-fno-strict-aliasing' ],
26+
}],
27+
],
2028
"sources": [
2129
"src/agent.cc",
2230
],

deps/uv/uv.gyp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@
8484
'src/version.c'
8585
],
8686
'conditions': [
87+
[ 'gcc_version<=44', {
88+
# GCC versions <= 4.4 do not handle the aliasing in the queue
89+
# implementation, so disable aliasing on these platforms
90+
# to avoid subtle bugs
91+
'cflags': [ '-fno-strict-aliasing' ],
92+
}],
8793
[ 'OS=="win"', {
8894
'defines': [
8995
'_WIN32_WINNT=0x0600',

node.gyp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,12 @@
168168
],
169169

170170
'conditions': [
171+
[ 'gcc_version<=44', {
172+
# GCC versions <= 4.4 do not handle the aliasing in the queue
173+
# implementation, so disable aliasing on these platforms
174+
# to avoid subtle bugs
175+
'cflags': [ '-fno-strict-aliasing' ],
176+
}],
171177
[ 'v8_enable_i18n_support==1', {
172178
'defines': [ 'NODE_HAVE_I18N_SUPPORT=1' ],
173179
'dependencies': [

src/cares_wrap.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ class GetAddrInfoReqWrap : public ReqWrap<uv_getaddrinfo_t> {
7373

7474
GetAddrInfoReqWrap::GetAddrInfoReqWrap(Environment* env,
7575
Local<Object> req_wrap_obj)
76-
: ReqWrap(env, req_wrap_obj, AsyncWrap::PROVIDER_GETADDRINFOREQWRAP) {
76+
: ReqWrap<uv_getaddrinfo_t>(env,
77+
req_wrap_obj,
78+
AsyncWrap::PROVIDER_GETADDRINFOREQWRAP) {
7779
Wrap(req_wrap_obj, this);
7880
}
7981

@@ -90,7 +92,9 @@ class GetNameInfoReqWrap : public ReqWrap<uv_getnameinfo_t> {
9092

9193
GetNameInfoReqWrap::GetNameInfoReqWrap(Environment* env,
9294
Local<Object> req_wrap_obj)
93-
: ReqWrap(env, req_wrap_obj, AsyncWrap::PROVIDER_GETNAMEINFOREQWRAP) {
95+
: ReqWrap<uv_getnameinfo_t>(env,
96+
req_wrap_obj,
97+
AsyncWrap::PROVIDER_GETNAMEINFOREQWRAP) {
9498
Wrap(req_wrap_obj, this);
9599
}
96100

src/node_file.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class FSReqWrap: public ReqWrap<uv_fs_t> {
7575
Local<Object> req,
7676
const char* syscall,
7777
char* data = NULL)
78-
: ReqWrap(env, req, AsyncWrap::PROVIDER_FSREQWRAP),
78+
: ReqWrap<uv_fs_t>(env, req, AsyncWrap::PROVIDER_FSREQWRAP),
7979
syscall_(syscall),
8080
data_(data),
8181
dest_len_(0) {

src/pipe_wrap.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class PipeConnectWrap : public ReqWrap<uv_connect_t> {
6161

6262

6363
PipeConnectWrap::PipeConnectWrap(Environment* env, Local<Object> req_wrap_obj)
64-
: ReqWrap(env, req_wrap_obj, AsyncWrap::PROVIDER_PIPEWRAP) {
64+
: ReqWrap<uv_connect_t>(env, req_wrap_obj, AsyncWrap::PROVIDER_PIPEWRAP) {
6565
Wrap(req_wrap_obj, this);
6666
}
6767

src/stream_wrap.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ class StreamWrap;
3636
class ShutdownWrap : public ReqWrap<uv_shutdown_t> {
3737
public:
3838
ShutdownWrap(Environment* env, v8::Local<v8::Object> req_wrap_obj)
39-
: ReqWrap(env, req_wrap_obj, AsyncWrap::PROVIDER_SHUTDOWNWRAP) {
39+
: ReqWrap<uv_shutdown_t>(env,
40+
req_wrap_obj,
41+
AsyncWrap::PROVIDER_SHUTDOWNWRAP) {
4042
Wrap(req_wrap_obj, this);
4143
}
4244

@@ -50,7 +52,7 @@ class WriteWrap: public ReqWrap<uv_write_t> {
5052
// TODO(trevnorris): WrapWrap inherits from ReqWrap, which I've globbed
5153
// into the same provider. How should these be broken apart?
5254
WriteWrap(Environment* env, v8::Local<v8::Object> obj, StreamWrap* wrap)
53-
: ReqWrap(env, obj, AsyncWrap::PROVIDER_WRITEWRAP),
55+
: ReqWrap<uv_write_t>(env, obj, AsyncWrap::PROVIDER_WRITEWRAP),
5456
wrap_(wrap) {
5557
Wrap(obj, this);
5658
}

src/tcp_wrap.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class TCPConnectWrap : public ReqWrap<uv_connect_t> {
6161

6262

6363
TCPConnectWrap::TCPConnectWrap(Environment* env, Local<Object> req_wrap_obj)
64-
: ReqWrap(env, req_wrap_obj, AsyncWrap::PROVIDER_TCPWRAP) {
64+
: ReqWrap<uv_connect_t>(env, req_wrap_obj, AsyncWrap::PROVIDER_TCPWRAP) {
6565
Wrap(req_wrap_obj, this);
6666
}
6767

src/udp_wrap.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class SendWrap : public ReqWrap<uv_udp_send_t> {
6464
SendWrap::SendWrap(Environment* env,
6565
Local<Object> req_wrap_obj,
6666
bool have_callback)
67-
: ReqWrap(env, req_wrap_obj, AsyncWrap::PROVIDER_UDPWRAP),
67+
: ReqWrap<uv_udp_send_t>(env, req_wrap_obj, AsyncWrap::PROVIDER_UDPWRAP),
6868
have_callback_(have_callback) {
6969
Wrap(req_wrap_obj, this);
7070
}

0 commit comments

Comments
 (0)