Skip to content

Commit 09c7d9b

Browse files
Hide non-exported symbols in the Linux and Android engines
1 parent 7c6cf1d commit 09c7d9b

File tree

5 files changed

+26
-14
lines changed

5 files changed

+26
-14
lines changed

config/android-settings.gypi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
'-Wall',
55
'-Wextra',
66
'-fstrict-aliasing',
7+
'-fvisibility=hidden',
78
],
89

910
'cflags_c':

config/linux-settings.gypi

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,6 @@
2525
'../thirdparty/libfreetype/include', # Required by the Pango headers
2626
],
2727

28-
# Disable exceptions and RTTI, except where needed
29-
'cflags_cc':
30-
[
31-
'-fno-exceptions',
32-
'-fno-rtti',
33-
],
34-
3528
# Static libraries that are to be included into dynamic libraries
3629
# need to be compiled with the correct compilation flags
3730
'target_conditions':
@@ -74,6 +67,7 @@
7467
'-Wall',
7568
'-Wextra',
7669
'-fstrict-aliasing',
70+
'-fvisibility=hidden',
7771
],
7872

7973
'cflags_c':

engine/engine.gyp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,20 @@
1010
'kernel-server.gypi',
1111
],
1212

13+
'target_defaults':
14+
{
15+
'conditions':
16+
[
17+
[
18+
'OS == "linux" or OS == "android"',
19+
{
20+
# Ensure that the symbols LCB binds to are exported from the engine
21+
'ldflags': [ '-rdynamic' ],
22+
},
23+
],
24+
],
25+
},
26+
1327
'targets':
1428
[
1529
{

toolchain/lc-compile/lc-run.gyp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@
5757
],
5858
},
5959
],
60+
[
61+
'OS == "linux" or OS == "android"',
62+
{
63+
# Ensure that the symbols LCB binds to are exported
64+
'ldflags': [ '-rdynamic' ],
65+
},
66+
],
6067
],
6168

6269
'actions':

tools/extract-debug-symbols.sh

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,9 @@ for input in $@ ; do
1919
# Extract a copy of the debugging information
2020
$OBJCOPY --only-keep-debug "$input" "$output"
2121

22-
# If this file is a dynamic library, don't do a full strip or we'll
23-
# destroy it (no symbols => can't link to it)
24-
if [[ "$($OBJDUMP -f $input)" =~ "DYNAMIC" ]] ; then
25-
$STRIP -x --preserve-dates --strip-debug "$input"
26-
else
27-
$STRIP -x --preserve-dates --strip-debug --strip-unneeded "$input"
28-
fi
22+
# Because we export symbols from the engine, only debug symbols
23+
# should be stripped.
24+
$STRIP -x --preserve-dates --strip-debug "$input"
2925

3026
# Add a hint for the debugger so it can find the debug info
3127
$OBJCOPY --preserve-dates --remove-section=.gnu_debuglink "$input"

0 commit comments

Comments
 (0)