[PATCH] D15494: [ELF] - implemented @indntpoff (x86) relocation and its optimization.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 14 16:32:00 PST 2015


ruiu added inline comments.

================
Comment at: ELF/Target.cpp:519-520
@@ +518,4 @@
+    // For R_386_TLS_IE relocation we perform the next transformations:
+    // MOVL foo at INDNTPOFF,%EAX is transformed to MOVL $foo,%EAX
+    // MOVL foo at INDNTPOFF,%REG is transformed to MOVL $foo,%REG
+    // ADDL foo at INDNTPOFF,%REG is transformed to ADDL $foo,%REG
----------------
silvas wrote:
> ruiu wrote:
> > Isn't the former a special case of the latter? (EAX is a REG?)
> There is a special encoding for the EAX version, so from a linker's perspective (operations on machine code bytes) they are different. There are many x86 instructions for which eax is special (carry-over from old 8086 CISC stuff). Originally, ax = "accumulator" register and had a special "load accumulator" instruction which now is a special encoding pattern-matched by the assembler for assembly text `mov $foo,%eax`. Another example is use of cx "count" register as arg for variable bit shift.
But still it looks odd as a comment. Maybe we should add

  // 0xA1 is RAX. RAX encoding is different from others

to 

  if (*RegSlot == 0xA1) {

?


http://reviews.llvm.org/D15494





More information about the llvm-commits mailing list