BUILD: debug: mark the __start_mem_stats/__stop_mem_stats symbols as weak
Building with clang and DEBUG_MEM_STATS shows the following warnings: warning: __start_mem_stats changed binding to STB_WEAK [-Wsource-mgr] warning: __stop_mem_stats changed binding to STB_WEAK [-Wsource-mgr] The reason is that the symbols are declared using ".globl" while they are also referenced as __attribute__((weak)) elsewhere. It turns out that a weak symbol is implicitly a global one and that the two classes are exclusive, thus it may confuse the linker. Better fix this. This may be backported where the patch applies.
This commit is contained in:
parent
bc964bd1ae
commit
b12966af10
|
@ -234,8 +234,8 @@ struct mem_stats {
|
||||||
.file = __FILE__, .line = __LINE__, \
|
.file = __FILE__, .line = __LINE__, \
|
||||||
.type = MEM_STATS_TYPE_CALLOC, \
|
.type = MEM_STATS_TYPE_CALLOC, \
|
||||||
}; \
|
}; \
|
||||||
__asm__(".globl __start_mem_stats"); \
|
__asm__(".weak __start_mem_stats"); \
|
||||||
__asm__(".globl __stop_mem_stats"); \
|
__asm__(".weak __stop_mem_stats"); \
|
||||||
_HA_ATOMIC_INC(&_.calls); \
|
_HA_ATOMIC_INC(&_.calls); \
|
||||||
_HA_ATOMIC_ADD(&_.size, __x * __y); \
|
_HA_ATOMIC_ADD(&_.size, __x * __y); \
|
||||||
calloc(__x,__y); \
|
calloc(__x,__y); \
|
||||||
|
@ -251,8 +251,8 @@ struct mem_stats {
|
||||||
.file = __FILE__, .line = __LINE__, \
|
.file = __FILE__, .line = __LINE__, \
|
||||||
.type = MEM_STATS_TYPE_FREE, \
|
.type = MEM_STATS_TYPE_FREE, \
|
||||||
}; \
|
}; \
|
||||||
__asm__(".globl __start_mem_stats"); \
|
__asm__(".weak __start_mem_stats"); \
|
||||||
__asm__(".globl __stop_mem_stats"); \
|
__asm__(".weak __stop_mem_stats"); \
|
||||||
if (__x) \
|
if (__x) \
|
||||||
_HA_ATOMIC_INC(&_.calls); \
|
_HA_ATOMIC_INC(&_.calls); \
|
||||||
free(__x); \
|
free(__x); \
|
||||||
|
@ -265,8 +265,8 @@ struct mem_stats {
|
||||||
.file = __FILE__, .line = __LINE__, \
|
.file = __FILE__, .line = __LINE__, \
|
||||||
.type = MEM_STATS_TYPE_FREE, \
|
.type = MEM_STATS_TYPE_FREE, \
|
||||||
}; \
|
}; \
|
||||||
__asm__(".globl __start_mem_stats"); \
|
__asm__(".weak __start_mem_stats"); \
|
||||||
__asm__(".globl __stop_mem_stats"); \
|
__asm__(".weak __stop_mem_stats"); \
|
||||||
if (__builtin_constant_p((x)) || __builtin_constant_p(*(x))) { \
|
if (__builtin_constant_p((x)) || __builtin_constant_p(*(x))) { \
|
||||||
HA_LINK_ERROR(call_to_ha_free_attempts_to_free_a_constant); \
|
HA_LINK_ERROR(call_to_ha_free_attempts_to_free_a_constant); \
|
||||||
} \
|
} \
|
||||||
|
@ -283,8 +283,8 @@ struct mem_stats {
|
||||||
.file = __FILE__, .line = __LINE__, \
|
.file = __FILE__, .line = __LINE__, \
|
||||||
.type = MEM_STATS_TYPE_MALLOC, \
|
.type = MEM_STATS_TYPE_MALLOC, \
|
||||||
}; \
|
}; \
|
||||||
__asm__(".globl __start_mem_stats"); \
|
__asm__(".weak __start_mem_stats"); \
|
||||||
__asm__(".globl __stop_mem_stats"); \
|
__asm__(".weak __stop_mem_stats"); \
|
||||||
_HA_ATOMIC_INC(&_.calls); \
|
_HA_ATOMIC_INC(&_.calls); \
|
||||||
_HA_ATOMIC_ADD(&_.size, __x); \
|
_HA_ATOMIC_ADD(&_.size, __x); \
|
||||||
malloc(__x); \
|
malloc(__x); \
|
||||||
|
@ -297,8 +297,8 @@ struct mem_stats {
|
||||||
.file = __FILE__, .line = __LINE__, \
|
.file = __FILE__, .line = __LINE__, \
|
||||||
.type = MEM_STATS_TYPE_REALLOC, \
|
.type = MEM_STATS_TYPE_REALLOC, \
|
||||||
}; \
|
}; \
|
||||||
__asm__(".globl __start_mem_stats"); \
|
__asm__(".weak __start_mem_stats"); \
|
||||||
__asm__(".globl __stop_mem_stats"); \
|
__asm__(".weak __stop_mem_stats"); \
|
||||||
_HA_ATOMIC_INC(&_.calls); \
|
_HA_ATOMIC_INC(&_.calls); \
|
||||||
_HA_ATOMIC_ADD(&_.size, __y); \
|
_HA_ATOMIC_ADD(&_.size, __y); \
|
||||||
realloc(__x,__y); \
|
realloc(__x,__y); \
|
||||||
|
@ -311,8 +311,8 @@ struct mem_stats {
|
||||||
.file = __FILE__, .line = __LINE__, \
|
.file = __FILE__, .line = __LINE__, \
|
||||||
.type = MEM_STATS_TYPE_STRDUP, \
|
.type = MEM_STATS_TYPE_STRDUP, \
|
||||||
}; \
|
}; \
|
||||||
__asm__(".globl __start_mem_stats"); \
|
__asm__(".weak __start_mem_stats"); \
|
||||||
__asm__(".globl __stop_mem_stats"); \
|
__asm__(".weak __stop_mem_stats"); \
|
||||||
_HA_ATOMIC_INC(&_.calls); \
|
_HA_ATOMIC_INC(&_.calls); \
|
||||||
_HA_ATOMIC_ADD(&_.size, __y); \
|
_HA_ATOMIC_ADD(&_.size, __y); \
|
||||||
strdup(__x); \
|
strdup(__x); \
|
||||||
|
|
Loading…
Reference in New Issue