-
I'm working on replacing our default linker with mold, and I ran into an interesting difference in behavior. I'm building a shared library with the standard combination of function bodies and PLT stubs. With ld, for a function foo, I get two symbols in the static symbol table - "foo" and "foo.localalias" (actually, it's c++, so "foo" is mangled - but it works for the example). Both of these point to the function body, and the PLT stub doesn't have a symbol associated with it. In the dynamic symbol table there is one symbol, "foo", that also points to the function body. With mold (version 1.0.1), I still have two symbols, but the static "foo" symbol points to the PLT stub instead of the function body. "foo.localalias" does point to the body, as does the dynamic symbol for "foo". As a result of this, utilities like objdump are harder to use, since the first thing you find is the PLT stub. With that said, two questions:
Thank you! Here's a code example. Using the default system linker, with a function called "ps_atom_get":
And using mold:
In case it helps, the mold linker is invoked as follows: gcc-9 -Wl,--as-needed -Wl,--gdb-index -Wl,--compress-debug-sections=zlib -ggdb -m64 -march=corei7 -mtune=corei7-avx -mpku -Wall -Wtype-limits -Wswitch-enum -ftls-model=initial-exec -fPIE -pie -fPIC -shared -Wl,--build-id -B/usr/libexec/mold -Wl,-hlibdefsD.so -o /build/src/bld_linux/purity/lib/libdefsD.so <.o files> |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
mold 1.0.1 is very old. I have fixed tons of subtle compatibility issues since releasing 1.0.1. Can you upgrade to the latest version of mold and try again? |
Beta Was this translation helpful? Give feedback.
-
Glad to hear that 1.2.1 worked for you. Since many bug fixes have been accumulated, I’ll probably release the next stable release this month. |
Beta Was this translation helpful? Give feedback.
mold 1.0.1 is very old. I have fixed tons of subtle compatibility issues since releasing 1.0.1. Can you upgrade to the latest version of mold and try again?