@@ -495,7 +495,9 @@ void X86_64::relaxTlsGdToLe(uint8_t *loc, const Relocation &rel,
495495 // Convert leaq x@tlsdesc(%rip), %REG to movq $x@tpoff, %REG.
496496 if ((loc[-3 ] & 0xfb ) != 0x48 || loc[-2 ] != 0x8d ||
497497 (loc[-1 ] & 0xc7 ) != 0x05 ) {
498- Err (ctx) << getErrorLoc (ctx, loc - 3 )
498+ Err (ctx) << getErrorLoc (ctx, (rel.type == R_X86_64_GOTPC32_TLSDESC)
499+ ? loc - 3
500+ : loc - 4 )
499501 << " R_X86_64_GOTPC32_TLSDESC/R_X86_64_CODE_4_GOTPC32_TLSDESC "
500502 " must be used in leaq x@tlsdesc(%rip), %REG" ;
501503 return ;
@@ -540,11 +542,11 @@ void X86_64::relaxTlsGdToIe(uint8_t *loc, const Relocation &rel,
540542 } else if (rel.type == R_X86_64_GOTPC32_TLSDESC ||
541543 rel.type == R_X86_64_CODE_4_GOTPC32_TLSDESC) {
542544 // Convert leaq x@tlsdesc(%rip), %REG to movq x@gottpoff(%rip), %REG.
543- assert (rel.type == R_X86_64_GOTPC32_TLSDESC ||
544- rel.type == R_X86_64_CODE_4_GOTPC32_TLSDESC);
545545 if ((loc[-3 ] & 0xfb ) != 0x48 || loc[-2 ] != 0x8d ||
546546 (loc[-1 ] & 0xc7 ) != 0x05 ) {
547- Err (ctx) << getErrorLoc (ctx, loc - 3 )
547+ Err (ctx) << getErrorLoc (ctx, (rel.type == R_X86_64_GOTPC32_TLSDESC)
548+ ? loc - 3
549+ : loc - 4 )
548550 << " R_X86_64_GOTPC32_TLSDESC/R_X86_64_CODE_4_GOTPC32_TLSDESC "
549551 " must be used in leaq x@tlsdesc(%rip), %REG" ;
550552 return ;
0 commit comments