Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Explicitly define used NIF symbols (#792)
We ran into an issue with the new Xcode version 14 command line tools, version 2395. The linker gave a warning about `dynamic_lookup` not working with chained fixups, a thing that is now enabled by default on the command line tools looks like. ``` ld: warning: -undefined dynamic_lookup may not work with chained fixups ``` It looks like we can't use `dynamic_lookup`. Instead define a list ourselves of all the symbols we use in the `c_src/appsignal_extension.c` file. That way we tell the linker to ignore the undefined symbols, and have them be looked up at runtime when the Elixir NIF library is loaded. Every time we call another NIF function defined in `erl_nif.h` we need to update this list. ## ld documentation changes between Xcode versions that broke Xcode Version 13.4.1 (13F100), from macOS 12.5: ``` $ man ld -undefined treatment Specifies how undefined symbols are to be treated. Options are: error, warning, suppress, or dynamic_lookup. The default is error. ``` New Xcode Version 14.0 (14A309), from macOS 12.6: ``` $ man ld -undefined treatment Specifies how undefined symbols are to be treated. Options are: error, warning, suppress, or dynamic_lookup. The default is error. Note: dynamic_lookup that depends on lazy binding will not work with chained fixups. -U symbol_name Specified that it is ok for symbol_name to have no definition. With -two_levelnamespace, the resulting symbol will be marked dynamic_lookup which means dyld will search all loaded images. ``` Closes #790 Co-authored-by: Jeff Kreeftmeijer <jeffkreeftmeijer@gmail.com> Co-authored-by: Jeff Kreeftmeijer <jeffkreeftmeijer@gmail.com>
- Loading branch information