You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nuttx.apache.org by Matheus Castello <ma...@castello.eng.br> on 2021/05/31 10:53:25 UTC
[Reporting][Need Help] llvm11/12 arm-none-eabi-ld undefined reference
to `__atomic_fetch_add_4'
Trying to use libcxx for port a project to Nuttx and I'm having the
following errors:
```
LD: nuttx
arm-none-eabi-ld:
/home/castello/projects/N/nuttx/staging/libxx.a(locale.o): in function
`std::__1::locale::id::__init()':
locale.cpp:(.text+0x1890): undefined reference to `__atomic_fetch_add_4'
arm-none-eabi-ld:
/home/castello/projects/N/nuttx/staging/libxx.a(memory.o): in function
`std::__1::__shared_count::__add_shared()':
memory.cpp:(.text+0x60): undefined reference to `__atomic_fetch_add_4'
arm-none-eabi-ld:
/home/castello/projects/N/nuttx/staging/libxx.a(memory.o): in function
`std::__1::__shared_count::__release_shared()':
memory.cpp:(.text+0x72): undefined reference to `__atomic_fetch_add_4'
arm-none-eabi-ld:
/home/castello/projects/N/nuttx/staging/libxx.a(memory.o): in function
`std::__1::__shared_weak_count::__add_weak()':
memory.cpp:(.text+0x9a): undefined reference to `__atomic_fetch_add_4'
arm-none-eabi-ld:
/home/castello/projects/N/nuttx/staging/libxx.a(memory.o): in function
`std::__1::__shared_weak_count::__release_weak()':
memory.cpp:(.text+0xc0): undefined reference to `__atomic_fetch_add_4'
arm-none-eabi-ld:
/home/castello/projects/N/nuttx/staging/libxx.a(memory.o): in function
`std::__1::__shared_weak_count::lock()':
memory.cpp:(.text+0x102): undefined reference to
`__atomic_compare_exchange_4'
```
I can already build it using the simulator but with arm-none-eabi I'm
not having success. If anyone has any hints or light on what I'm doing
wrong, I'll be very grateful :)
BR,
Matheus Castello
Re: [Reporting][Need Help] llvm11/12 arm-none-eabi-ld undefined
reference to `__atomic_fetch_add_4'
Posted by Matheus Castello <ma...@castello.eng.br>.
Hi Gustavo,
Em 5/31/2021 9:00 AM, Gustavo Henrique Nihei escreveu:
> Hi Matheus,
>
> it seems you are using an Arm processor that does not implement the
> atomic instructions LDREX and STREX.
> This is the case for Arm Cortex-M0/M0+ line, which is based on the arm-v6m ISA.
> In this case, you'd need to implement these functions by providing the
> atomicity requirements with support from the OS.
> Currently the ESP32-C3 chip provides this implementation, but it could
> be made generic with by some work to the build system.
> There is an open issue for this improvement:
> https://github.com/apache/incubator-nuttx/issues/3483
>
thank you so much for the help, I'll take a look on the ESP32-C3
implementation for now.
> Best regards,
> Gustavo.
>
> On Mon, May 31, 2021 at 7:53 AM Matheus Castello
> <ma...@castello.eng.br> wrote:
>>
>> Trying to use libcxx for port a project to Nuttx and I'm having the
>> following errors:
>>
>> ```
>> LD: nuttx
>> arm-none-eabi-ld:
>> /home/castello/projects/N/nuttx/staging/libxx.a(locale.o): in function
>> `std::__1::locale::id::__init()':
>> locale.cpp:(.text+0x1890): undefined reference to `__atomic_fetch_add_4'
>> arm-none-eabi-ld:
>> /home/castello/projects/N/nuttx/staging/libxx.a(memory.o): in function
>> `std::__1::__shared_count::__add_shared()':
>> memory.cpp:(.text+0x60): undefined reference to `__atomic_fetch_add_4'
>> arm-none-eabi-ld:
>> /home/castello/projects/N/nuttx/staging/libxx.a(memory.o): in function
>> `std::__1::__shared_count::__release_shared()':
>> memory.cpp:(.text+0x72): undefined reference to `__atomic_fetch_add_4'
>> arm-none-eabi-ld:
>> /home/castello/projects/N/nuttx/staging/libxx.a(memory.o): in function
>> `std::__1::__shared_weak_count::__add_weak()':
>> memory.cpp:(.text+0x9a): undefined reference to `__atomic_fetch_add_4'
>> arm-none-eabi-ld:
>> /home/castello/projects/N/nuttx/staging/libxx.a(memory.o): in function
>> `std::__1::__shared_weak_count::__release_weak()':
>> memory.cpp:(.text+0xc0): undefined reference to `__atomic_fetch_add_4'
>> arm-none-eabi-ld:
>> /home/castello/projects/N/nuttx/staging/libxx.a(memory.o): in function
>> `std::__1::__shared_weak_count::lock()':
>> memory.cpp:(.text+0x102): undefined reference to
>> `__atomic_compare_exchange_4'
>> ```
>>
>> I can already build it using the simulator but with arm-none-eabi I'm
>> not having success. If anyone has any hints or light on what I'm doing
>> wrong, I'll be very grateful :)
>>
>> BR,
>> Matheus Castello
>
>
>
BR,
Matheus Castello
Re: [Reporting][Need Help] llvm11/12 arm-none-eabi-ld undefined
reference to `__atomic_fetch_add_4'
Posted by Gustavo Henrique Nihei <gh...@gmail.com>.
Hi Matheus,
it seems you are using an Arm processor that does not implement the
atomic instructions LDREX and STREX.
This is the case for Arm Cortex-M0/M0+ line, which is based on the arm-v6m ISA.
In this case, you'd need to implement these functions by providing the
atomicity requirements with support from the OS.
Currently the ESP32-C3 chip provides this implementation, but it could
be made generic with by some work to the build system.
There is an open issue for this improvement:
https://github.com/apache/incubator-nuttx/issues/3483
Best regards,
Gustavo.
On Mon, May 31, 2021 at 7:53 AM Matheus Castello
<ma...@castello.eng.br> wrote:
>
> Trying to use libcxx for port a project to Nuttx and I'm having the
> following errors:
>
> ```
> LD: nuttx
> arm-none-eabi-ld:
> /home/castello/projects/N/nuttx/staging/libxx.a(locale.o): in function
> `std::__1::locale::id::__init()':
> locale.cpp:(.text+0x1890): undefined reference to `__atomic_fetch_add_4'
> arm-none-eabi-ld:
> /home/castello/projects/N/nuttx/staging/libxx.a(memory.o): in function
> `std::__1::__shared_count::__add_shared()':
> memory.cpp:(.text+0x60): undefined reference to `__atomic_fetch_add_4'
> arm-none-eabi-ld:
> /home/castello/projects/N/nuttx/staging/libxx.a(memory.o): in function
> `std::__1::__shared_count::__release_shared()':
> memory.cpp:(.text+0x72): undefined reference to `__atomic_fetch_add_4'
> arm-none-eabi-ld:
> /home/castello/projects/N/nuttx/staging/libxx.a(memory.o): in function
> `std::__1::__shared_weak_count::__add_weak()':
> memory.cpp:(.text+0x9a): undefined reference to `__atomic_fetch_add_4'
> arm-none-eabi-ld:
> /home/castello/projects/N/nuttx/staging/libxx.a(memory.o): in function
> `std::__1::__shared_weak_count::__release_weak()':
> memory.cpp:(.text+0xc0): undefined reference to `__atomic_fetch_add_4'
> arm-none-eabi-ld:
> /home/castello/projects/N/nuttx/staging/libxx.a(memory.o): in function
> `std::__1::__shared_weak_count::lock()':
> memory.cpp:(.text+0x102): undefined reference to
> `__atomic_compare_exchange_4'
> ```
>
> I can already build it using the simulator but with arm-none-eabi I'm
> not having success. If anyone has any hints or light on what I'm doing
> wrong, I'll be very grateful :)
>
> BR,
> Matheus Castello
--
Gustavo Henrique Nihei