OSDN Git Service

[yaml2obj][MachO] Don't fill dummy data for virtual sections
authorSeiya Nuta <nuta@seiya.me>
Mon, 17 Jun 2019 02:07:20 +0000 (02:07 +0000)
committerSeiya Nuta <nuta@seiya.me>
Mon, 17 Jun 2019 02:07:20 +0000 (02:07 +0000)
commitf99a09c3b08d5727c9b217ecdee2b79c433fc580
tree4075d4a6773cc972e530d59b2493268998665bc7
parentfef0e8cd354dba6d476ff4f199dacdd5df8ee239
[yaml2obj][MachO] Don't fill dummy data for virtual sections

Summary:
Currently, MachOWriter::writeSectionData writes dummy data (0xdeadbeef) to fill section data areas in the file even if the section is a virtual one. Since virtual sections don't occupy any space in the file, writing dummy data could results the  "OS.tell() - fileStart <= Sec.offset" assertion failure.

This patch fixes the bug by simply not writing any dummy data for virtual sections.

Reviewers: beanz, jhenderson, rupprecht, alexshap

Reviewed By: alexshap

Subscribers: compnerd, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D62991

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363525 91177308-0d34-0410-b5e6-96231b3b80d8
test/ObjectYAML/MachO/virtual_section.yaml [new file with mode: 0644]
tools/yaml2obj/yaml2macho.cpp