Move the logic to get TLS information from an inline function to a normal function. For the unaligned case, it is probably too large to be inlined. Also fixes some minor things from review of previous commits.