[llvm] r221855 - llvm-readobj: Print out address table when dumping COFF delay-import table

Daniel Sanders Daniel.Sanders at imgtec.com
Fri Nov 14 00:50:38 PST 2014


Both buildbots are green again, thanks for fixing this quickly.
________________________________
From: Rui Ueyama [ruiu at google.com]
Sent: 13 November 2014 20:08
To: Daniel Sanders
Cc: llvm-commits at cs.uiuc.edu
Subject: Re: [llvm] r221855 - llvm-readobj: Print out address table when dumping COFF delay-import table

I just submitted r221919 which should fix the breakage on the big-endian machine. I'm sorry to leave the buildbots broken overnight.

On Thu, Nov 13, 2014 at 6:01 AM, Daniel Sanders <Daniel.Sanders at imgtec.com<mailto:Daniel.Sanders at imgtec.com>> wrote:
Hi Rui,

I expect you've already had emails from buildbot about this but imports.tests fails on the big-endian hosts. See http://lab.llvm.org:8011/builders/llvm-mips-linux/builds/11120, and http://lab.llvm.org:8011/builders/llvm-ppc64-linux1/builds/15854 for the logs.

> --- llvm/trunk/lib/Object/COFFObjectFile.cpp (original)
> +++ llvm/trunk/lib/Object/COFFObjectFile.cpp Wed Nov 12 21:22:54 2014
> @@ -1258,6 +1258,20 @@ getDelayImportTable(const delay_import_d
>    return object_error::success;
>  }
>
> +std::error_code DelayImportDirectoryEntryRef::
> +getImportAddress(int AddrIndex, uint64_t &Result) const {
> +  uint32_t RVA = Table[Index].DelayImportAddressTable +
> +      AddrIndex * (OwningObject->is64() ? 8 : 4);
> +  uintptr_t IntPtr = 0;
> +  if (std::error_code EC = OwningObject->getRvaPtr(RVA, IntPtr))
> +    return EC;
> +  if (OwningObject->is64())
> +    Result = *reinterpret_cast<const uint64_t *>(IntPtr);
> +  else
> +    Result = *reinterpret_cast<const uint32_t *>(IntPtr);
> +  return object_error::success;
> +}

I've looked through your patch and I believe the problem is the two reinterpret_casts. They are reading host-endian values but you need to read target-endian values.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141114/9fd1a304/attachment.html>


More information about the llvm-commits mailing list