Thanks for confirming your setup is working.  I've checked my linker script
and it does have the ARM.exidx and ARM.extab sections.

I have to assume this is due to some libcxxabi/libgcc issue, but who knows.
I'm open to suggestions.

On Wed, Jan 13, 2021 at 1:59 AM Xiang Xiao <xiaoxiang781...@gmail.com>
wrote:

> On Wed, Jan 13, 2021 at 12:44 AM Anthony Merlino <anth...@vergeaero.com>
> wrote:
>
> > >
> > > Since Xiang already added support for NuttX on libcxx mainstream:
> > > https://reviews.llvm.org/D88718?id=303700
> > >
> > > I think it is time to phase out my libcxx repository and we will stick
> > > to libcxx mainline.
> > >
> > > Do you agree on that?
> >
> >
> > In general, yes. However, with your modified version, I was able to build
> > and use libcxx without libsupc++ at all. With the upstream version,
> > libsupc++ is required. I'm still not sure how I was able to get away
> > without this before.
> >
> > It seems building libsupc++.a is not the easiest. The gcc build system
> is a
> > complicated beast.
> >
> > Instead, I have added support for building the libcxxabi library
> alongside
> > libcxx. I have now successfully gotten it to build and run, but exception
> > unwinding does not work.
> >
> > Xiang, are you actually using exceptions? Can you confirm whether
> exception
> > unwinding is actually working for you with gcc and libsupc++.a?
> >
> >
> Yes, the exception can work as expect, I just try cxxtest with
> CONFIG_CXX_EXCEPTION:
> https://github.com/apache/incubator-nuttx-apps/tree/master/testing/cxxtest
> Here is the output from a board with Cortex M33:
> test ofstream=========================== printf: Starting test_ostream
> printf:
> Successfully opened /dev/console cout: Successfully opened /dev/console
> Writing
> this to /dev/console test iostream=========================== Hello, this
> is only a test Print an int: 190 Print a char: d test
> vector============================= v1=1 2 3 Hello World Good Luck test
> map================================ test
> rtti===============================
> extend test exception========================== Catch exception: runtime
> error
> The simulator has the same output too.
> BTW, to make the exception work, the link script need .ARM.extab
> and.ARM.exidx sections:
>     .ARM.extab : ALIGN(4) {
>         *(.ARM.extab*)
>     } > ROM
>
>     .ARM.exidx : ALIGN(4) {
>         __exidx_start = ABSOLUTE(.);
>         *(.ARM.exidx*)
>         __exidx_end = ABSOLUTE(.);
>     } > ROM
>
>
> > Best,
> > Anthony
> >
> >
> >
> >
> >
> > On Sat, Jan 9, 2021 at 11:57 AM Xiang Xiao <xiaoxiang781...@gmail.com>
> > wrote:
> >
> > > On Sat, Jan 9, 2021 at 8:11 AM Anthony Merlino <anth...@vergeaero.com>
> > > wrote:
> > >
> > > > Thanks for the info Xiang! I was on the right track but it is good to
> > > have
> > > > some affirmation that I'm not missing something.
> > > >
> > > > The issue with the Arm maintained toolchain, as Greg has warned many
> > > times,
> > > > is its use of newlib. Are you doing anything to ensure the wrong math
> > > > library is not used?
> > > >
> > > >
> > > Yes, from the theory, the potential conflict may happen since NuttX has
> > its
> > > own libc/libm implementation which is totally different from newlib,
> but
> > at
> > > least the follow combination is good from the practice:
> > >
> > >    1. libc and libm come from NuttX, libsupc++ come from newlib
> > >    2. libc come from NuttX, libm and libsupc++ come from newlib
> > >
> > > We use item 2 for all arm based products and sim develop environment.
> > >
> > > I will work on improving buildroot to also build and include
> libsupcxx.a.
> > > >
> > > > With Alan's modified version of libcxx, he disabled some exception
> > logic
> > > > and maybe some other logic that was allowing me to build without
> > > libsupxx.a
> > > > entirely.
> > > >
> > > >
> > > libcxx will turn on/off exception and rtti automatically, you just need
> > > specify the right compiler flag(e.g. -fno-exceptions and -fno-rtti):
> > >
> > >
> >
> https://github.com/llvm/llvm-project/blob/main/libcxx/include/__config#L433-L435
> > >
> > >
> >
> https://github.com/llvm/llvm-project/blob/main/libcxx/include/__config#L1092-L1098
> > >
> > >
> > > > Also, may I ask why we are building libcxx by manually grabbing the
> > > source
> > > > files and building it? Are we against just driving the build from
> their
> > > > existing build system?
> > >
> > >
> > > libcxx uses CMake, it's hard to integrate their build system. But, it
> > will
> > > be great if we can find a clean solution to reuse their build script.
> > >
> > >
> > > > I ask because there are options in the way libcxx is
> > > > built that might be useful to us and we have to replicate all of that
> > if
> > > we
> > > > just grab the source.
> > > >
> > > >
> > > Except the build system integration, all NuttX specific changes are
> > > upstream to the llvm project. We have to apply the following patches:
> > >
> > >
> >
> https://github.com/apache/incubator-nuttx/blob/master/libs/libxx/0001-libc-Fix-a-few-warnings.patch
> > >
> > >
> >
> https://github.com/apache/incubator-nuttx/blob/master/libs/libxx/0001-libc-Fix-tests-failing-with-Clang-after-removing-GCC.patch
> > >
> > >
> >
> https://github.com/apache/incubator-nuttx/blob/master/libs/libxx/0001-libc-NFC-Fix-several-GCC-warnings-in-the-test-suite.patch
> > >
> > >
> >
> https://github.com/apache/incubator-nuttx/blob/master/libs/libxx/0001-libcxx-Check-_LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE-fir.patch
> > >
> > >
> >
> https://github.com/apache/incubator-nuttx/blob/master/libs/libxx/0001-libcxx-Port-to-NuttX-https-nuttx.apache.org-RTOS.patch
> > > just because the new libcxx contains our change doesn't release yet.
> Once
> > > the new release is out, I will remove all patches from the NuttX repo.
> > >
> > >
> > > >
> > > > Best,
> > > > Anthony
> > > >
> > > >
> > > > On Sat, Jan 9, 2021, 7:32 AM Xiang Xiao <xiaoxiang781...@gmail.com>
> > > wrote:
> > > >
> > > > > On Fri, Jan 8, 2021 at 9:57 AM Anthony Merlino <
> > anth...@vergeaero.com>
> > > > > wrote:
> > > > >
> > > > > > Hey all,
> > > > > >
> > > > > > Would someone be willing to share their experience with libcxx
> and
> > > > their
> > > > > > toolchain?
> > > > >
> > > > >
> > > > > This toolchain should work:
> > > > >
> > > > >
> > > >
> > >
> >
> https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm
> > > > >
> > > > >
> > > > > > I've now caught up to the tip of master, which now downloads
> > > > > > and builds libcxx for me instead of using Alan's modified
> version.
> > I
> > > am
> > > > > > facing an issue I've faced before, and would really love to
> > properly
> > > > > > understand how this is supposed to work.
> > > > > >
> > > > > > My issues mostly center around libsupc++.a
> > > > > >
> > > > > > Currently, my build fails because it can't find libsupc++. From
> my
> > > > > > understanding, this should be provided by my toolchain. But I am
> > > using
> > > > a
> > > > > > toolchain built by the NuttX buildroot and it does not build the
> > C++
> > > > > > libraries.  I am not using RTTI or exceptions, so I don't need
> what
> > > > > >
> > > > >
> > > > > libsupc++.a doesn't only provide RTTI and exectpions, but also
> > provide
> > > > some
> > > > > basic functions called by compiler:
> > > > >
> > > > >
> > > >
> > >
> >
> https://github.com/gcc-mirror/gcc/tree/master/libstdc%2B%2B-v3/libsupc%2B%2B
> > > > >
> > > > > libsupc++ provides, however the Kconfig option
> > > > > >    `[ ]   Have libsupc++ (required)`
> > > > > > says, it's required.
> > > > > >
> > > > > > What's the right answer here? What are others doing about this?
> > > > > >
> > > > > >
> > > > > Three methods you can try:
> > > > >
> > > > >    1. Switch to the ARM maintained toolchain
> > > > >    2. Build libsupc++.a for NuttX toolchain
> > > > >    3. Enhance NuttX's libc++ runtime support
> > > > >
> > > > >
> > > > > https://github.com/apache/incubator-nuttx/tree/master/libs/libxx
> > > > >
> > > > >
> > > > > > Is getting NuttX buildroot to build and provide libsupc++.a the
> > > *right*
> > > > > > solution?
> > > > > >
> > > > > >
> > > > > Yes, a complete toolchain should provide libsupc++.a. libsupc++.a
> > just
> > > > like
> > > > > libgcc.a should part of toolchain, not part of c/c++ library
> > > > > implemetnation, because libsupc++.a tightly couple with the
> > > implementaion
> > > > > detail of compiler.
> > > > >
> > > > >
> > > > > > Do we need to change how libcxx is built in this case?
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> https://libcxx.llvm.org/docs/BuildingLibcxx.html#using-alternate-abi-libraries
> > > > > >
> > > > > >
> > > > > Then you need port the libcxxrt:
> > > > > https://github.com/libcxxrt/libcxxrt
> > > > >
> > > > >
> > > > > > Thank you!
> > > > > >
> > > > > > Anthony
> > > > > >
> > > > >
> > > >
> > >
> >
>

Reply via email to