[llvmlinux] [llvm-commits] new linux/llvm patches

David Woodhouse dwmw2 at infradead.org
Thu Jan 30 22:29:57 UTC 2014


On Sat, 2012-05-12 at 13:48 +0200, benny.kraa wrote:
> 
> >   - elf-emit-R_X86_64_32S.patch: this is a fix for a link-time problem (wrong
> >     relocation type gets emitted for some insns on amd64), i'm sure there's a
> >     better way to identify all the affected insns but for now i just used a 
> >     simple grep you can find in the patch to produce the full list.
> 
> Ugly, this information should be tablegen'd somehow.

Fixed in r200495. The patch will just have gone by, but the salient part
is this:

@@ -1566,17 +1572,8 @@ EncodeInstruction(const MCInst &MI, raw_ostream &OS,
       EmitImmediate(MCOperand::CreateImm(RegNum), MI.getLoc(), 1, FK_Data_1,
                     CurByte, OS, Fixups);
     } else {
-      unsigned FixupKind;
-      // FIXME: Is there a better way to know that we need a signed relocation?
-      if (MI.getOpcode() == X86::ADD64ri32 ||
-          MI.getOpcode() == X86::MOV64ri32 ||
-          MI.getOpcode() == X86::MOV64mi32 ||
-          MI.getOpcode() == X86::PUSH64i32)
-        FixupKind = X86::reloc_signed_4byte;
-      else
-        FixupKind = getImmFixupKind(TSFlags);
       EmitImmediate(MI.getOperand(CurOp++), MI.getLoc(),
-                    X86II::getSizeOfImm(TSFlags), MCFixupKind(FixupKind),
+                    X86II::getSizeOfImm(TSFlags), getImmFixupKind(TSFlags),
                     CurByte, OS, Fixups);
     }
   }

Fixing 16-bit and 8-bit signed relocations, if necessary, is left as an
exercise for the reader. We never normally emit those anyway since we'd
relax to 32-bit if it's not locally defined. We *may* end up changing
that for .code16 for code size reasons (people are complaining that they
can't build their boot sectors with my llvm 16-bit support) but I'll
cross that bridge when I get to it.

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse at intel.com                              Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5745 bytes
Desc: not available
URL: <http://lists.linuxfoundation.org/pipermail/llvmlinux/attachments/20140130/7fa2417a/attachment.bin>


More information about the LLVMLinux mailing list