Bug 2263180 - llvm: Implement support for GNU2 TLS descriptors on x86-64
Summary: llvm: Implement support for GNU2 TLS descriptors on x86-64
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: llvm
Version: rawhide
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Tom Stellard
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: 2263739
Blocks: 2263181 2263182
TreeView+ depends on / blocked
 
Reported: 2024-02-07 12:37 UTC by Florian Weimer
Modified: 2024-04-16 06:20 UTC (History)
14 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2263181 2263182 (view as bug list)
Environment:
Last Closed: 2024-04-16 06:20:45 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker FC-1105 0 None None None 2024-02-07 12:43:02 UTC

Internal Links: 2271151

Description Florian Weimer 2024-02-07 12:37:59 UTC
LLVM does not implement GNU2 TLS descriptors on x86-64, related to the R_X86_64_TLSDESC relocation type (and R_X86_64_GOTPC32_TLSDESC, R_X86_64_TLSDESC_CALL for relaxation).

We want to use TLS descriptors on x86-64. Lack of LLVM support is not a blocker because the new TLS type and the legacy TLS type are fully interoperable (either approach can bind TLS symbols under any TLS model).

There is LLVM support for this feature on AArch64.

Reproducible: Always

Comment 1 Nikita Popov 2024-02-07 13:28:20 UTC
Do you know where to find documentation for these GNU2 TLS descriptors?

Comment 2 Florian Weimer 2024-02-07 13:31:19 UTC
I believe this is the canonical writeup: http://www.fsfla.org/~lxoliva/writeups/TLS/RFC-TLSDESC-x86.txt

Comment 4 Florian Weimer 2024-02-11 14:17:40 UTC
We have encountered a potential GCC or x86-64 psABI ambiguity when we tried to enable this for Fedora 40:

GCC and the GNU2 TLS descriptor call ABI
<https://groups.google.com/g/x86-64-abi/c/NXQve2SPubc>

GNU2 TLS descriptor calls do not follow psABI on x86_64-linux-gnu
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113874>

Comment 5 Nikita Popov 2024-03-04 08:50:24 UTC
It looks like Intel is working on the implementation here: https://github.com/llvm/llvm-project/pull/83136

Comment 6 Sergio Basto 2024-03-22 22:49:05 UTC
building seamonkey on rawhide [2] ATM , is this bug isn't it ? 

configure: error: compiler is incompatible with sanitize options
DEBUG: <truncated - see config.log for full output>
DEBUG: configure:2648: /usr/lib64/ccache/clang -E -std=gnu99  conftest.c >/dev/null 2>conftest.out
DEBUG: configure:2724: /usr/lib64/ccache/clang -std=gnu99 -o conftest -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wno-complain-wrong-lang -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables  -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wformat -Wno-format-overflow    conftest.c -lXt  1>&5
DEBUG: clang: error: unsupported argument 'gnu2' to option '-mtls-dialect=' for target 'x86_64-redhat-linux-gnu'
DEBUG: configure: failed program was:
DEBUG: #line 2717 "configure"
DEBUG: #include "confdefs.h"
DEBUG:
DEBUG: int main() {
DEBUG: XtMalloc()
DEBUG: ; return 0; }
DEBUG: configure:3957: /usr/lib64/ccache/clang -std=gnu99 -o conftest -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wno-complain-wrong-lang -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables  -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wformat -Wno-format-overflow -Qunused-arguments    conftest.c  1>&5
DEBUG: clang: error: unsupported argument 'gnu2' to option '-mtls-dialect=' for target 'x86_64-redhat-linux-gnu'
DEBUG: configure: failed program was:
DEBUG: #line 3950 "configure"
DEBUG: #include "confdefs.h"
DEBUG:
DEBUG: int main() {
DEBUG:
DEBUG: ; return 0; }
DEBUG: configure: error: compiler is incompatible with sanitize options
ERROR: old-configure failed

Comment 7 Tom Stellard 2024-03-23 01:05:43 UTC
@sergio That looks like it's trying to using the gcc flags.  If you are compiling with clang you need to define:

%toolchain clang

In your spec file.

Comment 8 Sergio Basto 2024-03-23 02:44:07 UTC
Thank you , I think the best is open a bug report on seamonkey component I'm just rebuild packages with libjxl soname bump

Comment 9 Nikita Popov 2024-04-16 06:20:45 UTC
Closing this as TLSDESC support has been implemented upstream in https://github.com/llvm/llvm-project/pull/83136. I'll keep the clang issue open for now so we have a reminder to do the redhat-rpm-config change after the LLVM 19 update.


Note You need to log in before you can comment on or make changes to this bug.