Skip to content

[cpullvm] Build some aarch64 configs using initial exec TLS model#228

Closed
Jonathon Penix (jonathonpenix) wants to merge 1 commit into
qualcomm:qualcomm-softwarefrom
jonathonpenix:initial_exec_configs
Closed

[cpullvm] Build some aarch64 configs using initial exec TLS model#228
Jonathon Penix (jonathonpenix) wants to merge 1 commit into
qualcomm:qualcomm-softwarefrom
jonathonpenix:initial_exec_configs

Conversation

@jonathonpenix

Copy link
Copy Markdown
Contributor

local-exec is the default TLS model in picolibc when thread-local-storage is configured. However, we have a few cases where local-exec cannot be used, so change the configs used in those cases to be initial-exec.

This adds a new TLS_MODEL variable to control this.

There's a few things to note here:

  1. This is intentionally done without multilib support for now as we don't want to be shipping separate per-TLS-model configs right now.
  2. Ideally we'd use a consistent TLS model across most/all aarch64 configs (or all configs in general) but a) we're missing some TLS model optimizations in the linker (initial-exec to local-exec when the pre-requisites are met, etc.) and b) we've recently had some correctness issues pop up when testing initial-exec configs. So limit this to only the configs where we know we need this.
  3. The TLS_MODEL option is only handled by picolibc. Other projects (compiler-rt, libc++) don't force this in a way that causes issues (or, generally don't seem to use TLS for the things we're building). So, leave those projects alone for now and address only picolibc. This should be easy to extend if we find out those projects need this set as well.

local-exec is the default TLS model in picolibc when thread-local-storage
is configured. However, we have a few cases where local-exec cannot be used,
so change the configs used in those cases to be initial-exec.

This adds a new `TLS_MODEL` variable to control this.

There's a few things to note here:
1. This is intentionally done without multilib support for now as we don't want
   to be shipping separate per-TLS-model configs right now.
2. Ideally we'd use a consistent TLS model across most/all aarch64 configs (or
   all configs in general) but a) we're missing some TLS model optimizations in
   the linker (initial-exec to local-exec when the pre-requisites are met, etc.)
   and b) we've recently had some correctness issues pop up when testing
   initial-exec configs. So limit this to only the configs where we know we need
   this.
3. The TLS_MODEL option is only handled by picolibc. Other projects
   (compiler-rt, libc++) don't force this in a way that causes issues (or,
   generally don't seem to use TLS for the things we're building). So, leave
   those projects alone for now and address only picolibc. This should be
   easy to extend if we find out those projects need this set as well.

Signed-off-by: Jonathon Penix <jpenix@qti.qualcomm.com>
--buildtype=${LIBRARY_MESON_BUILD_TYPE}
-Dsingle-thread=${single_thread}
-Dthread-local-storage=${thread_local_storage}
-Dtls-model=${TLS_MODEL}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a side note: tls-model is and is documented in picolibc to be a no-op when thread-local-storage is not selected.

@jonathonpenix Jonathon Penix (jonathonpenix) marked this pull request as draft March 5, 2026 22:23
pzhengqc added a commit to pzhengqc/cpullvm-toolchain that referenced this pull request Mar 5, 2026
This patch borrowed the `TLS_MODEL` variable Jonathon implemented in
qualcomm#228. This also needs clang
support to allow multilib selection based on
`-ftls-model` (qualcomm#241).

Signed-off-by: Pengxuan Zheng <pzheng@qti.qualcomm.com>
pzhengqc added a commit to pzhengqc/cpullvm-toolchain that referenced this pull request Mar 6, 2026
This patch borrowed the `TLS_MODEL` variable Jonathon implemented in
qualcomm#228.

Signed-off-by: Pengxuan Zheng <pzheng@qti.qualcomm.com>
@jonathonpenix

Copy link
Copy Markdown
Contributor Author

Closing in favor of #242

pzhengqc added a commit to pzhengqc/cpullvm-toolchain that referenced this pull request Mar 6, 2026
This patch borrowed the `TLS_MODEL` variable Jonathon implemented in
qualcomm#228.

Signed-off-by: Pengxuan Zheng <pzheng@qti.qualcomm.com>
Jonathon Penix (jonathonpenix) pushed a commit that referenced this pull request Mar 6, 2026
…242)

This patch borrowed the `TLS_MODEL` variable Jonathon implemented in
#228.

Signed-off-by: Pengxuan Zheng <pzheng@qti.qualcomm.com>
Jonathon Penix (jonathonpenix) pushed a commit that referenced this pull request Mar 6, 2026
…242) (#248)

This patch borrowed the `TLS_MODEL` variable Jonathon implemented in
#228.

(cherry picked from commit 238279e)

Signed-off-by: Pengxuan Zheng <pzheng@qti.qualcomm.com>
Co-authored-by: pzhengqc <55604844+pzhengqc@users.noreply.github.com>
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.

1 participant