]> git.kaiwu.me - haproxy.git/commit
BUILD: compiler: properly distinguish weak and global symbols
authorWilly Tarreau <w@1wt.eu>
Tue, 26 Apr 2022 17:35:38 +0000 (19:35 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 26 Apr 2022 17:49:33 +0000 (19:49 +0200)
commit65d9f83794e00e136335348de531167f31d2f39b
tree049755b4479c19ab58ce40003554800dd57b213e
parent03a32e5dd2fa103fa259db343d97bd093544ef25
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).
include/haproxy/bug.h
include/haproxy/compiler.h