Skip to content

Commit 0884f3e

Browse files
committed
build: add '-z relro -z now' linker flags
These flags could make some sections and the GOT entries of node process read only to avoid being modified after dynamic linking is done, thus the security could be enhanced. Fixes: nodejs#20122
1 parent cd8ed1c commit 0884f3e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

node.gypi

+4-1
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,10 @@
291291
[ 'OS=="sunos"', {
292292
'ldflags': [ '-Wl,-M,/usr/lib/ld/map.noexstk' ],
293293
}],
294-
294+
[ 'OS in "freebsd linux"', {
295+
'ldflags': [ '-Wl,-z,relro',
296+
'-Wl,-z,now' ]
297+
}],
295298
[ 'node_use_openssl=="true"', {
296299
'defines': [ 'HAVE_OPENSSL=1' ],
297300
'conditions': [

0 commit comments

Comments
 (0)