libdlog: initialise through attribute constructor
The previous implementation suffered from the double-checked locking
anti-pattern. It is possible for writes to be reordered either by the
compiler OR the hardware (for example armv7l does this), potentially
setting the initialisation flag before having actually initialized
the rest of the library, meaning a parallel thread could see the flag
and try to use uninitialised variables.
Using the constructor attribute solves this neatly since it is done
before any parallel threads can do anything; even runtime invocation
through `dlopen()` is safe since in that case other threads won't be
able to access the pointer to `dlog_print` before `dlopen()` returns,
by which time the constructor must have finished.
Change-Id: Ic55a6d6858dc2112efd67338894a0c44b876fee8
Signed-off-by: Michal Bloch <m.bloch@samsung.com>