Skip to content

riscv64: duplicate __cxa* symbols linking wasm-opt (vendored libcxxabi vs toolchain libc++.a) #24

Description

@jwinarske

riscv64 fails in Build Debug linking wasm-opt. Nine __cxa* symbols are
defined twice, once by our vendored libcxxabi and once by the libc++ that ships
with the pinned clang toolchain:

FAILED: exe.unstripped/wasm-opt wasm-opt
clang++ --target=riscv64-unknown-linux-gnu ...
ld.lld: error: duplicate symbol: __cxxabiv1::__setExceptionClass(_Unwind_Exception*, unsigned long)
>>> defined in obj/flutter/third_party/libcxxabi/src/libcxxabi.cxa_noexception.o
>>> defined in buildtools/linux-x64/clang/lib/riscv64-unknown-linux-gnu/libc++.a(cxa_exception.cpp.o)

The other eight are __getExceptionClass, __isOurExceptionClass,
__cxa_decrement_exception_refcount, __cxa_increment_exception_refcount,
__cxa_current_primary_exception, __cxa_rethrow_primary_exception,
__cxa_uncaught_exception, __cxa_uncaught_exceptions.

Both objects end up on the link line: ours built with exceptions off
(cxa_noexception.o), theirs the normal cxa_exception.cpp.o out of the
prebuilt libc++.a. Only riscv64 ships that per-target lib directory in
buildtools, which is why x86_64, arm64 and armv7hf link clean from the same
dispatch.

Not new and not tied to a version bump. Same failure at both revisions I have
runs for:

srcrev version run
5d531788 3.47.1 33021152268
a804b261 3.47.2 33679768178

Two directions, no strong opinion on which:

  • link with -nostdlib++ for this target so the toolchain's libc++.a is not
    pulled in, or
  • skip the vendored libcxxabi on riscv64 and use the toolchain's

Worth checking whether patches/0001-clang-toolchain.patch is what puts that lib
directory on the search path in the first place.

Consequence today: there are no published riscv64 engine artifacts for any
recent release. meta-flutter builds the engine from source so its CI is
unaffected, but anyone consuming the prebuilt tarballs has nothing for riscv64.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions