|
From: | Dave Watson |
Subject: | Re: build failure and warnings on aarch64 and redhat 7.x |
Date: | Thu, 2 Jul 2020 16:16:58 -0700 |
Hi, I found a data point where libunwind 1.5-stable doesn't build.
I started looking into this and I have a couple questions or suggestions.
These apply to both master and 1.5-stable.
(1) --enable-debug-frame doesn't build on RedHat 7.x because elf.h is
too old. I first noticed this on aarch64 where debug-frame is turned
on by default, but it applies anywhere with --enable-debug-frame and
RedHat 7.x.
The problem is /usr/include/elf.h is too old for libunwind 1.5 and
doesn't define SHF_COMPRESSED. The build fails with:
../../libunwind-1.5-rc1/src/dwarf/Gfind_proc_info-lsb.c:
In function 'load_debug_frame':
../../libunwind-1.5-rc1/src/dwarf/Gfind_proc_info-lsb.c:130:24:
error: 'SHF_COMPRESSED' undeclared (first use in this function)
if (shdr->sh_flags & SHF_COMPRESSED)
This fails on RedHat 7.x, but of course, the real problem is the
version of glibc, 2.17 on RH 7. But I haven't done the bisection to
identify the rev where this was added.
For my purposes (I've recently become the maintainer for the spack
libunwind package, github.com/spack/spack), I have an easy workaround.
I just require a recent elf headers as a prereq.
But I was thinking you might want to add a configure test (see if
SHF_COMPRESSED is defined in elf.h) and turn off debug-frame if not.
----------
(2) On aarch64, there is a spew of warnings over the asm definition of
unw_tdep_getcontext().
In file included from ../include/libunwind.h:7:0,
from mi/backtrace.c:29:
mi/backtrace.c: In function 'unw_backtrace':
../include/libunwind-aarch64.h:236:5: warning: right-hand operand of
comma _expression_ has no effect [-Wunused-value]
#define unw_tdep_getcontext(uc) (({ \
~~~~~~~~~
unw_tdep_context_t *unw_ctx = (uc); \
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
register uint64_t *unw_base __asm__ ("x0") = (uint64_t*)
unw_ctx->uc_mcontext.regs; \
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__asm__ __volatile__ ( \
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"stp x0, x1, [%[base], #0]\n" \
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"stp x2, x3, [%[base], #16]\n" \
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
"str x30, [%[base], #240]\n" \
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"mov x1, sp\n" \
~~~~~~~~~~~~~~~~
"stp x1, x30, [%[base], #248]\n" \
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: [base] "+r" (unw_base) : : "x1", "memory"); \
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
}), 0)
~~^~~~
../include/libunwind-common.h:127:29: note: in expansion of macro
'unw_tdep_getcontext'
#define unw_getcontext(uc) unw_tdep_getcontext(uc)
^~~~~~~~~~~~~~~~~~~
mi/backtrace.c:71:7: note: in expansion of macro 'unw_getcontext'
unw_getcontext (&uc);
^~~~~~~~~~~~~~
AFAICT, the warning is harmless, but the message is pretty verbose and
happens something like 5-6 times. So, anyone looking at the build
will stop and wonder.
It might be worthwhile to adjust the define to silence the warning.
Thanks,
--Mark
[Prev in Thread] | Current Thread | [Next in Thread] |