mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-11-28 22:31:06 +01:00
BUILD: tools: fix warning about incorrect cast with dladdr1()
dladdr1() is used on glibc and takes a void**, but we pass it a const ElfW(Sym)** and some compilers complain that we're aliasing. Let's just set a may_alias attribute on the local variable to address this. There's no need to backport this unless warnings are reported on older distros or uncommon compilers.
This commit is contained in:
parent
8f0b4e97e7
commit
f3d5c4b032
@ -4814,7 +4814,7 @@ static int dladdr_and_size(const void *addr, Dl_info *dli, size_t *size)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
#if defined(__GLIBC__) && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) // most detailed one
|
#if defined(__GLIBC__) && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) // most detailed one
|
||||||
const ElfW(Sym) *sym;
|
const ElfW(Sym) *sym __attribute__((may_alias));
|
||||||
|
|
||||||
ret = dladdr1(addr, dli, (void **)&sym, RTLD_DL_SYMENT);
|
ret = dladdr1(addr, dli, (void **)&sym, RTLD_DL_SYMENT);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user