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

arc: Fix alignment of the TLS Translation Control Block (from upstream) #9

Open
wants to merge 1 commit into
base: zephyr-binutils-2_38
Choose a base branch
from

Conversation

keith-packard
Copy link

The R_ARC_TLS_LE_32 is defined as S + A + TLS_TBSS - TLS_REL, where

  • S is the base address of the symbol in the memory
  • A is the symbol addendum
  • TLS_TBSS is the TLS Translation Control Block size (aligned)
  • TLS_REL is the base of the TLS section

Given the next code snip:

__thread int data_var = 12;
attribute((aligned(128))) __thread int data_var_128 = 128; __thread int bss_var;
attribute((aligned(256))) __thread int bss_var_256;

int __start(void)
{
return data_var + data_var_128 + bss_var + bss_var_256;
}

The current code returns different TLS_TBSS values for .tdata and .tbss. This patch fixes this by using the linker provided tls_sec.

The R_ARC_TLS_LE_32 is defined as S + A + TLS_TBSS - TLS_REL, where

  -  S is the base address of the symbol in the memory
  -  A is the symbol addendum
  -  TLS_TBSS is the TLS Translation Control Block size (aligned)
  -  TLS_REL is the base of the TLS section

Given the next code snip:

__thread int data_var = 12;
__attribute__((__aligned__(128))) __thread int data_var_128 = 128;
__thread int bss_var;
__attribute__((__aligned__(256))) __thread int bss_var_256;

int __start(void)
{
	return data_var + data_var_128 + bss_var + bss_var_256;
}

The current code returns different TLS_TBSS values for .tdata and
.tbss. This patch fixes this by using the linker provided tls_sec.

Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
@keith-packard
Copy link
Author

This just cherry-picks the fix so we might get it into 0.16.2; do you want more than that?

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