From a5fb87af8713a6c3678cf7546a2f682d9278f60e Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Wed, 28 Mar 2018 06:56:01 +0200 Subject: [PATCH] Hide symbols. Fixes #240. --- packages/grpc-native-core/binding.gyp | 3 +++ packages/grpc-native-core/templates/binding.gyp.template | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/grpc-native-core/binding.gyp b/packages/grpc-native-core/binding.gyp index aa4d4be6..8de8a228 100644 --- a/packages/grpc-native-core/binding.gyp +++ b/packages/grpc-native-core/binding.gyp @@ -64,6 +64,7 @@ '-Wno-unused-parameter', '-DOSATOMIC_USE_INLINED=1', '-Wno-deprecated-declarations', + '-fvisibility=hidden', ], 'ldflags': [ '-g', @@ -188,6 +189,7 @@ '-Wno-unused-parameter', '-DOSATOMIC_USE_INLINED=1', '-Wno-deprecated-declarations', + '-fvisibility=hidden', ], 'OTHER_CPLUSPLUSFLAGS': [ '-g', @@ -198,6 +200,7 @@ '-Wno-unused-parameter', '-DOSATOMIC_USE_INLINED=1', '-Wno-deprecated-declarations', + '-fvisibility=hidden', '-stdlib=libc++', '-std=c++11', '-Wno-error=deprecated-declarations' diff --git a/packages/grpc-native-core/templates/binding.gyp.template b/packages/grpc-native-core/templates/binding.gyp.template index e5eebfed..11eb8e60 100644 --- a/packages/grpc-native-core/templates/binding.gyp.template +++ b/packages/grpc-native-core/templates/binding.gyp.template @@ -58,7 +58,7 @@ % for arg, prop in [('CPPFLAGS', 'cflags'), ('LDFLAGS', 'ldflags')]: % if defaults['global'].get(arg, None) is not None: '${prop}': [ - % for item in defaults['global'].get(arg).split(): + % for item in defaults['global'].get(arg).split() + (['-fvisibility=hidden'] if arg == 'CPPFLAGS' else []): '${item}', % endfor ], @@ -169,12 +169,12 @@ 'xcode_settings': { % if defaults['global'].get('CPPFLAGS', None) is not None: 'OTHER_CFLAGS': [ - % for item in defaults['global'].get('CPPFLAGS').split(): + % for item in defaults['global'].get('CPPFLAGS').split() + ['-fvisibility=hidden']: '${item}', % endfor ], 'OTHER_CPLUSPLUSFLAGS': [ - % for item in defaults['global'].get('CPPFLAGS').split(): + % for item in defaults['global'].get('CPPFLAGS').split() + ['-fvisibility=hidden']: '${item}', % endfor '-stdlib=libc++',