Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 883451 - sys-libs/compiler-rt[clang] sys-libs/compiler-rt-sanitizers[clang] sys-libs/libcxx[clang] sys-libs/libcxxabi[clang] sys-libs/llvm-libunwind[clang] strips -unwindlib=libunwind
Summary: sys-libs/compiler-rt[clang] sys-libs/compiler-rt-sanitizers[clang] sys-libs/l...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal
Assignee: LLVM support project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-28 18:41 UTC by unhappy-ending
Modified: 2022-12-01 06:55 UTC (History)
0 users

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


Attachments
libcxxabi example stripping flags (libcxxabi-strip.log,372.65 KB, text/x-log)
2022-11-28 18:42 UTC, unhappy-ending
Details
libcxxabi example bypassing flag stripping (libcxxabi-no-strip.log,707.05 KB, text/x-log)
2022-11-28 18:44 UTC, unhappy-ending
Details

Note You need to log in before you can comment on or make changes to this bug.
Description unhappy-ending 2022-11-28 18:41:39 UTC
When using the clang USE flag, portage will strip out -unwindlib=libunwind which causes linking error ld.lld: error: undefined symbol: _Unwind_Resume.

Default behavior outputs the following in the build log:

-- <<< Gentoo configuration >>>
Build type      RelWithDebInfo
Install path    /usr
Compiler flags:
C               -march=native -O2 -pipe -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-comment -Wstring-conversion -Wmisleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections
C++             -march=native -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -fdiagnostics-color
Linker flags:
Executable      -fuse-ld=lld -rtlib=compiler-rt -Wl,--color-diagnostics
Module          -fuse-ld=lld -rtlib=compiler-rt -Wl,-z,nodelete -Wl,--color-diagnostics
Shared          -fuse-ld=lld -rtlib=compiler-rt -Wl,-z,defs -Wl,-z,nodelete -Wl,--color-diagnostics

Adding _FLAG_O_MATIC_ECLASS=1 to workaround the issue shows:

-- <<< Gentoo configuration >>>
Build type      RelWithDebInfo
Install path    /usr
Compiler flags:
C               -march=native -O2 -pipe -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-comment -Wstring-conversion -Wmisleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections
C++             -march=native -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -fdiagnostics-color
Linker flags:
Executable      -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind -Wl,--color-diagnostics
Module          -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind -Wl,-z,nodelete -Wl,--color-diagnostics
Shared          -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind -Wl,-z,defs -Wl,-z,nodelete -Wl,--color-diagnostics


Reproducible: Always

Steps to Reproduce:
1. Compile the LLVM toolchain
2. Build libcxxabi with the clang USE flag and LDFLAGS="-rtlib=compiler-rt -unwindlib=libunwind"
3. Portage strips -unwindlib=libunwind
Actual Results:  
In LLVM 15.0.2 resulted in failure with unresolved symbols to GCC's unwinder but I can't reproduce the failure since I bootstrapped the toolchain circa 15.0.2.

Expected Results:  
Success with resolved symbols to LLVM's unwinder

Behavior still persists, but no build failures since bootstrapping. I'm assuming an initial LLVM built by GCC and then attempt to bootstrap would retain the link time failure.
Comment 1 unhappy-ending 2022-11-28 18:42:53 UTC
Created attachment 838007 [details]
libcxxabi example stripping flags

Portage strips -unwindlib=libunwind and libcxxabi fails to build.
Comment 2 unhappy-ending 2022-11-28 18:44:33 UTC
Created attachment 838009 [details]
libcxxabi example bypassing flag stripping

Bypassing the stripping results in a proper build with -unwindlib=libunwind intact.