[PATCH] D98023: [clang] Don't make the g++ driver imply an explicitly shared libunwind

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 5 14:15:33 PST 2021


MaskRay added a comment.

I have tested the following configurations on x86_64-linux-gnu and I don't find a difference.

  CC=/tmp/RelA/bin/clang
  CXX=/tmp/RelA/bin/clang++
  $CC -c a.c
  $CC a.o '-###' &> a/c.raw.txt
  $CC a.o --rtlib=compiler-rt --unwindlib=none '-###' &> a/c.rt.none.txt
  $CC a.o --rtlib=compiler-rt --unwindlib=libgcc '-###' &> a/c.rt.libgcc.txt
  $CC a.o --rtlib=compiler-rt --unwindlib=libunwind '-###' &> a/c.rt.libunwind.txt
  $CXX a.o '-###' &> a/cc.raw.txt
  $CCX a.o --rtlib=compiler-rt --unwindlib=none '-###' &> a/cc.rt.none.txt
  $CCX a.o --rtlib=compiler-rt --unwindlib=libgcc '-###' &> a/cc.rt.libgcc.txt
  $CCX a.o --rtlib=compiler-rt --unwindlib=libunwind '-###' &> a/cc.rt.libunwind.txt

I'd hope we reduce the usage of `UnspecifiedLibGcc` as it has the tricky `--as-needed` implication. I think the idea is that for C (no exceptions, so no `_Unwind_Resume` at the end of non-catch handlers), `libgcc_s.so.1` is usually unneeded, so `--as-needed` can likely result in one fewer DT_NEEDED... This optimization probably does not have much value.

So if you want to add a condition, please test mingw triple instead of testing `RLT == ToolChain::RLT_Libgcc`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98023/new/

https://reviews.llvm.org/D98023



More information about the cfe-commits mailing list