Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 693252 - >=sys-devel/gcc-3.4.3 on IA64 should use system libunwind.so from sys-libs/libunwind, sys-libs/libunwind should install shared libraries for native ABI in /lib
Summary: >=sys-devel/gcc-3.4.3 on IA64 should use system libunwind.so from sys-libs/li...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: IA64 All
: Normal normal
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on: 693250
Blocks: bundled-libs
  Show dependency tree
 
Reported: 2019-09-01 02:18 UTC by Arfrever Frehtes Taifersar Arahesis
Modified: 2022-05-06 19:11 UTC (History)
5 users (show)

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


Attachments
Patch (gcc.patch,3.64 KB, patch)
2019-09-01 05:31 UTC, Arfrever Frehtes Taifersar Arahesis
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Arfrever Frehtes Taifersar Arahesis 2019-09-01 02:18:26 UTC
GCC >=3.4.3 supports --with-system-libunwind option:
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=8bdf23ae810238b3a11f4af286b4a3772fb7244f
Code was moved in:
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=e59be7e3775cce7a65bfac5c9aeb5f76d42f539b

--with-system-libunwind option has any effect only for ia64*-*-linux* targets.
--without-system-libunwind is default.


libgcc/config.host:
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libgcc/config.host;h=503ebb6be20cc2cd382fd5f8e21769acdb3e7d0c;hb=HEAD#l844
[[[
ia64*-*-linux*)
	# Don't use crtbeginT.o from *-*-linux* default.
	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o"
	tmake_file="$tmake_file ia64/t-ia64 ia64/t-ia64-elf t-crtfm t-softfp-tf ia64/t-softfp t-softfp ia64/t-softfp-compat ia64/t-eh-ia64 t-libunwind ia64/t-linux"
	if test x$with_system_libunwind != xyes ; then
		tmake_file="${tmake_file} t-libunwind-elf ia64/t-linux-libunwind"
	fi
	md_unwind_header=ia64/linux-unwind.h
	;;
]]]

libgcc/config/t-libunwind (used on ia64*-*-linux* always):
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libgcc/config/t-libunwind;h=5244928da3c6b06cd785daf88d48d65194e7920b;hb=HEAD

libgcc/config/t-libunwind-elf (used on ia64*-*-linux* only when building internal libunwind.so):
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libgcc/config/t-libunwind-elf;h=d07895bb6eb28e6c3c328d11bbc06b0d8ee64012;hb=HEAD


I suggest that:
  --with-system-libunwind be passed in GCC >=3.4.3 (on all architectures)
  Version-conditional dependency on "ia64? ( sys-libs/libunwind:0= )" be added


libgcc_s.so is linked against some version of libunwind.so.
gcc-config copies libgcc_s.so from active version of GCC to /lib, so, to avoid regression for users with /usr/lib on separate mountpoint than /lib, it will be necessary to change sys-libs/libunwind to install (with USE="split-usr") shared libraries to /lib instead of /usr/lib.
It could be done only on IA64, but for simplicity I suggest to do it on all architectures.


Changes in sys-libs/libunwind need to be co-ordinated with changes in gcc-config (bug #667020).
The oldest ebuild of sys-devel/gcc keyworded on IA64 is 3.4.6-r2, so there is no need to make gcc-config support old GCC with internal libunwind.so.
Comment 1 Arfrever Frehtes Taifersar Arahesis 2019-09-01 05:31:46 UTC
Created attachment 588620 [details, diff]
Patch

This patch applies after patch from bug #693250.

Before testing this patch, it is NECESSARY to apply patch for sys-devel/gcc-config from bug #667020.
Otherwise gcc-config would delete libunwind.so required by newly built GCC.
Comment 2 Larry the Git Cow gentoo-dev 2019-09-04 19:00:16 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=17c4c852f979668387b1b965d48470cb730df5b6

commit 17c4c852f979668387b1b965d48470cb730df5b6
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2019-09-04 18:59:31 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2019-09-04 18:59:31 +0000

    gcc-config: clarify why libunwind.so* is needed at all
    
    Bug: https://bugs.gentoo.org/667020
    Bug: https://bugs.gentoo.org/693252
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 gcc-config | 5 +++++
 1 file changed, 5 insertions(+)
Comment 3 Sergei Trofimovich (RETIRED) gentoo-dev 2019-09-10 19:33:34 UTC
At least
    # EXTRA_ECONF=--with-system-libunwind emerge -v1 gcc
yields gcc with desired properties.

libunwind gets into a fun state when it's a dependency of itself.

$ lddtree /usr/lib/libunwind.so.8
/usr/lib/libunwind.so.8 (interpreter => None)
    libc.so.6.1 => /lib/libc.so.6.1
        ld-linux-ia64.so.2 => /lib/ld-linux-ia64.so.2
    libgcc_s.so.1 => /usr/lib/gcc/ia64-unknown-linux-gnu/9.2.0/libgcc_s.so.1
        libunwind.so.8 => /usr/lib/libunwind.so.8
        libgcc_s.so.1 => !!! circular loop !!!

Which should be fine at least on glibc.

python and emerge still works to be able to fix the world. I did not notice any critical binaries or libraries in stage3.

The details are a bit messy: preserved-libs does not keep libunwind.so.7 and instantly breaks most (every?) c++ application like eix.

Full list of silently broken packages on a random ~arch chroot where a bunch of packages present:

# qfile $(fgrep -Rl libunwind.so.7 /usr/bin /usr/lib 2>/dev/null) | awk '{print $1}' | sort -u
app-arch/brotli:
app-crypt/gpgme:
app-misc/sphinx:
app-portage/eix:
app-text/hunspell:
app-text/openjade:
app-text/opensp:
app-text/poppler:
app-text/qpdf:
dev-lang/swig:
dev-libs/boehm-gc:
dev-libs/boost:
dev-libs/efl:
dev-libs/gmp:
dev-libs/icu:
dev-libs/libical:
dev-libs/libpcre:
dev-libs/libsass:
dev-libs/re2:
dev-python/subunit:
dev-util/cmake:
dev-util/colm:
dev-util/cppunit:
dev-util/gperf:
dev-util/ragel:
dev-util/re2c:
media-gfx/graphite2:
media-libs/flac:
media-libs/mesa:
media-libs/woff2:
net-libs/gnutls:
net-libs/libproxy:
net-libs/nghttp2:
net-libs/webkit-gtk:
net-print/cups:
sys-apps/groff:
sys-auth/polkit:
sys-libs/db:
sys-libs/ncurses:

Full list of to be broken packages on a real full stable ia64 system:

slyfox@guppy ~ $ qfile $(sudo fgrep -Rl libunwind.so.7 /bin /sbin /usr/bin /usr/sbin /lib /usr/lib 2>/dev/null) | awk '{print $1}' | sort -u

app-editors/emacs
app-portage/eix
dev-libs/gmp
dev-libs/libpcre
dev-util/cmake
dev-util/gperf
dev-util/ninja
dev-util/re2c
net-libs/gnutls
sys-apps/groff
sys-apps/smartmontools
sys-devel/gcc
sys-devel/gettext
sys-libs/db
sys-libs/ncurses