Adding the sanitizer flags to the PLUGIN_LDFLAGS fixes link errors
for the plugins when asan, tsan, or ubsan is enabled.
Adding the original LDFLAGS to PLUGIN_LDFLAGS means we no longer needs
to use both in the link command for plugins.
In commit dce6b012 we added the LDFLAGS, which were modified by the
configure script, to the linker stage of the plugins. Doing so turns
out not to work well for all system architectures.
This approach uses the unmodified LDFLAGS, stored in the SAVED_LDFLAGS
variable by the configure script, from the system environment for
linking dynamic plugins, which is very likely not to cause any harm.
Some distributions populate their build environment with special
linker flags, e.g. for hardening purposes such as immediate binding
and/or read-only relocations.
Those flags should be honored when linking dynamic libraries.
This should improve linker time as well as reduce the size of the
built binaries (though this does not affect runtime memory usage
since the debug segments are not loaded into memory except by a
debugger) whilst still giving debug information.
For some reason I cannot figure out how to enforce proper variable creation
in a generic way. I'll keep reading the docs but maybe someone else could
figure it out earlier