Skip to content

I get "undefined reference to `__tls_get_addr'" when linking using the gnu toolchain #1299

Closed as not planned
@taber6996

Description

@taber6996

Hi, I will explain my project to give a little bit of context on the issue.
Currently I'm working on developing a new microkernel for the BLIS api (https://github.com/flame/blis) that gives support to RISC-V architectures. More precisely I'm trying to make BLIS work on a core based on CVA-6(https://github.com/openhwgroup/cva6) that uses posit format instead of floating-point format(https://github.com/artecs-group/PERCIVAL), which I believe is single-threaded. The thing is, to make all this mix work I'm compiling BLIS using a modified version of LLVM that I found on this repo, https://github.com/artecs-group/llvm-xposit, and linking using this toolchain. The thing is that following in the instructions found in the xposit repo it states that i need to install the riscv gnu-toolchain following the instructions of newlib/multilib, doing this the directory /sysroot isn't created on the directory where I install the toolchain. So when I try to compile+link the BLIS library compilations seems to work ok but when linking I get the following error "Linking test_libblis.x against 'lib/riscv/libblis.a -lm '
.../riscv/lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/bin/ld: lib/riscv/libblis.a(bli_error.o): in function .LBB2_1': bli_error.c:(.text+0xf0): undefined reference to __tls_get_addr'". I asked the all knowing prophet (chatGPT) and it suggested that the problem came from libc library, and after some searching it appers that it didn't come with the version I installed or I don't seem to find it, Should a version of libc come with other type of installations? Honestly I don't really understand the differences.
On a side note, I also had problems with librt library which I also didn't find on the newlib/multilib configured installation.
So my issue would be how should I configure the toolchain so I can access to it's versions of libc and librt, would also prefer for them to be static versions since the library I want to produce is also static.

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