|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [UNIKRAFT PATCH v4 4/7] plat: prepare linker script for thread-local storage
This patch looks good!
Reviewed-by: Costin Lupu <costin.lupu@xxxxxxxxx>
On 6/2/19 9:02 AM, Florian Schmidt wrote:
> Aggregate all .tdata and .tbss variables in the correct sections, and
> define global variables that point at section beginning and end.
>
> Note that because the .tbss section is zero-size in the ELF file, just
> setting _tls_end to the end of it doesn't give us the the size of the
> memory area once loaded, so we use SIZEOF to have it point to the end.
>
> Signed-off-by: Florian Schmidt <florian.schmidt@xxxxxxxxx>
> ---
> plat/common/include/common.lds.h | 19 +++++++++++++++++++
> plat/common/include/sections.h | 5 +++++
> plat/kvm/x86/link64.lds.S | 2 ++
> plat/linuxu/x86/link64.lds.S | 6 ++++++
> plat/xen/x86/link64.lds.S | 2 ++
> 5 files changed, 34 insertions(+)
>
> diff --git a/plat/common/include/common.lds.h
> b/plat/common/include/common.lds.h
> index db951c54..5ccaadb3 100644
> --- a/plat/common/include/common.lds.h
> +++ b/plat/common/include/common.lds.h
> @@ -94,4 +94,23 @@
> LONG(0) \
> }
>
> +#define TLS_SECTIONS \
> + . = ALIGN(0x8); \
> + _tls_start = .; \
> + .tdata : \
> + { \
> + *(.tdata) \
> + *(.tdata.*) \
> + *(.gnu.linkonce.td.*) \
> + } \
> + _etdata = .; \
> + .tbss : \
> + { \
> + *(.tbss) \
> + *(.tbss.*) \
> + *(.gnu.linkonce.tb.*) \
> + . = ALIGN(0x8); \
> + } \
> + _tls_end = . + SIZEOF(.tbss);
> +
> #endif /* __UK_COMMON_LDS_H */
> diff --git a/plat/common/include/sections.h b/plat/common/include/sections.h
> index 1052cfc7..a2677ce8 100644
> --- a/plat/common/include/sections.h
> +++ b/plat/common/include/sections.h
> @@ -63,6 +63,11 @@ extern char _data[], _edata[];
> /* [_ctors, _ectors]: contains constructor tables (read-only) */
> extern char _ctors[], _ectors[];
>
> +/* [_tls_start, _tls_end]: contains .tdata.* and .tbss.* sections */
> +extern char _tls_start[], _tls_end[];
> +/* _etdata: denotes end of .tdata (and start of .tbss */
> +extern char _etdata[];
> +
> /* __bss_start: start of BSS sections */
> extern char __bss_start[];
>
> diff --git a/plat/kvm/x86/link64.lds.S b/plat/kvm/x86/link64.lds.S
> index 011e6232..362ba3e6 100644
> --- a/plat/kvm/x86/link64.lds.S
> +++ b/plat/kvm/x86/link64.lds.S
> @@ -76,6 +76,8 @@ SECTIONS
> }
> _ectors = .;
>
> + TLS_SECTIONS
> +
> /* Read-write data (initialized) */
> . = ALIGN(__PAGE_SIZE);
> _data = .;
> diff --git a/plat/linuxu/x86/link64.lds.S b/plat/linuxu/x86/link64.lds.S
> index 46034477..b6f581ce 100644
> --- a/plat/linuxu/x86/link64.lds.S
> +++ b/plat/linuxu/x86/link64.lds.S
> @@ -8,3 +8,9 @@ SECTIONS
> }
> INSERT AFTER .rodata
>
> +SECTIONS
> +{
> + TLS_SECTIONS
> +}
> +
> +INSERT BEFORE .data
> diff --git a/plat/xen/x86/link64.lds.S b/plat/xen/x86/link64.lds.S
> index ff69f830..f7e53fe6 100644
> --- a/plat/xen/x86/link64.lds.S
> +++ b/plat/xen/x86/link64.lds.S
> @@ -72,6 +72,8 @@ SECTIONS
> . = ALIGN(__PAGE_SIZE);
> _ectors = .;
>
> + TLS_SECTIONS
> +
> /* Data */
> _data = .;
> .data : {
>
_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |