This is an archive of the discontinued LLVM Phabricator instance.

[ELF2] Fix mixed-Endian handling in DynamicSection<ELFT>::writeTo
ClosedPublic

Authored by hfinkel on Oct 1 2015, 1:27 PM.

Details

Summary

Using the "raw" Elf64_Dyn or Elf32_Dyn structures in DynamicSection<ELFT>::writeTo does not correctly handle mixed-Endian situations. Instead, use the corresponding llvm::object::* structures which have Endian-converting members (like the rest of the code).

This fixes all currently-failing elf2 tests when running on big-Endian PPC64/Linux.

Diff Detail

Event Timeline

hfinkel updated this revision to Diff 36290.Oct 1 2015, 1:27 PM
hfinkel retitled this revision from to [ELF2] Fix mixed-Endian handling in DynamicSection<ELFT>::writeTo.
hfinkel updated this object.
hfinkel added reviewers: ruiu, rafael.
hfinkel added a project: lld.
hfinkel added a subscriber: llvm-commits.
rafael edited edge metadata.Oct 2 2015, 6:48 AM
rafael added a subscriber: rafael.

It should be possible to add a testcase with a big ending .o file that
is currently failing when running on a little endian machine, no?
LGTM wit that.

hfinkel accepted this revision.Oct 2 2015, 9:24 AM
hfinkel added a reviewer: hfinkel.

With a test case, r249150.

This revision is now accepted and ready to land.Oct 2 2015, 9:24 AM
hfinkel closed this revision.Oct 2 2015, 9:24 AM