Skip to content
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

Thread local storage is broken when adding more thread variables #32015

Closed
dcpleung opened this issue Feb 5, 2021 · 0 comments · Fixed by #32016
Closed

Thread local storage is broken when adding more thread variables #32015

dcpleung opened this issue Feb 5, 2021 · 0 comments · Fixed by #32016
Assignees
Labels
area: Kernel bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug

Comments

@dcpleung
Copy link
Member

dcpleung commented Feb 5, 2021

When adding a uint64_t to the TLS test app, the test starts to fail. This is due to both tdata and tbss regions are not aligned correctly in the stack. Further testing shows that the test fails when tdata or tbss section in ELF is of size 1, 3, 5, 6, 7, and >9 (when not a multiple of 8).

@dcpleung dcpleung added the bug The issue is a bug, or the PR is fixing a bug label Feb 5, 2021
dcpleung added a commit to dcpleung/zephyr that referenced this issue Feb 5, 2021
This lets the linker tell us what kind of alignment is required
for both tdata and tbss data when copying them into stack.
If they are not aligned as expected by the toolchain, generated
code would be accessing incorrect location for thread variables.

Fixes zephyrproject-rtos#32015

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
@nashif nashif added priority: medium Medium impact/importance bug area: Kernel labels Feb 5, 2021
dcpleung added a commit to dcpleung/zephyr that referenced this issue Feb 5, 2021
This lets the linker tell us what kind of alignment is required
for both tdata and tbss data when copying them into stack.
If they are not aligned as expected by the toolchain, generated
code would be accessing incorrect location for thread variables.

Fixes zephyrproject-rtos#32015

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
nashif pushed a commit that referenced this issue Feb 8, 2021
This lets the linker tell us what kind of alignment is required
for both tdata and tbss data when copying them into stack.
If they are not aligned as expected by the toolchain, generated
code would be accessing incorrect location for thread variables.

Fixes #32015

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Kernel bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants