diff options
author | peter <peter@FreeBSD.org> | 2004-11-06 03:32:07 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2004-11-06 03:32:07 +0000 |
commit | 39432ffbdfc0e85d9c7a0989460e4344f1d06d1e (patch) | |
tree | f1deb9574db1f367a54d2c5875460d739aaf1d44 /libexec/rtld-elf | |
parent | 6185c69a2b510d449838ff2ba5973e3933fc3742 (diff) | |
download | FreeBSD-src-39432ffbdfc0e85d9c7a0989460e4344f1d06d1e.zip FreeBSD-src-39432ffbdfc0e85d9c7a0989460e4344f1d06d1e.tar.gz |
The 32 bit compatability ld-elf32.so.1 cannot use i386_set_ldt() when
running on an amd64 kernel. Use the recently exposed direct %fs/%gs set
routines instead for the TLS setup of 32 bit binaries.
Diffstat (limited to 'libexec/rtld-elf')
-rw-r--r-- | libexec/rtld-elf/i386/reloc.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libexec/rtld-elf/i386/reloc.c b/libexec/rtld-elf/i386/reloc.c index b02fdca..58cd38a 100644 --- a/libexec/rtld-elf/i386/reloc.c +++ b/libexec/rtld-elf/i386/reloc.c @@ -327,8 +327,10 @@ void allocate_initial_tls(Obj_Entry *objs) { void* tls; +#ifndef COMPAT_32BIT union descriptor ldt; int sel; +#endif /* * Fix the size of the static TLS block by using the maximum @@ -338,6 +340,7 @@ allocate_initial_tls(Obj_Entry *objs) tls_static_space = tls_last_offset + RTLD_STATIC_TLS_EXTRA; tls = allocate_tls(objs, NULL, 2*sizeof(Elf_Addr), sizeof(Elf_Addr)); +#ifndef COMPAT_32BIT memset(&ldt, 0, sizeof(ldt)); ldt.sd.sd_lolimit = 0xffff; /* 4G limit */ ldt.sd.sd_lobase = ((Elf_Addr)tls) & 0xffffff; @@ -350,6 +353,9 @@ allocate_initial_tls(Obj_Entry *objs) ldt.sd.sd_hibase = (((Elf_Addr)tls) >> 24) & 0xff; sel = i386_set_ldt(LDT_AUTO_ALLOC, &ldt, 1); __asm __volatile("movl %0,%%gs" : : "rm" ((sel << 3) | 7)); +#else + _amd64_set_gsbase(tls); +#endif } /* GNU ABI */ |