mold
mold copied to clipboard
macOS symbol definition priorities
I am trying to build BIND using mold-1.4.1 on macOS 12.5.1
I have mostly got it working, with some ugly hacks to the build system to persuade autotools to invoke mold in a manner that works. It's noticeably faster to build, yay!
But I have found a problem with the way mocks work in the test suite. For instance, there's a build command that's roughly
cc -Wall -g -O2 -pthread -o notify_test notify_test.o netmgr_wrap.o libisc.dylib libns.dylib -luv -lpthread
The function isc__nmhandle_attach() is defined in libisc (the real version) and in netmgr_wrap.o (the mock version). The code in notify_test.o calls ns_notify_start() (which is defined in libns) which in turn calls isc__nmhandle_attach().
When compiled with Apple ld on macOS (or GNU ld on Linux) the netmgr_wrap.o definition overrides the libisc definition (which is what I expect for traditional unix linker behaviour). With mold, libns calls isc__nmhandle_attach() in libisc instead of the mock version in netmgr_wrap.o
Thank you for your report!
That's not intentional. Symbols in object files are intended to overwrite symbols in shared object files. Let me take a look.