BUILD: compiler: use a more portable set of asm(".weak") statements

The two recent patches b12966af1 ("BUILD: debug: mark the
__start_mem_stats/__stop_mem_stats symbols as weak") and 2a06e248f
("BUILD: initcall: mark the __start_i_* symbols as weak, not global")
aimed at fixing a build warning and resulted in a build breakage on
MacOS which doesn't have a ".weak" asm statement.

We've already had MacOS-specific asm() statements for section names, so
this patch continues on this trend by moving HA_GLOBL() to compiler.h
and using ".globl" on MacOS since apparently nobody complains there.

It is debatable whether to expose this only when !USE_OBSOLETE_LINKER
or all the time, but since these are just macroes it's no big deal to
let them be available when needed and let the caller decide on the
build conditions.

If any of the patches above is backported, this one will need to as
well.

(cherry picked from commit fb1b6f5bc0e8eac116e2cafe8716a7f16d95b58e)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit fdefe250f6db2406214e11a086a6219086f938ce)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
3 files changed