Skip to content

Commit

Permalink
build: preserves symbols during LTO with macOS linker
Browse files Browse the repository at this point in the history
man ld -export_dynamic:

```
Preserves all global symbols in main executables during LTO.

Without this option, Link Time Optimization is allowed to inline
and remove global functions.

This option is used when a main executable may load a plug-in which
requires certain symbols from the main executable.
```

Bug: vercel/pkg#1155
Signed-off-by: Jesse Chan <[email protected]>

PR-URL: #39839
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
jesec authored and richardlau committed Sep 10, 2021
1 parent 97f3072 commit 22a78a7
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,19 @@
'OTHER_LDFLAGS': [ '-Wl,-rpath,@loader_path', ],
},
}],
[ 'enable_lto=="true"', {
'xcode_settings': {
'OTHER_LDFLAGS': [
# man ld -export_dynamic:
# Preserves all global symbols in main executables during LTO.
# Without this option, Link Time Optimization is allowed to
# inline and remove global functions. This option is used when
# a main executable may load a plug-in which requires certain
# symbols from the main executable.
'-Wl,-export_dynamic',
],
},
}],
['OS=="win"', {
'libraries': [
'Dbghelp.lib',
Expand Down

0 comments on commit 22a78a7

Please sign in to comment.