[llvm-bugs] [Bug 45516] New: `error: --rtlib=libgcc requires --unwindlib=libgcc` emitted twice

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Apr 13 14:12:57 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=45516

            Bug ID: 45516
           Summary: `error: --rtlib=libgcc requires --unwindlib=libgcc`
                    emitted twice
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Driver
          Assignee: unassignedclangbugs at nondot.org
          Reporter: i at maskray.me
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

% clang --unwindlib=libunwind /dev/null '-###'                                  
...
clang-11: error: --rtlib=libgcc requires --unwindlib=libgcc
clang-11: error: --rtlib=libgcc requires --unwindlib=libgcc
...

% clang --unwindlib=invalid /dev/null '-###'
...
clang-11: error: invalid unwind library name in argument '--unwindlib=invalid'
clang-11: error: invalid unwind library name in argument '--unwindlib=invalid'
...


clang/lib/Driver/ToolChain.cpp GetUnwindLibType can be called twice. We need to
record whether the diagnostic has been reported to address the issue. Another
idea is to not add -l:libunwind.a or -l:libunwind.so twice.


In the GNU toolchain, libgcc and libgcc_s are duplicated (before and after -lc)
to address the interdependency issue with libc. __absvsi2 may reference abort.
In some GCC configurations, __builtin_trap may call abort. These unneeded
abort/raise calls are the root cause that libgcc libgcc_s or libgcc_eh are
duplicated.

The things around -lc:

gcc exe: -lgcc --as-needed -lgcc_s --no-as-needed
g++ or -shared: -lgcc_s -lgcc
-static or -static-pie: -lgcc -lgcc_eh

In compiler-rt, we may be able to fix these and only add -l:libunwind.{a,so}
once. This can bypass the duplicate diagnostic issue.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200413/8900658b/attachment-0001.html>


More information about the llvm-bugs mailing list