Skip to content
Snippets Groups Projects
Commit eee9a80b authored by 8tab's avatar 8tab
Browse files

Fix tls tests for dynamic linker

* load TLS segment for executable - while we can skip PT_LOAD for executable,
  we still have to load TLS segment.
* set TCB address based on if elf is position independent
parent 687f4d49
No related branches found
No related tags found
No related merge requests found
......@@ -604,9 +604,6 @@ impl Linker {
} else {
false
};
if same_elf {
continue;
}
let object = match lib.objects.get(*elf_name) {
Some(some) => some,
None => continue,
......@@ -627,6 +624,9 @@ impl Linker {
match ph.p_type {
program_header::PT_LOAD => {
if same_elf {
continue;
}
let obj_data = {
let range = ph.file_range();
match object.get(range.clone()) {
......@@ -671,9 +671,15 @@ impl Linker {
} else {
ph.p_memsz
} as usize;
let ptr = unsafe {
if is_pie_enabled(elf) {
mmap.as_ptr().add(ph.p_vaddr as usize)
} else {
ph.p_vaddr as *const u8
}
};
let mut tcb_master = Master {
ptr: unsafe { mmap.as_ptr().add(ph.p_vaddr as usize - base_addr) },
ptr: ptr,
len: ph.p_filesz as usize,
offset: tls_size - valign,
};
......
......@@ -73,6 +73,7 @@ EXPECT_NAMES=\
time/mktime \
time/strftime \
time/time \
tls \
unistd/access \
unistd/brk \
unistd/dup \
......@@ -121,9 +122,6 @@ STATIC_ONLY_NAMES=\
# need to call fini in ld_so's _start
STATIC_ONLY_NAMES+=\
destructor \
# comparison issue
STATIC_ONLY_NAMES+=\
tls \
# issues with linking optarg, optind etc.
STATIC_ONLY_NAMES+=\
unistd/getopt \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment