BUILD: compiler: properly distinguish weak and global symbols

While weak symbols were finally fixed with commit fb1b6f5bc ("BUILD:
compiler: use a more portable set of asm(".weak") statements"), it
was an error to think that initcall symbols were also weak. They must
not be and they're only global. The reason is that any externally
linked code loaded as a .so would drop its weak symbols when being
loaded, hence its initcalls that may contain various function
registration calls.

The ambiguity came from the fact that we initially reused the initcall's
HA_GLOBL macro for OSX then generalized it, then turned it to a choice
between .globl and .weak based on the OS, while in fact we needed a
macro to define weak symbols.

Let's rename the macro to HA_WEAK() to make it clear it's only for weak
symbols, and redefine HA_GLOBL() that initcall needs.

This will need to be backported wherever the commit above is backported
(at least 2.5 for now).

(cherry picked from commit 65d9f83794e00e136335348de531167f31d2f39b)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit 3bfee1e48e5bef4365240bab40b083a0dccbe653)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
2 files changed