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: unassignedclangb...@nondot.org
          Reporter: i...@maskray.me
                CC: llvm-bugs@lists.llvm.org, neeil...@live.com,
                    richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to