Fix a bug in thread local reloations

There was a bug (also uncovered via binutils) where R_X86_64_DTPOFF64 is
set uncorrectly. This program is the minimal reproducer of the seg fault

  #include <errno.h>
  int main() {
        int oerrno = errno;
  }

But it works after the bug fix.
This commit is contained in:
oddcoder
2020-05-13 23:27:16 +02:00
parent a39447e6a4
commit 43fbaf9970
+1 -1
View File
@@ -666,7 +666,7 @@ impl Linker {
set_u64(tm as u64);
}
reloc::R_X86_64_DTPOFF64 => {
set_u64((s + a) as u64);
set_u64(rel.r_offset as u64);
}
reloc::R_X86_64_GLOB_DAT | reloc::R_X86_64_JUMP_SLOT => {
set_u64(s as u64);