summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'llvm')
-rw-r--r--llvm/test/ObjectYAML/MachO/load_commands.yaml110
-rw-r--r--llvm/tools/yaml2obj/yaml2macho.cpp7
2 files changed, 3 insertions, 114 deletions
diff --git a/llvm/test/ObjectYAML/MachO/load_commands.yaml b/llvm/test/ObjectYAML/MachO/load_commands.yaml
index 43833f58f0e..6de6b3ce1a1 100644
--- a/llvm/test/ObjectYAML/MachO/load_commands.yaml
+++ b/llvm/test/ObjectYAML/MachO/load_commands.yaml
@@ -33,79 +33,6 @@ LoadCommands:
initprot: 5
nsects: 6
flags: 0
- Sections:
- - sectname: __text
- segname: __TEXT
- addr: 0x0000000100001160
- size: 3099
- offset: 0x00001160
- align: 4
- reloff: 0x00000000
- nreloc: 0
- flags: 0x80000400
- reserved1: 0x00000000
- reserved2: 0x00000000
- reserved3: 0x00000000
- - sectname: __stubs
- segname: __TEXT
- addr: 0x0000000100001D7C
- size: 90
- offset: 0x00001D7C
- align: 1
- reloff: 0x00000000
- nreloc: 0
- flags: 0x80000408
- reserved1: 0x00000000
- reserved2: 0x00000006
- reserved3: 0x00000000
- - sectname: __stub_helper
- segname: __TEXT
- addr: 0x0000000100001DD8
- size: 166
- offset: 0x00001DD8
- align: 2
- reloff: 0x00000000
- nreloc: 0
- flags: 0x80000400
- reserved1: 0x00000000
- reserved2: 0x00000000
- reserved3: 0x00000000
- - sectname: __gcc_except_tab
- segname: __TEXT
- addr: 0x0000000100001E80
- size: 240
- offset: 0x00001E80
- align: 2
- reloff: 0x00000000
- nreloc: 0
- flags: 0x00000000
- reserved1: 0x00000000
- reserved2: 0x00000000
- reserved3: 0x00000000
- - sectname: __cstring
- segname: __TEXT
- addr: 0x0000000100001F70
- size: 15
- offset: 0x00001F70
- align: 0
- reloff: 0x00000000
- nreloc: 0
- flags: 0x00000002
- reserved1: 0x00000000
- reserved2: 0x00000000
- reserved3: 0x00000000
- - sectname: __unwind_info
- segname: __TEXT
- addr: 0x0000000100001F80
- size: 120
- offset: 0x00001F80
- align: 2
- reloff: 0x00000000
- nreloc: 0
- flags: 0x00000000
- reserved1: 0x00000000
- reserved2: 0x00000000
- reserved3: 0x00000000
- cmd: LC_SEGMENT_64
cmdsize: 312
segname: __DATA
@@ -117,43 +44,6 @@ LoadCommands:
initprot: 3
nsects: 3
flags: 0
- Sections:
- - sectname: __got
- segname: __DATA
- addr: 0x0000000100002000
- size: 24
- offset: 0x00002000
- align: 3
- reloff: 0x00000000
- nreloc: 0
- flags: 0x00000006
- reserved1: 0x0000000F
- reserved2: 0x00000000
- reserved3: 0x00000000
- - sectname: __nl_symbol_ptr
- segname: __DATA
- addr: 0x0000000100002018
- size: 16
- offset: 0x00002018
- align: 3
- reloff: 0x00000000
- nreloc: 0
- flags: 0x00000006
- reserved1: 0x00000012
- reserved2: 0x00000000
- reserved3: 0x00000000
- - sectname: __la_symbol_ptr
- segname: __DATA
- addr: 0x0000000100002028
- size: 120
- offset: 0x00002028
- align: 3
- reloff: 0x00000000
- nreloc: 0
- flags: 0x00000007
- reserved1: 0x00000014
- reserved2: 0x00000000
- reserved3: 0x00000000
- cmd: LC_SEGMENT_64
cmdsize: 72
segname: __LINKEDIT
diff --git a/llvm/tools/yaml2obj/yaml2macho.cpp b/llvm/tools/yaml2obj/yaml2macho.cpp
index 2a1c6a7e9d2..6d71eef67bc 100644
--- a/llvm/tools/yaml2obj/yaml2macho.cpp
+++ b/llvm/tools/yaml2obj/yaml2macho.cpp
@@ -182,13 +182,12 @@ Error MachOWriter::writeLoadCommands(raw_ostream &OS) {
BytesWritten += LC.ZeroPadBytes;
}
+ // Fill remaining bytes with 0. This will only get hit in partially
+ // specified test cases.
auto BytesRemaining = LC.Data.load_command_data.cmdsize - BytesWritten;
if (BytesRemaining > 0) {
- // TODO: Replace all this once the load command data is present in yaml.
- // For now I fill with 0xDEADBEEF because it is easy to spot on a hex
- // viewer.
std::vector<uint32_t> FillData;
- FillData.insert(FillData.begin(), BytesRemaining / 4 + 1, 0xDEADBEEFu);
+ FillData.insert(FillData.begin(), BytesRemaining, 0);
OS.write(reinterpret_cast<char *>(FillData.data()), BytesRemaining);
}
}
OpenPOWER on IntegriCloud