Skip to content

Commit 359352c

Browse files
Alex Hultmanaddaleax
Alex Hultman
authored andcommitted
build: export zlib symbols on Windows
Base the generated openssl.def on existing zlib.def. We cannot specify more than one DEF file per executable so we need to merge the two DEF files to expose both OpenSSL and Zlib functionality to addons. If OpenSSL is not used, link against zlib.def itself. PR-URL: nodejs#7983 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 8f90dcc commit 359352c

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

node.gyp

+7
Original file line numberDiff line numberDiff line change
@@ -370,9 +370,14 @@
370370
'-Wl,--no-whole-archive',
371371
],
372372
}],
373+
# openssl.def is based on zlib.def, zlib symbols
374+
# are always exported.
373375
['use_openssl_def==1', {
374376
'sources': ['<(SHARED_INTERMEDIATE_DIR)/openssl.def'],
375377
}],
378+
['OS=="win" and use_openssl_def==0', {
379+
'sources': ['deps/zlib/win32/zlib.def'],
380+
}],
376381
],
377382
}],
378383
],
@@ -568,6 +573,8 @@
568573
'-X^DSO',
569574
'-X^_',
570575
'-X^private_',
576+
# Base generated DEF on zlib.def
577+
'-Bdeps/zlib/win32/zlib.def'
571578
],
572579
},
573580
'conditions': [

tools/mkssldef.py

+9
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
categories = []
88
defines = []
99
excludes = []
10+
bases = []
1011

1112
if __name__ == '__main__':
1213
out = sys.stdout
@@ -18,6 +19,7 @@
1819
elif option.startswith('-C'): categories += option[2:].split(',')
1920
elif option.startswith('-D'): defines += option[2:].split(',')
2021
elif option.startswith('-X'): excludes += option[2:].split(',')
22+
elif option.startswith('-B'): bases += option[2:].split(',')
2123

2224
excludes = map(re.compile, excludes)
2325
exported = []
@@ -40,5 +42,12 @@ def test(expr):
4042
if not satisfy(meta[3], categories): continue
4143
exported.append(name)
4244

45+
for filename in bases:
46+
for line in open(filename).readlines():
47+
line = line.strip()
48+
if line == 'EXPORTS': continue
49+
if line[0] == ';': continue
50+
exported.append(line)
51+
4352
print('EXPORTS', file=out)
4453
for name in sorted(exported): print(' ', name, file=out)

0 commit comments

Comments
 (0)