[llvm-commits] COFF patch

Michael Spencer bigcheesegs at gmail.com
Sat Jul 31 01:02:46 PDT 2010


On Thu, Jul 29, 2010 at 7:56 PM, Cameron Esfahani <dirty at apple.com> wrote:
> My first patch, so please be gentle...
>
> This fixes a problem I was seeing with the COFF back end.  All of the string data was getting put into one data fragment, and so none of the fixup references were correct.

Can you post a test case so I can take a look? I'm not quite sure what
the problem is. But I know this isn't the best way to fix the problem.

> I also made sure the TimeDateStamp in the COFF header had a correct value.

This is right.

> I also fixed a spot in MCFragment where Offset wasn't being properly initialized.
>
> This patch was generated against revision 109821.

Also, was this change required to get it to work? The SymbolTableIndex
should be set down on line 674.

@@ -578,12 +580,13 @@ void WinCOFFObjectWriter::RecordRelocation(const
MCAssembler &Asm,
   FixedValue = Target.getConstant();

   COFFRelocation Reloc;

   Reloc.Data.VirtualAddress = Layout.getFragmentOffset(Fragment);
   Reloc.Symb = coff_symbol;
+  Reloc.Data.SymbolTableIndex = 0;

   Reloc.Data.VirtualAddress += Fixup.getOffset();

   switch (Fixup.getKind()) {
   case FirstTargetFixupKind: // reloc_pcrel_4byte
     Reloc.Data.Type = COFF::IMAGE_REL_I386_REL32;

- Michael Spencer




More information about the llvm-commits mailing list