Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 618190 - dev-cpp/glog: please rename unwind USE flag to libunwind
Summary: dev-cpp/glog: please rename unwind USE flag to libunwind
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All All
: Normal enhancement (vote)
Assignee: Arfrever Frehtes Taifersar Arahesis
URL: https://archives.gentoo.org/gentoo-de...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-11 11:04 UTC by Chí-Thanh Christopher Nguyễn
Modified: 2021-04-02 15:00 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chí-Thanh Christopher Nguyễn gentoo-dev 2017-05-11 11:04:43 UTC
Per discussion on gentoo-dev, sys-libs/glog uses the "unwind" USE flag differently from other packages, and more in line with the "libunwind" flag from sys-libs/libcxx et al.

Please consider renaming the flag to libunwind.
Comment 1 Arfrever Frehtes Taifersar Arahesis 2020-01-13 11:00:53 UTC
Currently:


profiles/use.desc:
unwind - Add support for call stack unwinding and function name resolution


dev-cpp/glog/metadata.xml:
<flag name="unwind">Use <pkg>sys-libs/libunwind</pkg> for stack unwinding instead of glibc/gcc (may be more reliable on x86_64)</flag>


GLog src/utilities.h:
https://github.com/google/glog/blob/9630e0e848da22e27b346c38d9b05f0a16cbf7b3/src/utilities.h#L86-L128
[[[
// There are three different ways we can try to get the stack trace:
//
// 1) The libunwind library.  This is still in development, and as a
//    separate library adds a new dependency, but doesn't need a frame
//    pointer.  It also doesn't call malloc.
//
// 2) Our hand-coded stack-unwinder.  This depends on a certain stack
//    layout, which is used by gcc (and those systems using a
//    gcc-compatible ABI) on x86 systems, at least since gcc 2.95.
//    It uses the frame pointer to do its work.
//
// 3) The gdb unwinder -- also the one used by the c++ exception code.
//    It's obviously well-tested, but has a fatal flaw: it can call
//    malloc() from the unwinder.  This is a problem because we're
//    trying to use the unwinder to instrument malloc().
//
// 4) The Windows API CaptureStackTrace.
...
#if defined(HAVE_LIB_UNWIND)
# define STACKTRACE_H "stacktrace_libunwind-inl.h"
#elif !defined(NO_FRAME_POINTER)
# if defined(__i386__) && __GNUC__ >= 2
#  define STACKTRACE_H "stacktrace_x86-inl.h"
# elif defined(__x86_64__) && __GNUC__ >= 2 && HAVE_UNWIND_H
#  define STACKTRACE_H "stacktrace_x86_64-inl.h"
# elif (defined(__ppc__) || defined(__PPC__)) && __GNUC__ >= 2
#  define STACKTRACE_H "stacktrace_powerpc-inl.h"
# elif defined(OS_WINDOWS)
#  define STACKTRACE_H "stacktrace_windows-inl.h"
# endif
#endif

#if !defined(STACKTRACE_H) && defined(HAVE_EXECINFO_H)
# define STACKTRACE_H "stacktrace_generic-inl.h"
#endif
]]]
(HAVE_LIB_UNWIND is defined when libunwind is used.)


GLog src/stacktrace_libunwind-inl.h:
https://github.com/google/glog/blob/f581614a78c68da17700b039ea69c774c1c6b892/src/stacktrace_libunwind-inl.h
[[[
// Produce stack trace using libunwind
]]]


GLog src/stacktrace_x86-inl.h:
https://github.com/google/glog/blob/f278d734c1c02901631e04d1ac9099a4897ab75b/src/stacktrace_x86-inl.h
[[[
// Produce stack trace
]]]


GLog src/stacktrace_x86_64-inl.h (unwind.h required):
https://github.com/google/glog/blob/f365379532ad3c0d86fa1b52434392df256166b4/src/stacktrace_x86_64-inl.h
[[[
// Produce stack trace using libgcc
]]]


GLog src/stacktrace_generic-inl.h (execinfo.h required):
https://github.com/google/glog/blob/f365379532ad3c0d86fa1b52434392df256166b4/src/stacktrace_generic-inl.h
[[[
// Portable implementation - just use glibc
//
// Note:  The glibc implementation may cause a call to malloc.
// This can cause a deadlock in HeapProfiler.
]]]


sys-devel/clang and sys-devel/gcc provide unwind.h.


sys-libs/glibc provides execinfo.h.
sys-libs/musl (1.1.24) does not provide execinfo.h.
sys-libs/uclibc-ng provides execinfo.h.


So most architectures have non-libunwind fallback, but Musl ARM32/ARM64/MIPS/... have no fallback.
Comment 2 Larry the Git Cow gentoo-dev 2021-04-02 15:00:54 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a62ec2473825e637157e1dbfe9efe2d4a95d7c50

commit a62ec2473825e637157e1dbfe9efe2d4a95d7c50
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
AuthorDate: 2021-04-01 23:00:00 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2021-04-02 15:00:48 +0000

    dev-cpp/glog: Rename "unwind" USE flag to "libunwind". Enable it by default.
    
    Closes: https://bugs.gentoo.org/618190
    Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 dev-cpp/glog/glog-0.3.4-r1.ebuild | 8 ++++----
 dev-cpp/glog/metadata.xml         | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)