mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 02:33:06 +01:00
[llvm-objcopy] Fix section group flag read/write when operating on a cross-endian object file
This commit is contained in:
parent
5e3045ed0c
commit
3698f6f3f3
@ -1187,7 +1187,7 @@ template <class ELFT>
|
||||
Error ELFSectionWriter<ELFT>::visit(const GroupSection &Sec) {
|
||||
ELF::Elf32_Word *Buf =
|
||||
reinterpret_cast<ELF::Elf32_Word *>(Out.getBufferStart() + Sec.Offset);
|
||||
*Buf++ = Sec.FlagWord;
|
||||
support::endian::write32<ELFT::TargetEndianness>(Buf++, Sec.FlagWord);
|
||||
for (SectionBase *S : Sec.GroupMembers)
|
||||
support::endian::write32<ELFT::TargetEndianness>(Buf++, S->Index);
|
||||
return Error::success();
|
||||
@ -1517,7 +1517,8 @@ Error ELFBuilder<ELFT>::initGroupSection(GroupSection *GroupSec) {
|
||||
reinterpret_cast<const ELF::Elf32_Word *>(GroupSec->Contents.data());
|
||||
const ELF::Elf32_Word *End =
|
||||
Word + GroupSec->Contents.size() / sizeof(ELF::Elf32_Word);
|
||||
GroupSec->setFlagWord(*Word++);
|
||||
GroupSec->setFlagWord(
|
||||
support::endian::read32<ELFT::TargetEndianness>(Word++));
|
||||
for (; Word != End; ++Word) {
|
||||
uint32_t Index = support::endian::read32<ELFT::TargetEndianness>(Word);
|
||||
Expected<SectionBase *> Sec = SecTable.getSection(
|
||||
|
Loading…
Reference in New Issue
Block a user