This is an archive of the discontinued LLVM Phabricator instance.

[x86] Convert little endian Addend to native endian when reading MachO section data.
AbandonedPublic

Authored by dsanders on Oct 9 2014, 6:33 AM.

Details

Reviewers
None
Summary

This patch fixes the MachO_i386_DynNoPIC_relocations.s test on a big-endian Mips
host by replacing two memcpy's with a new version of support::endian::read<>()
that reads the specified number of bytes and converts it to the native endian.

Diff Detail

Event Timeline

dsanders updated this revision to Diff 14651.Oct 9 2014, 6:33 AM
dsanders retitled this revision from to [x86] Convert little endian Addend to native endian when reading MachO section data..
dsanders updated this object.
dsanders edited the test plan for this revision. (Show Details)
dsanders added a subscriber: Unknown Object (MLST).
lhames added a subscriber: lhames.Oct 10 2014, 4:19 PM

Hi Daniel,

Thanks for tracking this down!

I've committed an alternative fix for this in r219543. I believe your fix would have worked equally well, but I want to keep the endian-aware read/write style consistent across RuntimeDyldMachO.

Could you let me know if r219543 fixes the failures you're seeing.

Cheers,
Lang.

dsanders abandoned this revision.Oct 11 2014, 2:27 AM

Thanks, r219543 fixes the test. The remaining two failures (MachO_ARM_PIC_relocations.s and MachO_i386_eh_frame.s) are looking like the same kind of thing but I haven't located the origin of the endian-reversed value yet.