Skip to content

[ATfL] Restore the use of -DLLVM_ENABLE_LIBCXX=ON in build.sh #370

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: arm-software
Choose a base branch
from

Conversation

pawosm-arm
Copy link
Contributor

Recently we removed -DLLVM_ENABLE_LIBCXX=ON from build.sh to prevent compiler warnings and sudden relocation errors at the link time.

This move was not justified properly. With removal of this setting, there is no CMake-level governance and reassurance that the LLVM's libc++ is astually being used as the C++ standard library. Currently we are ensuring that by using the -stdlib++-isystem flag fed directly to the compiler flags, along with -stdlib=libc++ fed directly to the linker flags. Although this is the right thing to do, it does not effect in a proper awareness at CMake level that libc++ is being used.

An observation has been made that restoring -DLLVM_ENABLE_LIBCXX=ON with current set of compiler flags results in CMake dropping the use of -fPIC from the compiler invocations, this happens despide our explicit use of -DLLVM_ENABLE_PIC=ON. As a result, the following relocation error is occuring at the link time:

ld.lld: error: relocation R_AARCH64_TLSLE_ADD_TPREL_HI12 against CurrentThreadTaskGroups cannot be used with -shared

To address it, this patch adds explicit use of the -fPIC flag to the compiler flags.

Recently we removed -DLLVM_ENABLE_LIBCXX=ON from build.sh to prevent
compiler warnings and sudden relocation errors at the link time.

This move was not justified properly. With removal of this setting,
there is no CMake-level governance and reassurance that the LLVM's
libc++ is astually being used as the C++ standard library. Currently
we are ensuring that by using the -stdlib++-isystem flag fed directly
to the compiler flags, along with -stdlib=libc++ fed directly to the
linker flags. Although this is the right thing to do, it does not
effect in a proper awareness at CMake level that libc++ is being used.

An observation has been made that restoring -DLLVM_ENABLE_LIBCXX=ON
with current set of compiler flags result in CMake dropping the use
of -fPIC from the compiler invocations, this happens despide our
explicit use of -DLLVM_ENABLE_PIC=ON. As a result, the following
relocation error is occuring at the link time:

ld.lld: error: relocation R_AARCH64_TLSLE_ADD_TPREL_HI12 against CurrentThreadTaskGroups cannot be used with -shared

To address it, this patch adds explicit use of the -fPIC flag to the
compiler flags.
@tblah
Copy link
Contributor

tblah commented Jun 11, 2025

We are still a long way away from the ATfL release so I don't think we need hacks like this. Either dropping -fPIC is a bug in upstream llvm (and should be fixed there), or there is a good reason why llvm is doing this and so we shouldn't be doing it either.

@pawosm-arm
Copy link
Contributor Author

I'll keep it open anyway, as I don't like the situation where something suspicious happens without a good explanation.

@pawosm-arm
Copy link
Contributor Author

Slightly (un)related: #374

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants