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

Tls export symbols #546

Merged
merged 14 commits into from
Mar 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bindings/lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void *memset(void *dest, int c, size_t n)
return dest;
}

void *memcpy(void *restrict dest, const void *restrict src, size_t n)
void *__attribute__ ((noinline)) memcpy(void *restrict dest, const void *restrict src, size_t n)
{
unsigned char *d = dest;
const unsigned char *s = src;
Expand Down
31 changes: 23 additions & 8 deletions bindings/solo5_hvt.lds
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ PHDRS {
rodata PT_LOAD FLAGS(4);

data PT_LOAD;
tdata PT_TLS;
tbss PT_TLS;
tdata PT_LOAD FLAGS(4); /* RO: this have to be copied into each thread */
tbss PT_TLS FLAGS(0); /* no perm needed */
bss PT_NULL FLAGS(0);
note.not_openbsd PT_NOTE; /* Must come first. */
note.abi PT_NOTE;
note.manifest PT_NOTE;
Expand Down Expand Up @@ -115,24 +116,35 @@ SECTIONS {
*(.data)
*(.data.*)
}

. = ALIGN(CONSTANT(MAXPAGESIZE));
/*
* tdata and tbss have to be side by side to help the linker caculate the
* various __thread variables offsets.
*/
.tdata :
{
_stdata = .;
*(.tdata)
. = ALIGN(CONSTANT(MAXPAGESIZE));
} :tdata

. = ALIGN(CONSTANT(MAXPAGESIZE));
/*
* _edata is the address of the end of the area to be copied with multiboot
* (virtio and xen)
*/
_edata = .;

/* Read-write data (uninitialized) */
.tbss :
{
*(.tbss)
} :tbss
.bss :
{
*(.bss)
*(COMMON)
}
.tbss (NOLOAD) :
{
*(.tbss)
} :tbss
} :bss

. = ALIGN(CONSTANT(MAXPAGESIZE));
_ebss = .;
Expand All @@ -143,4 +155,7 @@ SECTIONS {
/DISCARD/ : {
*(.note.gnu.*)
}

_ltdata = _edata - _stdata;
_ltbss = SIZEOF(.tbss);
}
31 changes: 23 additions & 8 deletions bindings/solo5_muen.lds
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ PHDRS {
FLAGS values come from PF_x in elf.h */
rodata PT_LOAD;
data PT_LOAD;
tdata PT_TLS;
tbss PT_TLS;
tdata PT_LOAD FLAGS(4); /* RO: this have to be copied into each thread */
tbss PT_TLS FLAGS(0); /* no perm needed */
bss PT_NULL FLAGS(0);
note.not_openbsd PT_NOTE; /* Must come first. */
note.abi PT_NOTE;
note.manifest PT_NOTE;
Expand Down Expand Up @@ -114,24 +115,35 @@ SECTIONS {
*(.data)
*(.data.*)
}

. = ALIGN(CONSTANT(MAXPAGESIZE));
/*
* tdata and tbss have to be side by side to help the linker caculate the
* various __thread variables offsets.
*/
.tdata :
{
_stdata = .;
*(.tdata)
. = ALIGN(CONSTANT(MAXPAGESIZE));
} :tdata

. = ALIGN(CONSTANT(MAXPAGESIZE));
/*
* _edata is the address of the end of the area to be copied with multiboot
* (virtio and xen)
*/
_edata = .;

/* Read-write data (uninitialized) */
.tbss :
{
*(.tbss)
} :tbss
.bss :
{
*(.bss)
*(COMMON)
}
.tbss (NOLOAD) :
{
*(.tbss)
} :tbss
} :bss

. = ALIGN(CONSTANT(MAXPAGESIZE));
_ebss = .;
Expand All @@ -142,4 +154,7 @@ SECTIONS {
/DISCARD/ : {
*(.note.gnu.*)
}

_ltdata = SIZEOF(.tdata);
_ltbss = SIZEOF(.tbss);
}
31 changes: 23 additions & 8 deletions bindings/solo5_spt.lds
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ PHDRS {
text PT_LOAD FLAGS(5); /* No FILEHDR or PHDRS, force R/E only.
FLAGS values come from PF_x in elf.h */
data PT_LOAD;
tdata PT_TLS;
tbss PT_TLS;
tdata PT_LOAD FLAGS(4); /* RO: this have to be copied into each thread */
tbss PT_TLS FLAGS(0); /* no perm needed */
bss PT_NULL FLAGS(0);
note.not_openbsd PT_NOTE; /* Must come first. */
note.abi PT_NOTE;
note.manifest PT_NOTE;
Expand Down Expand Up @@ -113,24 +114,35 @@ SECTIONS {
*(.data)
*(.data.*)
}

. = ALIGN(CONSTANT(MAXPAGESIZE));
/*
* tdata and tbss have to be side by side to help the linker caculate the
* various __thread variables offsets.
*/
.tdata :
{
_stdata = .;
*(.tdata)
. = ALIGN(CONSTANT(MAXPAGESIZE));
} :tdata

. = ALIGN(CONSTANT(MAXPAGESIZE));
/*
* _edata is the address of the end of the area to be copied with multiboot
* (virtio and xen)
*/
_edata = .;

/* Read-write data (uninitialized) */
.tbss :
{
*(.tbss)
} :tbss
.bss :
{
*(.bss)
*(COMMON)
}
.tbss (NOLOAD):
{
*(.tbss)
} :tbss
} :bss

. = ALIGN(CONSTANT(MAXPAGESIZE));
_ebss = .;
Expand All @@ -141,4 +153,7 @@ SECTIONS {
/DISCARD/ : {
*(.note.gnu.*)
}

_ltdata = _edata - _stdata;
_ltbss = SIZEOF(.tbss);
}
31 changes: 23 additions & 8 deletions bindings/solo5_stub.lds
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ PHDRS {
text PT_LOAD FLAGS(5); /* No FILEHDR or PHDRS, force R/E only.
FLAGS values come from PF_x in elf.h */
data PT_LOAD;
tdata PT_TLS;
tbss PT_TLS;
tdata PT_LOAD FLAGS(4); /* RO: this have to be copied into each thread */
tbss PT_TLS FLAGS(0); /* no perm needed */
bss PT_NULL FLAGS(0);
note.not_openbsd PT_NOTE; /* Must come first. */
note.abi PT_NOTE;
note.manifest PT_NOTE;
Expand Down Expand Up @@ -113,24 +114,35 @@ SECTIONS {
*(.data)
*(.data.*)
}

. = ALIGN(CONSTANT(MAXPAGESIZE));
/*
* tdata and tbss have to be side by side to help the linker caculate the
* various __thread variables offsets.
*/
.tdata :
{
_stdata = .;
*(.tdata)
. = ALIGN(CONSTANT(MAXPAGESIZE));
} :tdata

. = ALIGN(CONSTANT(MAXPAGESIZE));
/*
* _edata is the address of the end of the area to be copied with multiboot
* (virtio and xen)
*/
_edata = .;

/* Read-write data (uninitialized) */
.tbss :
{
*(.tbss)
} :tbss
.bss :
{
*(.bss)
*(COMMON)
}
.tbss (NOLOAD):
{
*(.tbss)
} :tbss
} :bss

. = ALIGN(CONSTANT(MAXPAGESIZE));
_ebss = .;
Expand All @@ -141,4 +153,7 @@ SECTIONS {
/DISCARD/ : {
*(.note.gnu.*)
}

_ltdata = SIZEOF(.tdata);
_ltbss = SIZEOF(.tbss);
}
31 changes: 23 additions & 8 deletions bindings/solo5_virtio.lds
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ PHDRS {
text PT_LOAD FLAGS(5); /* No FILEHDR or PHDRS, force R/E only.
FLAGS values come from PF_x in elf.h */
data PT_LOAD;
tdata PT_TLS;
tbss PT_TLS;
tdata PT_LOAD FLAGS(4); /* RO: this have to be copied into each thread */
tbss PT_TLS FLAGS(0); /* no perm needed */
bss PT_NULL FLAGS(0);
note.not_openbsd PT_NOTE; /* Must come first. */
note.abi PT_NOTE;
note.manifest PT_NOTE;
Expand Down Expand Up @@ -114,24 +115,35 @@ SECTIONS {
*(.data)
*(.data.*)
}

. = ALIGN(CONSTANT(MAXPAGESIZE));
/*
* tdata and tbss have to be side by side to help the linker caculate the
* various __thread variables offsets.
*/
.tdata :
{
_stdata = .;
*(.tdata)
. = ALIGN(CONSTANT(MAXPAGESIZE));
} :tdata

. = ALIGN(CONSTANT(MAXPAGESIZE));
/*
* _edata is the address of the end of the area to be copied with multiboot
* (virtio and xen)
*/
_edata = .;

/* Read-write data (uninitialized) */
.tbss :
{
*(.tbss)
} :tbss
.bss :
{
*(.bss)
*(COMMON)
}
.tbss (NOLOAD) :
{
*(.tbss)
} :tbss
} :bss

. = ALIGN(CONSTANT(MAXPAGESIZE));
_ebss = .;
Expand All @@ -142,4 +154,7 @@ SECTIONS {
/DISCARD/ : {
*(.note.gnu.*)
}

_ltdata = _edata - _stdata;
_ltbss = SIZEOF(.tbss);
}
31 changes: 23 additions & 8 deletions bindings/solo5_xen.lds
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ PHDRS {
text PT_LOAD FLAGS(5); /* No FILEHDR or PHDRS, force R/E only.
FLAGS values come from PF_x in elf.h */
data PT_LOAD;
tdata PT_TLS;
tbss PT_TLS;
tdata PT_LOAD FLAGS(4); /* RO: this have to be copied into each thread */
tbss PT_TLS FLAGS(0); /* no perm needed */
bss PT_NULL FLAGS(0);
note.not_openbsd PT_NOTE; /* Must come first. */
note.xen PT_NOTE;
note.abi PT_NOTE;
Expand Down Expand Up @@ -119,24 +120,35 @@ SECTIONS {
*(.data)
*(.data.*)
}

. = ALIGN(CONSTANT(MAXPAGESIZE));
/*
* tdata and tbss have to be side by side to help the linker caculate the
* various __thread variables offsets.
*/
.tdata :
{
_stdata = .;
*(.tdata)
. = ALIGN(CONSTANT(MAXPAGESIZE));
} :tdata

. = ALIGN(CONSTANT(MAXPAGESIZE));
/*
* _edata is the address of the end of the area to be copied with multiboot
* (virtio and xen)
*/
_edata = .;

/* Read-write data (uninitialized) */
.tbss :
{
*(.tbss)
} :tbss
.bss :
{
*(.bss)
*(COMMON)
}
.tbss (NOLOAD) :
{
*(.tbss)
} :tbss
} :bss

. = ALIGN(CONSTANT(MAXPAGESIZE));
_ebss = .;
Expand All @@ -147,4 +159,7 @@ SECTIONS {
/DISCARD/ : {
*(.note.gnu.*)
}

_ltdata = _edata - _stdata;
_ltbss = SIZEOF(.tbss);
}
Loading